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.
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.
1. Right click ArticleModel.odatasrv > Select Data source
2. Select “Create” as operation type and as data source “SOAP Service” > Click ‘Next’
3. Browse to the wsdl file path, select ‘create’ operation. Endpoint location will be populated automatically.
4. Right click on Create> Define Request mapping > OK
5. Request Mapping
6. Similarly, right click on create> Define Response Mapping
7. Repeat step #1.
8. Select “Delete” as operation type and as data source “SOAP Service“.
9. Select operation ‘delete‘
10. Request mapping:
11. Response Mapping:
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)
14. For creating a record, we have to call POST method. Pass the returned CSRF-TOKEN in the header section with below body section.
<?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.
15. For Deleting an existing record, select DELETE as below. You must get “Status 204 No Content” in the response.
1. For Payload, it is always recommended to follow parameters data types and values as per service metadata document.
2. If you are encountered with “Status 400 Bad Request” message in response then it might be of because of payload syntax missing/mismatch.
Use Xml formatter http://www.freeformatter.com/xml-formatter.html for assistance