cancel
Showing results for 
Search instead for 
Did you mean: 

consuming webservice in ABAP Webdynpro

former_member445109
Active Participant
0 Kudos

Hi All,

How to consume webservice in ABAP Webdynpro? pl share me some views or any docs on same.

Regards,

Srikanth

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member402443
Contributor
0 Kudos

Hi Srikanth,

Check this regarding the web service in WDA.

Ist Step : configure Logical Port

http://help.sap.com/saphelp_nw70/helpdata/EN/16/285d32996b25428dc2eedf2b0eadd8/frameset.htm

2nd Step : Generate Proxy Object

http://help.sap.com/saphelp_nw70/helpdata/EN/16/285d32996b25428dc2eedf2b0eadd8/frameset.htm

3rd Step : Instantiating the proxy object & calling the methods exposed by webservice

data: sys_exception type ref to cx_ai_system_fault,

sys_exception2 type ref to cx_ai_application_fault,

client_proxy type ref to zco_myesa, "MY PROXY CLASS

lv_ret_code type int4,

lv_input type zsend_email_input,

lv_response type zsend_email_response.

data: lv_from type string,

lv_from_address type string,

lv_to type string,

lv_to_address type string,

lv_subject type string,

lv_msg type string.

lv_input-from = 'MYSAPTEST'.

lv_input-from_address = '<someAddress>'.

lv_input-to = 'Prashant'.

lv_input-to_address = '<someAddress>'.

lv_input-subject = ' TEST'.

lv_input-msg_body = ' Hi this is wonderfull to see it work'.

try.

create object client_proxy

exporting

logical_port_name = 'BASIC'. " Basic is a TYPE G RFC Destination

call method client_proxy->send_email

exporting

input = lv_input

importing

output = lv_response .

catch cx_ai_system_fault into sys_exception .

data lv_err type string.

lv_err = sys_exception->if_message~get_text( ).

write: / lv_err.

catch cx_ai_application_fault into sys_exception2 .

lv_err = sys_exception->if_message~get_text( ).

write: / lv_err.

endtry.

if lv_response is initial.

write: /'Not Executed'.

else.

write: /'Did Execute'.

endif.

Regard

Manoj Kumar

former_member445109
Active Participant
0 Kudos

Hi Manoj,

Thank you for ur reply,

If possible could you please provide me the end to end process for the same.

Regards,

Srikanth

Former Member
0 Kudos

Hi Srikanth,

First create the proxy like following:

Before doing this you need to have WSDL file for your webservice. Or the URL.

Go to Se80, select repository browser, and from the drop down select Package option.

There create your package or you can use exsisting package. Then right click on it,, select create enter prise service. there select "service consumer". then select the file from local system or url etc.Once you give all these details proxy will be created based on the WSDL file which you have uploaded.

Then you have to create Logical Port.

Go to tcode" SOAManager" then go to business administration->webservice administration -> search by consumer proxy->select your proxy(apply selection button) -> go to configuration-> create logical port->Give some name for your service as well as port name( which you have to use in your program), then again upload your WSDL file. Finally port will be created.

Afterwards you can use the operations from wsdl file (generated Methods in SAP) in your ABAP program. You can see all the methods which are generated in your proxy. Go to your package, you can find your proxy under client proxies, in that you can find all the methods and parameters etc. which SAP generates based on WSDL file which you upload.

Hope it solves your problem.

With Regards,

Ravi.D

arjun_thakur
Active Contributor
0 Kudos

Hi Srikanth,

Refer these threads:

https://forums.sdn.sap.com/click.jspa?searchID=23537116&messageID=6693441

And also refer this blog: /people/thomas.jung3/blog/2004/11/17/bsp-a-developers-journal-part-xiv--consuming-webservices-with-abap

I hope it helps.

Regards

Arjun

Edited by: Arjun Thakur on Mar 16, 2009 10:32 AM