"Nothing is impossible" is what came to my mind when i finally found success with this scenario running into a "Chequered Flag".
After some posts in the XI forum and help from my fellow SDNers I accomplised what was ‘my’ first successful communication of the XI server to a free WebService hosted over the internet.
Link to the WebService : Click Here [Please note that we are using a free webservice that is hosted over the internet and not that which is deployed on the XI server]
You can download the WSDL of the Webservice Here
About the WebService :
The WebService has different operations as following;
We will be using the operation getDistance in our scenario.
A screenshot of the WSDL in XML Spy is shown below:
The operation getDistance has an input that takes in two parameters fromZip and toZip and returns getDistanceReturn ie it finds out the distance between two given ZipCodes.
The RFC :
A RFC is created at the R/3 side with the following parameters:
FROMZIP type CHAR10
TOZIP type CHAR10
DISTANCE type CHAR10
Integration Builder – Design :
We need to know the structure of the message that needs to go as a request to the Webservice and also how the Webservice responds back. This is relevent as we need to accomplish the mapping between the RFC.Request to SOAP.Request and SOAP.Response to RFC.Response.
Note : Usually when we import the WSDL as an External Definition, we get the relevant messages for the request and response structures along with it. See screenshot below.
At my first try i used the messages getDistanceRequest and getDistanceResponse in my mapping but later found out that it wasnt the message structure that the webservice expected.
To get the structure of the relevant request and response messages you can test the webservice with an editor like XML Spy. Refer this weblog(the testing section in it) for a better understanding of how to accomplish the same.
In our case you can download and open the WSDL file in XML Spy.
Once we create a new SOAP request (XML Spy -> SOAP menu -> Create New Request) and then select the operation name (getDistance in our case) we get the request SOAP structure and once the request is sent the resulting is the response structure.
Now that we have an idea of the request and response structures for the SOAP we can proceed to build the design.
1. Import the RFC from R/3 into the relevant software component version.
2. Create a Data type DT_getDistance as follows,
3. Create a Message type getDistance as follows replacing the namespace to http://webservices.imacination.com/distance/Distance.jws
4. For the response structure of the SOAP i created a XSD and imported it as a external definition.
<?xml version="1.0" encoding="ISO-8859-1"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified"><xs:element name="getDistanceResponse"><xs:annotation><xs:documentation>Comment describing your root element</xs:documentation></xs:annotation><xs:complexType><xs:sequence><xs:element name="getDistanceReturn" type="xs:double" /></xs:sequence></xs:complexType></xs:element></xs:schema>
5. A message interface (inbound synchronous) is then created.
6. Mapping are done, the first being the RFC request to the SOAP request (getDistance) and the second the SOAP response (getDistanceResponse the message in the ED) to the RFC response.
Mapping 1 :
Mapping 2 :
7. Interface mapping – Specify the source interface as the RFC and the target as the inbound synchronous interface created.
Save and Activate all the objects created.
This brings us to the end of the Design.