SOAP TO SOAP SCENARIO:
•Simple Object Access Protocol [SOAP]
•Webservice is a remote application which is available in the Web.
•PI communicates with Webservice by using SOAP adapter.
•PI can send data to Webservice and can receive data from it.
•When working with SOAP as sender, WSDL (WebService Definition Language) is generated in Integration Directory and given to the client which is used for sending the payload in the body of the SOAP envelope.
•When working with SOAP as receiver, we receive WSDL from client and import in Enterprise Service Repository as External Definitions, this external definition is used as a Message-type during development.
A SOAP message is an ordinary XML document containing the following elements.
•Envelope: ( Mandatory )
Defines the start and the end of the message.
•Header: ( Optional )
Contains any optional attributes of the message used in processing the message, either at an intermediary point or at the ultimate end point.
•Body: ( Mandatory )
Contains the XML data comprising the message being sent.
•Fault: ( Optional )
An optional Fault element that provides information about errors that occurred while processing the message.
In our scenario, we will be sending SOAP request to a webservice for computing currency value between two countries. The value is sent back as a SOAP response to the requester.
Steps in Enterprise Service Repository
1. Download the WSDL of the receiver Web service ‘CurrencyConverter’ from the internet and save it as a .wsdl file.
2. Import the WSDL as a External Definition in Enterprise Service Repository.
3. Create two Data-types-
a) DT_CURRENCYSOURCE for sending request to the webservice.
b) DT_CURRENCYTARGETfor receiving response from the webservice.
4. Create required Message types-
5. Create outbound synchronous Service Interfaces as under-
6. Create inbound synchronous Service Interfaces as under-
7. Create request message mapping as under-
8. Create response message mapping as under-
9. Create Operation Mapping with required Message Mapping in Request and Response tab as under-
Steps in Integration Directory-
1. Create a Business Component where we specify the outbound and inbound interfaces.
2. Create a folder where we could place all our configuration objects at one place for easy reference.
3. Create Configuration Scenario where we assign all the configuration objects-
4. Create sender communication channel for SOAP adapter with details as below-
Create receiver communication channel for SOAP adapter with details as below-
5. Create Receiver Determination as below:
7. Create Sender Agreement as below-
8. Create Receiver Agreement as below-
9. To generate WSDL for outbound interface follow the link as below in Integration Directory-
10. A wizard will be opened, click ‘Continue’
11. Here we specify the URL to which we send the SOAP request-
Generally the URL is of the form:
In our case we will send the SOAP message to the PI server, so we could click the ‘Propose URL’ button to get the URL automatically of the PI system.
12. Here we specify the interface which has to be exposed as webservice-
13. Here we specify the Sender Communication Component-
14. Next we get the overview of the wizard, click ‘Finish’
15. A WSDL gets generated, save it in your local system and click ‘Close’
Testing the scenario-
•We can use SOAP UI tool to test our interface.
•Create a new SOAP UI project as under by specifying the WSDL which you have saved in step-15