Web Services – Consumer Proxy

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:

  1. Create Service Consumer
  2. SOAMANAGER Configuration
  3. 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:

1

Step 2: Select Service Consumer -> Select Service Consumer -> Continue

2

Step 3: Select External WSDL/Schema -> Continue

3

Step 4: Select Local File -> Continue

4

Step 5: Press F4 -> Select your file -> Continue

Order of content element in WSDL should be maintained in following order:

  1. Types
  2. Message
  3. PortType
  4. Binding
  5. Service

If contents are not in correct order as mentioned above, we’ll get error at the time of uploading WSDL file.

5

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

6

Step 7: Click on Complete

7

Step 8: After completing the above steps, below screen will appear -> Save and Activate.

Highlighted ABAP Name is Generated Proxy Class: ZMCO_PORT_TYPE1.

8

Step 9: Navigate to Class ZMCO_PORT_TYPE1 -> Check the Parameter of ‘OPERATION’ method

9

Input Parameter will take Input from SAP and if it pass the data to TIBCO, we’ll get the result in Output Parameter.

10

Step 10: Navigate to Tab ‘External View’ à Fault à ZMCX_FAULT is the generated Exception Class

11

Navigate to ‘Objects’ tab to check the generated objects (Proxy Class, Exception Class & Structures)

12

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

13

Step 2: Search here by Object Name: ‘Generated Proxy Class Name: ZMCO_PORT_TYPE1’

14

Step 3: Click on the Internal Name: ZMCO_PORT_TYPE1 -> you’ll get below screen

15

Step 4: Click on Create -> WSDL Based Configuration

1

Step 5: Enter the Logical Port Name -> Check the CheckBox for Default Logical Port -> Next

2

Step 6: Select WSDL Base: Via File -> Browse the WSDL File -> Next

3

Step 7: Click on Next

4

Step 8: Click on Next

5

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.

7

Step 10: Click on Next

8

Step 11: Click on Next

9

Step 12: Finish

10

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.

TRY.
CREATE OBJECT gr_send
EXPORTING
logical_port_name = space.
CATCH cx_ai_system_fault

ENDTRY.

Step 2: Call the Method ‘OPERATION’ of Proxy Class: ZMCO_PORT_TYPE1

IF gr_send IS BOUND.
TRY.
CALL METHOD gr_send->operation
EXPORTING
input  = gw_input
IMPORTING
output = gw_output.

CATCH cx_ai_system_fault.

CATCH zmcx_fault .

ENDTRY.
ENDIF.

 

Troubleshooting

  1. File contents should be in correct order:

Types

Message

PortType

Binding

Service

  1. 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.

  2. 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).

11

  1. Web Service can be traced by using Web Service Utilities (TCode: SRT_UTIL)

1

Click on Trace -> Press Enter

2

Enter the details -> Save

3

Execute the Program which is calling Web Service -> In case of any issue, it can be traced by Clicking on ‘Error Log’ button.

4

In Payload Trace tab, sent and received data can be traced.

5

 

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:

https://abcdefgh.abc.com/SAPMMIntegration/SAPMMService.asmx

6

WSDL can be accessed by Clicking on Service description.

7

Save this File with Extension ‘.WSDL’.

8

9

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

10

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.

11

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.

12

If you are getting any error, then it can be traced by TCode: SMICM.

13

In Next Screen, scroll down and search for Your IP and Port. By checking the logs you will get the reason.

14

 

SOAMANAGER Configuration for HTTPS Request:

It will be same like HTTP request, we need to choose ‘HTTPS’ in protocol.

15

 

 

2 comments

  1. Hi,

    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 !!
    Kr, Tim

    Like

  2. 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 ?

    Like

Leave a Reply