Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
tejesvi_dvr
Explorer

Introduction

This blog gives details about various operations supported for a SOAP data source. It gives details about creating an odata model, adding the web service operation and doing request and response mappings from design time tool.


Steps from Design Time tool

Query Operation

  1. Create an OData Service Implementation Project
  2. Create an OData Model for getProduct operation, which can have properties ProductID, ProductName, ProductDescription, SupplierId, isDeleted

   

3. Right click on odatasvc and choose Select data source  


4. Select the entity set and choose the query CRUD operation. Select the data source SOAP Service.


   


5. Specify the wsdl file and choose the getProducts operation from the list of soap operations and click on finish


   


6. Right click on Query and select Define Custom Code.


  

7. Select the script type as either java script or groovy script


   

Details about scripting can be found in the Handling Script in Integration Gateway(Methods,Headers & Properties)


8. Right click on Query and select Define Response Mapping


   


9. Do the mapping as below

   

10. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.Note: Query operations do not have request mapping. They only have response mapping.If filters in odata request or navigation properties in odata request or if soap request needs some input parameters they have to be handled by the custom scripts. If mapping cannot be done via mapping tool then they have to be handled in custom scripts.Now fire an OData Request https://localhost:8083/gateway/odata/SAP/Demo;v=11/ProductSet? on the browser and response will give the list of products.




Read Operation

  1. Create an OData Service Implementation Project
  2. Create an OData Model for getCustomers operation, which can have properties CustomerID

   


3. Right click on odatasvc and choose Select data source  


4. Select the entity set and choose the read CRUD operation. Select the data source SOAP Service.


    


5. Specify the wsdl file and choose the getProducts operation from the list of soap operations and click on finish


   

6. Right click on the read operation and select Define request mapping


 


7. Define request mapping as below


  

8. Right click on the read operation and select define Response mapping


  


9. Define the response mapping as below


   

10. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.Note: Read operations have both request mapping and response mapping. If filters in odata request or navigation properties in odata request or if soap request needs some input parameters they have to be handled by the custom scripts. If mapping cannot be done via mapping tool then they have to be handled in custom scripts.Now fire an OData Request https://localhost:8083/gateway/odata/SAP/Demo;v=11/CustomerSet(10) on the browser and response will give the customer with customerId 10.




Create Operation

  1. Create an OData Service Implementation Project
  2. Create an OData Model for createCustomer operation, which can have properties CustomerID, CustomerName and CustomerType

   


3. Right click on odatasvc and choose Select data source   


4. Select the entity set and choose the create CRUD operation. Select the data source SOAP Service.


   


5. Specify the wsdl file and choose the createCustomers operation from the list of soap operations and click on finish


  


6. Right click on the create operation and select Define request mapping


  


7. Define request mapping as below


 

8. Right click on the create operation and select define Response mapping


  


9. Define the response mapping as below


 

10. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.Now fire a POST OData Request


https://localhost:8083/gateway/odata/SAP/Demo;v=11/CustomerSet on the browser with a payload and response should be successful and should return the same payload as responseThe payload will be like<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://localhost:8083/gateway/odata/SAP/BWO_SFSF_03;v=1/">
<id>https://localhost:8083/gateway/odata/SAP/CREATEOPERATIONIMPL;v=1/CustomersSet</id>
<title type="text">CustomersSet</title>
<updated>2014-09-05T11:24:24.457+05:30</updated>
<author>
<name />
</author>
<link href="CustomersSet" rel="self" title="CustomersSet" />
<entry>
<id>https://localhost:8083/gateway/odata/SAP/CREATEOPERATIONIMPL;v=1/CustomersSet(100)</id>
<title type="text">CustomersSet</title>
<updated>2014-09-05T11:24:24.457+05:30</updated>
<category term="Demo.Customers" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link href="CustomersSet(100)" rel="edit" title="Customers" />
<content type="application/xml">
<m:properties>
<d:CustomersId>100</d:CustomersId>
<d:CustomerName>Bob</d:CustomerName>
<d:CustomerType>Internal</d:CustomerType>
</m:properties>
</content>
</entry>
</feed>


Update Operation

  1. Create an OData Service Implementation Project
  2. Create an OData Model for createCustomer operation, which can have properties CustomerID, CustomerName and CustomerType

   

3. Right click on odatasvc and choose Select data source   


4. Select the entity set and choose the update CRUD operation. Select the data source SOAP Service.


   


5. Specify the wsdl file and choose the createCustomers operation from the list of soap operations and click on finish


   


6. Right click on the update operation and select Define request mapping


   


7. Define request mapping as below


  

8. Right click on the update operation and select define Response mapping


  


9. Define the response mapping as below


   

10. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.Now fire a PUT OData Request


https://localhost:8083/gateway/odata/SAP/Demo;v=11/CustomerSet on the browser with a payload and response should be successful.The payload will look like<feed xmlns="http://www.w3.org/2005/Atom" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" xml:base="https://localhost:8083/gateway/odata/SAP/BWO_SFSF_03;v=1/">
<id>https://localhost:8083/gateway/odata/SAP/UPDATEOPERATIONIMPL;v=1/CustomersSet</id>
<title type="text">CustomersSet</title>
<updated>2014-09-05T11:24:24.457+05:30</updated>
<author>
<name />
</author>
<link href="CustomersSet" rel="self" title="CustomersSet" />
<entry>
<id>https://localhost:8083/gateway/odata/SAP/CREATEOPERATIONIMPL;v=1/CustomersSet(100)</id>
<title type="text">CustomersSet</title>
<updated>2014-09-05T11:24:24.457+05:30</updated>
<category term="Demo.Customers" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />
<link href="CustomersSet(100)" rel="edit" title="Customers" />
<content type="application/xml">
<m:properties>
<d:CustomersId>100</d:CustomersId>
<d:CustomerName>BobABC</d:CustomerName>
<d:CustomerType>Internal</d:CustomerType>
</m:properties>
</content>
</entry>
</feed>



Delete Operation

  1. Create an OData Service Implementation Project
  2. Create an OData Model for deleteCustomer operation, which can have properties CustomersID and CustomerType

   

3. Right click on odatasvc and choose Select data source   


4. Select the entity set and choose the delete CRUD operation. Select the data source SOAP Service.


   


5. Specify the wsdl file and choose the deleteCustomers operation from the list of soap operations and click on finish


   


6. Right click on the delete operation and select Define request mapping


   


7. Define request mapping as below


      

8. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.Now fire a Delete OData Request https://localhost:8083/gateway/odata/SAP/Demo;v=11/CustomerSet(100) on the browser and response should be successful with no payload returned.Note: There is no response mapping for a delete operation




Fault Mapping

  1. Create an OData Service Implementation Project
  2. Create an OData Model for AlphasetRead operation, which can have properties Key and Value

     

    3. Right click on odatasvc and choose Select data source

    4. Select the entity set and choose the ReadCRUD operation. Select the data source SOAP Service.

      

    5. Specify the wsdl file and choose the readAlphaset operation from the list of soap operations and click on finish

      

    6. Right click on the Read operation and select Define request mapping

    7. Define request mapping as below

      

       8. Right click on the Read operation and select Define response mapping

       9. Define response mapping as below

          

      10. Now Right click on the Read operation and select Define Fault mapping as This Service Provides Fault if Incorrect Details are passed to the Service, which can be mapped by the user to Display meaning full error Messages.

      11. Define Fault mapping as below, in this case Name is the Only Entity from the Web Service elements i.e. the Entities on the left hand side of the below image, As there are no corresponding Error Code and Message Text Returned from the Web Service, In Such cases A user can map them to Constant Values i.e. in This case Code is Mapped to 500 and Message Text to "No Such Record Exists" as Constant Values and the Name as Usual can be Mapped with the Name on Right Side.

           

      12. Right Click on Project and select Generate and Deploy Integration Content. This will deploy the bundle.

Now fire a Read OData Request with a Fault/Incorect value, user should see the Error Message with Error code,Name and Message Text as Output.

Other Related Links for SOAP with Custom Script

For detials on implementation of delta token scenario follow the link Handling Soap Delta token in Custom Script

For details on implementation of soap navigation scenario follow the link Soap Navigation

For details on implementation of using filters in query follow the link How to Handle Filters in Soap Operations

For details on implementation of SFSF scenario follow the link Operations needing session key to be be passed in odata request

For details on implementation of top, skip scenario follow the link Handling SOAP $top and $skip with Custom Script

For details on implementation of Inline Count follow the link  Handling SOAP Inline Count in Custom Processor

For details on implementation of MultiPart WSDL Handling follow the link Handling SOAP Mulitipart WSDL's in Custom Script

2 Comments