Skip to Content

Part 2 – Connecting SOAP Web services with Integration Gateway in SMP3

This write-up is an extension to this blog How to connect SOAP WebServices with Integration Gateway in SMP3 written by Marvin Hoffmann

As you can see for the given SOAP WS, http://www.predic8.com:8080/material/ArticleService?wsdl there are 4 different methods. As we have already seen how to do OData modeling for get, getAll methods, now its time for other methods Create & Delete.

/wp-content/uploads/2014/08/1_526657.png

Assuming you have already installed “SAP Mobile Platform Tools” plugins in Eclipse Kepler. (How to?) and created one sample OData service Implementation project with having one main entity type and one complex type as mentioned in this blog.

CREATE:

1. Right click ArticleModel.odatasrv > Select Data source

2. Select “Create” as operation type and as data source “SOAP Service” > Click ‘Next’

/wp-content/uploads/2014/08/createdatasource_655682.png

3. Browse to the wsdl file path, select ‘create’ operation. Endpoint location will be populated automatically.

create.PNG

4. Right click on Create> Define Request mapping > OK

/wp-content/uploads/2014/08/createreq_655684.png

5. Request Mapping

/wp-content/uploads/2014/08/42_531439.png

6. Similarly, right click on create> Define Response Mapping

/wp-content/uploads/2014/08/articlecreateresponse_578124.png

DELETE:

7. Repeat step #1.

8. Select “Delete” as operation type and as data source “SOAP Service“.

delete.PNG

9. Select operation ‘delete

deleteselec.PNG

10. Request mapping:

/wp-content/uploads/2014/08/43_531557.png

11. Response Mapping:

/wp-content/uploads/2014/08/26_526685.png

Note: Since ArticleID is a key in the EntitySet so in the response mapping it can not be left unmapped. It has to be mapped otherwise you will get an error and so won’t be able to deploy the project.

12. Once done, right click on project > Generate and Deploy Integrate Content

13. To test service document for the newly added methods create & delete,first we need to get CSRF-TOKEN using GET method. So, make a GET request first as below

(OData service exposed via Integration Gateway listens on SMP Admin port 8083 (HTTPS), so pass SMP admin credentials under header section)

/wp-content/uploads/2014/08/createcsrfrequest_655687.png

14. For creating a record, we have to call POST method. Pass the returned CSRF-TOKEN in the header section with below body section.

createrequest.PNG


<?xml version="1.0" encoding="UTF-8"?>
<atom:entry xmlns:atom="http://www.w3.org/2005/Atom" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">
   <atom:content type="application/xml">
      <m:properties>
         <d:ArticleID />
         <d:Name>Ginger tea</d:Name>
         <d:Descirption>Good for health</d:Descirption>
         <d:Price m:type="ArticleModel.Price">
            <d:Amount>10</d:Amount>
<d:Currency>EUR</d:Currency>
         </d:Price>
      </m:properties>
   </atom:content>
</atom:entry>

You must get “Status 201 Created” in the response.

/wp-content/uploads/2014/08/createresponse_655692.png

15. For Deleting an existing record, select DELETE as below. You must get “Status 204 No Content” in the response.

/wp-content/uploads/2014/08/deleteresponse_655693.png

Tips:

1. For Payload, it is always recommended to follow parameters data types and values as per service metadata document.

https://jk:8083/gateway/odata/sap/ArticleService;v=1/$metadata

 

metadta.PNG

2. If you are encountered with “Status 400 Bad Request” message in response then it might be of because of payload syntax missing/mismatch.

/wp-content/uploads/2014/08/27_526687.png

Use Xml formatterĀ  http://www.freeformatter.com/xml-formatter.html for assistance

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