Web Service allows to communicate programs running on different operating systems and written in different languages via internet standards XML and HTTP.
In this document, we’ll be creating ‘Service Consumer’ by consuming a WSDL file provided by TIBCO. To create a Web Service in SAP we need a WSDL file (an XML file provided by TIBCO). We will push some data to Tibco and in response we’ll get some data/messages. Development related to Web Service can be divided in three parts:
- Create Service Consumer
- SOAMANAGER Configuration
- Use of Proxy Class in Program
Create Consumer Proxy:
Step 1: GoTo TCode: SE80 -> Enter the Package Name -> Right Click on Package Name -> Create -> Enterprise Service -> You’ll get below screen:
Step 2: Select Service Consumer -> Select Service Consumer -> Continue
Step 3: Select External WSDL/Schema -> Continue
Step 4: Select Local File -> Continue
Step 5: Press F4 -> Select your file -> Continue
Order of content element in WSDL should be maintained in following order:
If contents are not in correct order as mentioned above, we’ll get error at the time of uploading WSDL file.
Step 6: Enter the Package name and TR (Transport Request). Enter Prefix starting with Y or Z as proxy classes will be created in Customer namespace -> Continue
Step 7: Click on Complete
Step 8: After completing the above steps, below screen will appear -> Save and Activate.
Highlighted ABAP Name is Generated Proxy Class: ZMCO_PORT_TYPE1.
Step 9: Navigate to Class ZMCO_PORT_TYPE1 -> Check the Parameter of ‘OPERATION’ method
Input Parameter will take Input from SAP and if it pass the data to TIBCO, we’ll get the result in Output Parameter.
Step 10: Navigate to Tab ‘External View’ à Fault à ZMCX_FAULT is the generated Exception Class
Navigate to ‘Objects’ tab to check the generated objects (Proxy Class, Exception Class & Structures)
Now we have completed Service Consumer Creation Part.
Now this Web Service should be configured in SOAMANAGER to publish it.
SOAMANAGER Configuration should be done in Test Client.
Step 1: GoTo TCode SOAMANAGER -> it’ll be open in Internet Explorer -> Below screen will appear -> Click on Web Service Configuration
Step 2: Search here by Object Name: ‘Generated Proxy Class Name: ZMCO_PORT_TYPE1’
Step 3: Click on the Internal Name: ZMCO_PORT_TYPE1 -> you’ll get below screen
Step 4: Click on Create -> WSDL Based Configuration
Step 5: Enter the Logical Port Name -> Check the CheckBox for Default Logical Port -> Next
Step 6: Select WSDL Base: Via File -> Browse the WSDL File -> Next
Step 7: Click on Next
Step 8: Click on Next
Step 9: Click on Next
Computer Name of Access URL and Port Number of Access URL will be provided by third party (TIBCO).
Computer Name of Access URL: e.g. 10.XYZ.AA.BB
Port Number of Access URL: 11111
To check this URL, we need to ask Basis if Telnet is happening to this IP and Port Number from our SAP server.
Step 10: Click on Next
Step 11: Click on Next
Step 12: Finish
Now SOAMANAGER Configuration is over.
Using Proxy Class in Program
Step 1: Create Object for the Generated Proxy Class: ZMCO_PORT_TYPE1.
DATA : gr_send TYPE REF TO zmco_port_type1.
CREATE OBJECT gr_send
logical_port_name = space.
Step 2: Call the Method ‘OPERATION’ of Proxy Class: ZMCO_PORT_TYPE1
IF gr_send IS BOUND.
CALL METHOD gr_send->operation
input = gw_input
output = gw_output.
CATCH zmcx_fault .
- File contents should be in correct order:
- If TIBCO is not getting hit from Web Service, then get the IP and PORT from SOAMANAGER and check with Basis if Telnet is happening.
SOAP Action name should be same in SOAMANAGER and TIBCO. If TIBCO is not getting hit then check SOAP Action in both the system (SAP & TIBCO).
- Web Service can be traced by using Web Service Utilities (TCode: SRT_UTIL)
Click on Trace -> Press Enter
Enter the details -> Save
Execute the Program which is calling Web Service -> In case of any issue, it can be traced by Clicking on ‘Error Log’ button.
In Payload Trace tab, sent and received data can be traced.
Consumer Proxy for HTTPS Requests
End point for WSDL can be HTTP or HTTPS. In case of HTTPS request, we need to follow some additional steps.
As mentioned earlier, for Service Consumer we will get WSDL file from 3rd party. If we get WSDL in file format then simply we can consume it in SE80 and create Proxy classes. If WSDL is URL based, then we need to check the URL and WSDL can be downloaded from that URL. Below is the sample URL:
WSDL can be accessed by Clicking on Service description.
Save this File with Extension ‘.WSDL’.
Once WSDL file is downloaded, then consume it to create Proxy Class.
For HTTPS Request, we also need to Install certificate provided by third party.
TCode: STRUST. This should be done by Basis Team
Now, check the connection between Source & Destination.
Connection can also be checked using URL. We will get Target Host and Port Number from 3rd party system. It will look like:
Target Host: abcdefgh.xyz.com
Port No: 443
Path prefix: /SAP/MMService.asmx
In SM59, by creating a RFC of type ‘G’ HTTP Connection to External Serv, connection can be checked.
Click on ‘connection Test’ to check the connection. If you get any error then connect to Basis Team and check if Telnet is happening between Source & Destination.
If you are getting any error, then it can be traced by TCode: SMICM.
In Next Screen, scroll down and search for Your IP and Port. By checking the logs you will get the reason.
SOAMANAGER Configuration for HTTPS Request:
It will be same like HTTP request, we need to choose ‘HTTPS’ in protocol.
Thank you for this well explained article. One question from my side: when the service is created and TIBCO decide to adapt the message structures with extra elements. Is there a way to re-import the WSDL or update the structures?
Thank you in advance !!
Can the hostname be in input parameter ??? I have the same web service to call on multiple devices… Can I use the same entry for this or do I need to create 1 per IP address that I have ?