Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Consume a Web Service in ABAP

Former Member
0 Kudos

Hi,

We have a Web Service URL on PI. Run time of this Web Service in a Portal Server.

We need to access the Same URL from ECC using ABAP Programming?

Can any one tell me how we can call the same Web Service?

I need to pass few values to the web service using ABAP Code and I need to get back the result into some variables.

any code available for verify?

Thanks,

Sekhar.J

2 REPLIES 2

Former Member
0 Kudos

For this u need to create a Proxy object from WSDL of the webservice...

This will create a class... Then u can use it in program to pass & get vaues from tht web service...

Example code...



REPORT  z_client_sysdatentime.
DATA: io_clientproxy TYPE REF TO zclient_co_zgetdatentime .
TRY.
    CREATE OBJECT io_clientproxy.
  CATCH cx_ai_system_fault .
ENDTRY.
DATA: output TYPE zclient_zgetsysdate_response .
DATA: input TYPE zclient_zgetsysdate .
TRY.
    CALL METHOD io_clientproxy->zgetsysdate
      EXPORTING
        input  = input
      IMPORTING
        output = output.
  CATCH cx_ai_system_fault .
  CATCH cx_ai_application_fault .
ENDTRY.

WRITE: output-date,
       output-time.

U can refer to this link to get more info on this concept...

Link: [http://help.sap.com/saphelp_nw04/helpdata/en/b4/6aae409567942ae10000000a155106/frameset.htm]

Edited by: Bhargava TC on Jul 10, 2009 12:36 PM

nitesh_jain3
Active Participant
0 Kudos

Hi,

Steps involved in Consuming a Web Service in ABAP.

1. You will need to create a Service Consumer Proxy in the ECC system.

The procedure for this is available in the documentation link [http://help.sap.com/saphelp_erp60_sp/helpdata/en/46/9743916d1115ece10000000a114a6b/frameset.htm] in the section Consuming a Web Service.. The URL access path of the WSDL can be used to generate the Service Consumer Proxy in ABAP.

2. Using transaction SOAMANAGER create the Logical Port for the Consumer Proxy created in Step 1.

3. Code the Consumer Proxy call in the ABAP program. Check section Consuming a Web Service --> Programming with Client and Server Proxies --> Sending a Message in the link specified above.

The Video link [Consuming Services in ABAP |https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/media/uuid/20eb3174-41ab-2a10-a383-907faf60eed3] will provide good conceptual knowledge, steps involved and Logical port maintenance..

In case you face any problems, shoot your queries.

regards

Nitesh