Skip to Content

I already wrote several blog posts on how to use the Integration Gateway. But till now I was always using databases as data source. Using a SOAP web service as data source is even nicer, because you can use a graphical mapping editor (part of the GWPA eclipse plugin) to define the request and response mapping.

In this tutorial we will connect a SOAP web service to SMP3’s integration gateway and realize a Query and a Read operation

How to connect SOAP WebServices with Integration Gateway in SMP3

In this example we will use the following free sample SOAP Web Service http://www.predic8.com:8080/material/ArticleService?wsdl . This is a small service which will give us a list of articles. We can list all, one specific, create or delete entries.

There are many different tools to test SOAP Web Services,e.g. SOAP UI. Another free, very small and nice utility is Storm (http://storm.codeplex.com/) which I used here.

01_Storm_SOAP_Client.png

If you execute the getAll Operation you can see (at the moment) that there are two articles in the store (Black Tea and Assam Tea).

I assume that you already installed the GWPA plugin into eclipse. If not, please follow the steps as described in my previous blog post here: How to install Gateway Productivity Accelerator (GWPA) plugin for Integration Gateway

Model the OData Service

1. Open eclipse and create a new OData Development > Service Implementation Project

02_Create_Intregation_Gateway_Project.png

2. Define a project name, e.g. “ArticleService” and select the option “Create OData file manually”
03_ODataService_ProjectName.png

3. Expand the newly created project and right click on the “model” folder inside src/main/resources and create a new OData Model
04_ODataService_Create_Model.png

4. Provide a name for this model, e.g. DataModel (Initial model content: Blank OData model).

5. Let’s build our ODataModel the same way our SOAP web service is modeled. Create a new “Entity Type” via Drag&Drop in the odata model editor. the name of the entity set will be your collection name that is also represented in your URL when you (later) request data from the OData service. Also create via Drag&Drop the complex type Price and add the two properties Amount and Currency.

06_ODataService_Entity_Type.png

6. Then add the properties to out Article Entity Type. Normal properties are ArticleID, Name and Description. Then choose “Add Complex Property” and call it Price.

07_ODataService_Add_Complex_Property.png

7. Select the added complex property and choose the type in the Properties > General panel. Because we previously created the complex type in our OData Model we can find “DataModel.Price” in the drop down menu.

08_ODataService_Type_Complex.png

8. Now we finished modeling the Odata service.

Implement the OData Service

1. Right click on the OData model and choose “Implement Service”. Be aware that if you change anything in the OData model you always have to re-implement the service!

09_Implement_Service.png

2. Right click on the implemented service and choose “Select Data source”

10_Select_DataSource.png

3. Select “Query” as operation type and as data source “SOAP Service”

11_Select_DataSource_Query.png

4. Provide the following connection details

Property Value
Endpoint http://www.predic8.com:8080/material/ArticleService
Namespace http://predic8.com/wsdl/material/ArticleService/1/
Operation getAll
Port Type ArticleServicePT

12_Set_Connection_Details.png

You can find these values by checking your wsdl file. So download the wsdl file of the SOAP web service http://www.predic8.com:8080/material/ArticleService?wsdl . Open it. You can find the SOAP endpoint usually at the end of the document inside the tag <soap:address location=”….”>

13_SOAP_Endpoint.png

The target namespace is mentioned in the beginning inside the tag <xsd:schema … targetNamespace=”…”>

14_SOAP_Namespace.png

The operations (tag <operation name=”…”>) can be also read out, usually wrapped by the port type (tag: <portType name=”…”>)

15_SOAP_PortType_Operation.png

5. Expand the path below the OData implementation. A new SOAP operation should be added here. Right click on it and choose “Define Response Mapping”. As the name said the response mapping is responsible inside our OData service for returning data as a response to a request. Here you can also implement a custom request logic by choosing “Define Custom Logic for Request”. This is quite interesting, because in this way you have the possibility to write a Java class where you can implement filter or other operations your OData service should provide.

16_Define_Response_Mapping.png

6. Choose “Browse…” and navigate to your downloaded wsdl file. If you don’t have downloaded it, do it now: http://www.predic8.com:8080/material/ArticleService?wsdl

17_Browse_WSDL_File.png

7. Define a message mapping. On the left side you can see the SOAP web service and on the right side our OData EntityType. Connect the properties via Drag&Drop. Don’t forget to bind also the Entity itself, from “article” to “Article”. Save the project after this actions.

17_Mapping.png

8. Right click on your whole project and click “Generate and Deploy Integration Content”.

18_Generate_and_deploy_integration_content.png

9. the Service name will be the OData Service name running on the integration gateway. The Service Namespace will be also part of the URL and additionally it defines the security profile which should be checked when accessing this OData service.

18_2_Generate_and_Deploy.png

Test the OData Service

1. After successful deployment, go to your browser and open the SMP3 Management Cockpit ( https://smpserver:8083/Admin/ ). Open tab Settings > Security Profiles and create a new Security Profile called “sap” (names like the Service Namespace we defined in the previous step during deployment). then add a new authentication provider for it. In this example we will add a “No Authentication Challenge” Provider which will simply let anyone access our OData service (should be only used for testing/development purpose!). Click on “Save”.

19_Create_SAP_Security_Profile.png

2. Now open the Gateway Cockpit ( https://smpserver:8083/gateway/cockpit ). You should find a new service called “ArticleService”. Click on “Open Service Document”.

20_Gateway_Management_Cockpit.png

3. You can see the Service Document of your OData service.

21_OData_ArticleService.png

4. Let’s check if our implementation is working by accessing the ArticleSet Collection, the path will be http://smpserver:8080/gateway/odata/sap/ArticleService;v=1/ArticleSet

22_OData_ArticleService_Data.png

5. As you can see we are receiving OData coming from the SOAP web service.

Extend the OData Service with other Operations

1. If we want to access a single entity, e.g. by calling inside the browser:

http://smpserver:8080/gateway/odata/sap/ArticleService;v=1/ArticleSet(‘AR-00001‘) we will get the OData error “while trying to invoke the method java.lang.String.length() of a null objectt loaded from local variable ‘s'”. And actually the OData Service is correct. We didn’t implement the Read Operation, so it can’ work…

23_OData_AtricleSet_Entity_Not_implemented.png

2. So then let’s implement the OData read operation. Inside your eclipse project right click on the service implementation and choose “Select Data Source” again. This time choose operation “Read”.

24_Select_DataSource_Read.png

3. Specify the connection details. This time we want to realize another operation, so we will specify the “get” operation of the SOAP web service.

25_Select_DataSource_Connection_Details.png

4. Now you can see the two operations Query and Read. Right click on Read and choose “Define Request Mapping”.

26_ArticleSet_DefineReadResponseMapping.png

5. For the Request Mapping we want to give the Primary Key (ArticleID) and the OData service should return us the corresponding object.

27_ArticleSet_DefineRequestMapping.png

6. Let’s define the Response Mapping for the “Read” operation. This is straight forward…

27_ArticleSet_DefineResponseMapping.png

7. After that save everything and deploy the OData Service to SMP3 (right click on the project and choose “Generate and Deploy Integration Content”)

8. If you now are accessing our OData service with a specific element you will get returned the requested element…

29_ArticleSet_ReadEntity.png

9. So we have now an OData service which is realizing two operations of the SOAP web service. You could now continue and realize the CREATE and DELETE operations to let the OData service provide the same functionality than the chosen SOAP web service…

I hope this tutorial is helping to understand the idea behind integrating SOAP web services with SMP 3. Unfortunately, there are many restrictions/limitations at the moment in regards to the support SOAP web services. For a list of restrictions you can check the following two SAP notes:

For GWPA eclipse plugin: 1830710 – Gateway Productivity Accelerators Release Note & Constraints > Constraints > Toolkit for Integration Gateway

For Integration Gateway: 1931374 – Integration Gateway for SAP Mobile Platform 3.0 – Known Constraints

Anyway, the integration gateway is a powerful component and will be enhanced in future…

To report this post you need to login first.

36 Comments

You must be Logged on to comment or reply to a post.

  1. Lawrence Lu

    hi Marvin

    this is the right guide i want. i could make it work by following your blog.

    it’s really helpful. Really appreciate your work, and hope you could share more 😛

    but i have a few doubts:

    1. seems your source web service is very like odata CRUD service, it’s very easy to use it as OData service. but it’s still different from the actually project requirement. let’s say we have an existed web service to get the sales order, i don’t think the web service will have a getAllSalesOrder function, because the data volume is very large. so usually there will more query parameter(like start-time, end-time). in this case, which kind of operation we should use? create, update, read? definitely we cannot use query which cannot define request parameter mapping.

    2. at the end of your blog, you mentioned there are many restrictions/limitations, the restrictions/limitations means not all the web service supported by smp? cause i try some web service, in the mapping, the structure cannot display, does it mean that these kind of web service need to re-developed? or is there any specification detailed about the limitations?

    thanks a lot

    best regards

    lawrence

    (0) 
    1. Marvin Hoffmann Post author

      Hi Lawrence,

      thanks for the feedback

      to your questions:

      1) Of course it is only a simple sample web service which should show the general way on how integration gateway is working.

      You can define a custom logic for the Request Mapping when realizing the Query operation (I mentioned it shortly in step 5 of “Implement the OData service”). This means in your SalesOrder case you might have a collection/entity set called SalesOrderCollection. Because as you said you might not have a getAll function available you can have to implement some OData filter, so e.g. that you could call the OData service like this …/SalesOrderCollection?$filter=start-time eq ‘2014-03-16’ which would show you only the sales orders from today. Instead of “equal” you can also implement other operators like greater/less or you can combine several filter. But as I said you would have to implement these filters in a Java class. If I find some time in the next week I will try to write a blog post for this…

      2) Most problem (in my opinion) is the supported compatibility of the WSDL file. I edited the blog post and inserted two SAP notes at the end which mention some restrictions. SAP Note 1830710 is the more interesting one. Check it under Constraints > Toolkit for Integration Gateway…

      (0) 
  2. Mayur Dharukiya

    Hi Marvin,

    is it possible to create OData Service required from the Scratch or say combining multiple SOAP and Rest services, customize it and then develop new OData Service. We are encountering variety of back-ends including custom non-sap applications/portals. How to connect to NON-SAP WeB Portals and other custom web apps through integration gateway?

    (0) 
    1. Marvin Hoffmann Post author

      Hi Mayur,

      the SMP3.0 is still in RampUp. If you are not a RampUp customer you cannot get it. The Integration Gateway is part of the SMP 3.0 on premise version.

      Regards

      Marvin

      (0) 
      1. Mayur Dharukiya

        Oh You mean Integration Gateway is not available on SMP Cloud? if that is the case,how do we do testing to connect with various back-ends without integration gateway?

        Is it possible to create oData Service from scratch using Integration Gateway?if yes, which language we use to write custom logic? Is it also possible to combine multiple data sources such as one SOAP serice, One Rest Service and data from any RDMS system and create single OData Service?

        Regards,
        Mayur

        (0) 
        1. Vishnupriya Varadharajan

          Yes. I have the same question. For SMP 3.0, we have Integration Gateway and that will help in creating Odata services from a SOAP service or JDBC etc..using GWPA.

          When using SMP2.3 there is no such thing called Integration Gateway. But we have MBO support in SMP 2.3 but it is going to be scrapped in SMP 3.0 and hence that approach is not advisable. How do we come up with OData services with our existing SOAP web service and consume it from a REST based application using SMP 2.3?

          (0) 
        2. Marvin Hoffmann Post author

          In SMP Cloud you can use the Cloud Connector, but it is usually intended to work with your SAP backend systems…

          Mayur Dharukiya wrote:

          Is it possible to create oData Service from scratch using Integration Gateway?if yes, which language we use to write custom logic? Is it also possible to combine multiple data sources such as one SOAP serice, One Rest Service and data from any RDMS system and create single OData Service?

          Regards,
          Mayur

          Developing of OData Services usually consists of two steps

          1) OData Model Creation

          2) OData Service Implementation

          Both steps you can perform with GWPA. Step 2 only if you choose as backends SOAP, JDBC, ODC, JPA.

          Custom logic can be inserted (e.g. to implement your own queries) using Java.

          Combination of several backend sources should be supported soon. I am not sure if it is already possible in the current public release of GWPA.

          But REST web services are not supported with Integration Gateway at the moment.

          Regards

          Marvin

          (0) 
      2. Vishnupriya Varadharajan

        Hi Marvin,

        From your blog I got to know of Integration Gateway constraints..and one of them is :

        Destination assignments through Gateway Management Cockpit are not supported. The Destination or connectivity parameters  for the SOAP services can only be maintained through the Integration Gateway eclipse plugin.

        I am trying to create OData services using a SOAP web service with requires authorization,

        How do we configure the credentials for the destination backend here in eclipse since it cant be done using gateway management cockpit?

        I tried giving “anonymous user” when I create Application in SMP admin console and I am able to successfully Register . But when I try to do a HTTP GET, I get an error like “No handler for data”,

        Have you ever come across such errors?

        Thanks

        Vishnupriya

        (0) 
  3. Chuck Chen

    It’s really good step by step guide, but unfortunetely I stuck on the step 7. I download this xml and change it wsdl. On the message mapping, I only see “article” w/o further fields in the left side.

    Thanks for help.

    (0) 
    1. Marvin Hoffmann Post author

      Hi Chuck,

      this is a common error usually related to your network connection. When you do the mapping eclipse need to have a network connection to the SOAP web service. So check your internet connection, or if you are behind a proxy set the proxy settings inside eclipse’s settings. If you now create a new mapping make sure to delete all previous (wrong mappings) stored in folder “mapping”.

      (0) 
  4. Marvin Hoffmann Post author

    Hi Mayur,

    you can write custom logic in Java to define e.g. OData filter for SOAP Web services:

    GWPA_Create_Custom_Logic_For_Request.png

    This will create a Java file for you in which you can insert your custom logic…

    (0) 
  5. Vishnupriya Varadharajan

    Hi Marvin,


    In the constraints and limitations, there is one point like


    Destination assignments through Gateway Management Cockpit are not supported. The Destination or connectivity parameters for the SOAP services can only be maintained through the Integration Gateway eclipse plugin.


    I have a secured web service which requires username/password to be passed on.. how and where can we configure the credentials if it cant be done in “Destinations” in Gateway Management Cockpit? Please advice.


    Thanks

    Vishnupriya

    (0) 
  6. Rakshit Doshi

    Hi Marvin,

    This is a very nice blog for startup.

    Can you please add an example on how to create models for request response type..Like if there is a method for GettingEmployeeInfo which takes in Employee numbers as input and then gives out the output how should we proceed for such a scenarios.

    Thanks,

    Best Regards,

    Rakshit Doshi

    (0) 
      1. Rakshit Doshi

        Hi Marvin,

        can you share an example of a create operation using soap web service.

        do we need to define the fields as keys or properties during entity model design

        thanks,

        BEst Regards

        (0) 
  7. Pawan Valecha

    Hi,

    this is Prateek ,

    I am following the same tutorial to create odata services , but while defining Port Type i am facing some issues regading Port Type.

    Please help me.

    Thanks in Advance.

    (0) 
    1. Vishnupriya Varadharajan

      Hi Prateek,

      This could be because of the WSDL with its definition spread across multiple files(multiple imports)..Currently, the Mapping editor expects the completed definition of WSDL to be in a single file. If not, it will fail to resolve the types and will not detect the structures available in other files and included via the ‘import’ or ‘include’ construct.

      Please look at the below links as mentioned in this blog:

      For GWPA eclipse plugin: 1830710 – Gateway Productivity Accelerators Release Note & Constraints > Constraints > Toolkit for Integration Gateway

      For Integration Gateway: 1931374 – Integration Gateway for SAP Mobile Platform 3.0 – Known Constraints

      Regards,

      Vishnupriya

      (0) 
  8. Basuki -

    Hi Marvin,

    Good article for starting using smp 3 and integration gateway, one question from me, how to define user and password if the web service need authentication for getting data, in case webservice from sybase mobiliser 5.1

    Thanks

    Basuki

    (0) 
    1. Marvin Hoffmann Post author

      Integration of authenticated SOAP web services are (unfortunatelly) not possible at the moment. You might need to wait for the coming SMP3 SP04 …

      (0) 
      1. Basuki -

        Hi Marvin,

        Thanks for explanation, but im need access data from web service with authentication, what possible if custom logic on java, for access that webservice and convert to Odata service..?

        Thanks

        (0) 
        1. Marvin Hoffmann Post author

          Hi Basuki ,

          hm yes, unfortunatelly I did not find the time yet to write some blog entries. But you could do it the following way.

          1) Get eclipse Kepler and add the “API toolkit for SAP Mobile Platform” in order to get the new IGW toolkit for SP04

          2) Model your OData service, select your Data Source and then click on “Define Custom Code” (Then choose JavaScript)
          02_Define_Custom_Code.png

          3) Then implement method processRequestData(message)
          With message.setHeader you can set additional headers. Here you could also set an authorization header with user and password encoded in base64:
          03_processRequestData.png

          Regards

          Marvin

          (0) 
  9. Devraj Singh

    Hi Experts;

    Everything goes well until I have tried to deploy the content. It has thrown below error.

    Deployment cannot be completed for IGW_EPM_DEMO

    Thu Jan 29 17:18:30 IST 2015 | Validator Logs :

    Thu Jan 29 17:18:30 IST 2015 | ERROR : Enter a condition that starts and ends with header/body/constant <IFlowEditor/etype:SequenceFlow/eid:_SequenceFlow_14/pid:iflow.advance.sequenceflow.tab/location:SequenceFlow>

    Thu Jan 29 17:18:30 IST 2015 | ERROR : Runtime does not support the flow element gw_converter <Project/location:Project>

    Thu Jan 29 17:18:30 IST 2015 | ERROR : Runtime does not support the flow element gw_converter <Project/location:Project>

    Thu Jan 29 17:18:30 IST 2015 | ERROR : Runtime does not support the flow element gw_converter <Project/location:Project>

    Thu Jan 29 17:18:30 IST 2015 | INFO : Mapping Completion Check is successful <mmap>

    Thu Jan 29 17:18:30 IST 2015 | INFO : Mapping Location Check is successful <mmap>

    Thu Jan 29 17:18:30 IST 2015 | INFO : Source/Target check completed successfully <mmap>

    Thu Jan 29 17:18:30 IST 2015 | Generation started for IGW_EPM_Demo project

    Thu Jan 29 17:18:30 IST 2015 | Generation and build failed for IGW_EPM_Demo as validation of resource is failed

    Thu Jan 29 17:18:30 IST 2015 | Deploy skipped; project list is empty

    Thu Jan 29 17:18:30 IST 2015 | Generation, build and deploy failed for task 562ef794-010e-45ef-b47e-33f870708a7d

    Regards’

    Devraj

    (0) 
  10. reena sharma

    Hi All,

     

    I am facing one problem with my web service call that when i am calling from  SMP i am getting mapping error in which it is asking for input mapping name expected error ,that i have already set via js custom code .

    Plase help me with this.

     

    Thanks,

    Reena

    (0) 

Leave a Reply