Consume SOAP WebService by SAP and add custom Header


Added by Roland Jungnickel, last edited by Roland Jungnickel on Sep 13, 2011

Goal
We like to consume an external webservice by SAP. In other words: we should call the webservice using some
given values and get the result back. We need a username+password for the webservice.

Preparations



get the WSDL file from the webservice provider
get a set of values for calling the webservice from the webservice provider
download and install soapUI ( http://www.soapui.org/ ), we need this for testing! If you like to access a
webservice outside of your company, configure the proxy in soapUI.
get auth.+dev.key in SAP for SE80, LPCONFIG, SMICM

Pre-Dev Testing
We should make sure the webservice works as espected before we go into ABAP. Using soapUI,
1.
2.
3.
4.
5.

File > New soapUI Project
give a project name (free to choose) and provide the WSDL file. Create everything soapUI provides
(except the webTest-Case)
in "generate testsuite", select "one testcase for each operation" and select all soapActions we require
in "generate mock service" select also "starts the mock service immediately"
once created, in the project tree, look for the soapAction you like to test, below "Test Steps" doubbleclick on the soapAction. You should now get a new window containing two sides: the request and the response
window. In the request window, fill in all "?" with the set of values you got from the webservice provider. Click
run (at the top left) and look at the result in the right window. If it works, start in SAP...

Generate Enterprise Service Proxy






in SE80, select you Package
on the Package name, right-click and select Create > Enterprise Service
Select "Service Consumer", Continue
Select URL (or local file, but URL is best!), Continue
copy the URL into the URL field, continue
select Package, Prefix (ZWM, ZMM, ZSD... ?) and create a new Request/Task. Click Continue.
again, continue...
Now, the Proxy should generate. If there is no error, you should see the generated proxy class. Save it and
activate. Copy the generated class name.

error handling in proxy generation
If you recieve an error like ""Incorrect value: Unknown Type...":
1.
2.
3.

Execute TA SPROXSET.
Create a new parameter NO_RPC_STYLE with your username and set the value to 'X'
Try the proxy generation as mentioned above again.
The switch NO_RPC_STYLE might be used only if the WSDL is NOT RPC-style!
Background info: The error message you get is raised by the so called SIDL library. The sidl library is called to
check wether the WSDL is document-style or rfc-style. In case of rfc-style the SIDL library is also used to

handle rfc-style. Your WSDL might be document-style and can be processed without help of the SIDL library.
As workaround to avoid this error message we can disable usage of the SIDL library. To achive this we have to
cal TA SPROXSET and set the value X for for name NO_RPC_STYLE.

Create Local Port
In LPCONFIG,







give the Proxy Class Name we copied
Enter a reasonable Logical Port name
tick "Default Port" (otherwise you need to give the port name each time you instantiate the proxy class)
click "New"
provide a description
on tab "Call Parameters" tick and provide the Call URL. This is *NOT* the WSDL file! Most times, thats
the URL just without the "?WSDL" suffix. But take a look at the WSDL file itself, usually there is an
entry "address location="[http://|stage:../../../../../../../../../../]..", use this URL.
on tab "Operations", for each operations listed, we need to find out the soapAction URL and enter it
there. This information you can find in the WSDL file. Sometimes it's called "soapAction URL="[http://|
stage:../../../../../../../../../../]..". but in other cases there is just the reference to the main address in
the "soapAction" mentioned. In this case, use this address (NOT the WSDL file itself!).
save and activate
if requested, tick "State Management" in "Application-Specific Settings".

Test generate class and port
Back in SE80,






navigate to your generated enterprise service. (Select your package > Enterprise Service > Client
Proxies)
test the class
if you ticket "default port" in LPCONFIG, you do not need to provide the logical port name, tick
"Generate Template data" and "Extended XML Handling"
now you should see some generated XML, on the top, click edit.
enter your test values
run it
If you are lucky, you see the result... But if you are not able to enter all required data for the test (e.g.
username+password, a session-id etc.), you should get an empty result or an exception. In this case, it gets a
bit complicated as SAP is not able to handle header entries by itself. Read further down for the solution.

Test program
While proxy generation, not only the proxy is created - also the relevant datatypes. So you need to find out
which ones are used. In this example, I assume we have an importing structure (workarea) and one exporting
(internal) table. Also, there is at least one exception class generated. Please update this code example if you
find easier ways, also the exception handling is not yet really useful.
DATA: lr_proxy TYPE REF TO z<your_client_proxy_class>,
lr_ex_service TYPE REF TO z<your_exception_class>,
lr_ex_system type ref to cx_ai_system_fault,
lr_ex_application type ref to cx_ai_application_fault,
DATA: ls_req TYPE z<your_request_structure>
lt_ret TYPE z<your_return_table>,
ls_ret TYPE z<your_return_table_linetype>.

DATA: lv_ex1 TYPE string,
lv_ex2 TYPE string,
lv_ex3 TYPE string.
ls_req-var1 = 'foo'.
ls_req-var2 = 'bar'.
TRY.
CREATE OBJECT lr_proxy


EXPORTING
logical_port_name = '<your_lpconfig_port if not default'
.
CATCH cx_ai_system_fault into lr_ex_system.
ENDTRY.

make use of the abap pattern, it makes the life easy...
TRY.
lr_proxy-><your_ws_soapAction(
EXPORTING
<request> = ls_req
IMPORTING
<return> = lt_ret
).
CATCH cx_ai_system_fault into lr_ex_system.
CATCH z<your_exception_class> INTO lr_ex_service.
CATCH cx_ai_application_fault into lr_ex_application.
ENDTRY.


o
o
o
o
o
o
o
exceptions for debugging...

o
if lr_ex_system is not INITIAL.
lv_ex1 = lr_ex_system->if_message~get_text( ).
lv_ex2 = lr_ex_system->if_message~get_longtext( ).
*lv_ex3 = lr_ex->if_ai_application_fault~get_rt_fault_text( ).
endif.
if lr_ex_service is not INITIAL.

com/saphelp_nw70ehp1/helpdata/en/47/3d95b07e1a20cae10000000a155369/frameset. See whats sent/recieved You can see what is sent/recieved using SMICM. lv_ex2 = lr_ex_application->if_message~get_longtext( ). xml_element TYPE REF TO if_ixml_element. (remove the whole HTML header out of the trace before) Add custom header Sometimes you need to add a header to the SOAP message. All this we need to do before we call the soapAction. The POST / GET is shown in HEX and a in a small text area. endif. xml_document TYPE REF TO if_ixml_document. The class documentation from SAP: http://help. But we can not easily add a header. xml_node TYPE REF TO if_ixml_node. Example code: DATA: ixml TYPE REF TO if_ixml. we have to use FM SDIXML_XML_TO_DOM. endif.lv_ex1 = lr_ex_service->if_message~get_text( ). Then you could read the get/response easier.ht m Using the IF_WSPROTOCOL* we have also access to the WS_HEADER. do not forget to set the trace level back to 1. if lr_ex_application is not INITIAL. structure etc. run your test programm Goto > Trace File > Show all. If you are lucky . . That way. if the request fails. Use column mode to select the text. You can export the whole trace file and open it in a professional text editor (such like ultraedit or similar). xml-namespace and the xml-element as a dom element. To create this value out of a given xml-header. an api-key etc. lv_ex2 = lr_ex_service->if_message~get_longtext( ).) you should get the result in your lt_res table.. remove all line-breaks and replace "><" with ">_<" (_ represents line-break). This one does not take just a string. Goto > Trace File > Reset. lv_ex3 = lr_ex_application->if_ai_application_fault~get_rt_fault_text( )..      Goto > Trace Level > Set. SAP does not support them. we need to use method set_request_header of the interface-classif_wsprotocol_ws_header. a session-id.sap. a username and password. you could also copy the generated POST xml into soapUI and play around with the values. but requires you to provide the xml-name. copy it into a new file. BREAK-POINT. unfortunately. Enter value '3'. lv_ex3 = lr_ex_service->if_ai_application_fault~get_rt_fault_text( ). But there is a tricky way to add a custom header. e.g. lv_ex1 = lr_ex_application->if_message~get_text( ). Unlike in other programming frameworks where such values are added to the generated class constructors. ok. xml_root TYPE REF TO if_ixml_element.

com/">' '<n1:password xmlns:n1="http://webservices. namespace = xml_element->get_namespace_uri( ). is the FM is successful.provider.com">YOURusername</n1:username>' '</n0:UserToken>' '</soapenv:Header>' INTO l_string. lr_header_protocol->set_request_header( name = name namespace = namespace dom = xml_element ). add header element by element to soap header WHILE xml_element IS NOT INITIAL. Get some good coffee and music. ENDWHILE.provider..       convert to xstring l_xstring = cl_proxy_service=>cstring2xstring( l_string ).DATA l_xstring TYPE xstring.. play around until it works. look at the exceptions thrown while sending the soap request (we catch them at the end of the test programm) the returned exception texts usually do not tell you much. otherwise the header is not added. name = xml_element->get_name( ). This is maybe hard and time-consuming. reformat XML until it works. IF l_string IS NOT INITIAL. xml_element ?= xml_root->get_first_child( ). The main reason for errors from this FM is a malformed XML header you provided.com">YOURpassword</n1:password>' '<n1:username xmlns:n1="http://webservices. IF sy-subrc = 0 AND xml_document IS NOT INITIAL. create ixml dom document from xml xstring CALL FUNCTION 'SDIXML_XML_TO_DOM' EXPORTING xml = l_xstring IMPORTING document = xml_document EXCEPTIONS invalid_input = 1 OTHERS = 2. Use SMICM to look at the response. ENDIF. CONCATENATE '<soapenv:Header>' '<n0:UserToken xmlns:n0="http://services. notice. The common problems here are: SDIXML_XML_TO_DOM needs to be successful. xml_element ?= xml_element->get_next( ). that just a missing slash (/) in the XML can ruin your result. DATA: name TYPE string. . DATA l_string TYPE string. Test your header in soapUI before copy into the concatenate. xml_root = xml_document->get_root_element( ). If it still fails. ENDIF. namespace TYPE string.provider.

Step 1 . Below are the steps required for consuming a webservice WSDL with ABAP and SE80. as long as you have the url of its WSDL. give the reference on each data element. but the webservice does not accept your username+password (but should. It is using a webservice called Currency converter available on thexmethods.Create ABAP proxy You should now be presented with the first screen of the ABAP proxy generation wizard where you need to enter URL/HTTP Destination and press continue. Instead.com website. because in soapUI it does. preferably use short reference names (n0. if you send the header successfully. .Access ABAP proxy creation wizard via SE80 Execute transaction SE80 and within the the 'edit object' popup screen select Client proxy from the 'Enterprise Services' tab and press create.....) in the <soapenv:Header xmlns. other tricks:   make sure your reference names do not contain special chars.) the namespace names (xmlns:) might be different.>. watch out for slahes..) it looks not sufficient if you provide the reference information (xmlns:. but the concept can be applied to any webservice you find.. spaces and so on. n1.. Step 2 . Make sure lower/uppercase is correct.

com/currencyconverter/rates. enter the url of your webservice WSDL and press continue. . Now press Continue and on the next screen press Complete. this prefix helps ensure it does not encounter any duplication problems when it trims dowm names to fit in the field available. When the auto generation occurs SAP only has a finite number of of characters for the name of the proxy.webserviceshare.asmx?WSDL Now enter the package details or just click the local object checkbox and enter a prefix of 'ZES_'.Next you need to select URL. For this example the WSDL will be http://webservice.

Save and activate it! Step 3 . .Your ABAP proxy should now generate and you should be presented with the following screen. Tick the Default Port checkbox and press create. Then with the Logical Port enter an appropriate name such as CURR_CONV_XMETHODS.Create a logical port Execute transaction LPCONFIG and within Proxy class enter the proxy you just created ZES_CO_CURRENCY_CONVERTER_SOAP in SE80.

webserviceshare.Step 4 . .Setup Call parameters Within the 'Call Parameters' tab select URL and enter the url of the WSDL again (http://webservice.asmx?WSDL).com/currencyconverter/rates.

com/GetSupportedCurrencies". To do this select the GET_SUPPORTED_CURRENCIES operation and enter the SOAP Action as "http://websevriceshare.Setup Operations Right this is where it gets a little messy as now we need to add the reference from the actual WSDL code into each operation. We simply need to find this soapAction url and enter it into the operations tab for the appropriate operation.Step 5 . Basiaclly within the WSDL there is a section which details each operation and specifies a soapAction url. I am just going to set up the 'GET_SUPPORTED_CURRENCIES' operation but feel setup the others at any point. This was found in the following section of the WSDL: <wsdl:operation name="GetSupportedCurrencies"> .

<soap:operation soapAction="http://websevriceshare.com/GetSupportedCurrencies" style="document"/> Step 6 . Hit the test button and enter CURR_CONV_XMETHODS as your logical port name and GET_SUPPORTED_CURRENCIES as the method name (action).Test your webservice ABAP proxy Make sure you save and activate the logical port and return to your ABAP proxy with SE80. Now press execute! .

Step 7 .Enter input details The webservice results should now be displayed.Enter input details As this method/action of the webservice does not require an input values simply press the execute button again. . a list of all the currency codes supported by the webservice. Step 8 .

I am struck up with support issue. the URL should NOT end with "?WSDL".. it is going live next weekend.org/" (or similar.Operations tab do we need to provide SOAP Actions? (with out providing also will it work?) Please respond ASAP. Report Reply .Click here to Add transition layers to your VC application so that each form is on a separate page.. Buzz ItShare Login Follow the discussion Comments (4) Sort by: Date Rating Last Activity 0 Iwan· 6 days ago That is fantastic! I've followed all your steps. Otherwise you might get the error "Unexpected element -el=definitions ns =http://schemas. 1) Do we need to pass WSDL or URL in LPCONFIG (Do we can pass URL also?) 2) LPCONFIG . as this does not run the webservice it returns the WSDL which starts with definitions. and successfully implemented a call to a web service.xmlsoap. Thank you! Report Reply 0 Roland· 21 weeks ago In step 4..) Report Reply 0 Chandra· 52 weeks ago I have a question.

Create WS on the Target system (in the Server). lt_return TYPE bapirettab. lv_text TYPE string. DATA: lref_client_proxy TYPE REF TO z_ser_test_perf. Create logical port Via Lpconfig (in client). Generate proxy on the client (in the client). out TYPE z_ser_tst_per_r. 2009 9:13 PM Hi. I use this code to call to the service : DATA: lv_port_name TYPE srt_lp_name.0 schunder chitrapu· 86 weeks ago Very useful Report Reply Reply Call to WS from abap program Posted: May 5. in TYPE z_ser_tst_per. 3. 2. . I followed this procedure 1. I Create WS in BE1 (Server ) and i want to call it explicitly via Code from other backend BE2 (Client) .

* Get Default Logical Port for Proxy CONSTANTS: lc_proxy TYPE srt_lp_proxyclass VALUE 'ZHCO_SER_T_PER'. TRY. CATCH cx_ai_system_fault. . CALL METHOD cl_srt_lp_maintenance=>get_default_port_by_proxy EXPORTING proxyclass = lc_proxy RECEIVING lp_name = lv_port_name. in-user = 'AST'. CREATE OBJECT lref_client_proxy EXPORTING logical_port_name = lv_port_name. in-work_id = '00570538637'. ENDTRY.

i want u to ask wether u r trying the webservice for just . I also create logical port via Soamanager but the first and the second method don't find it (i saw the entry in table SRT_CFG_CLI_ASGN ) and when i call to the third method alone i get dump for null reference. ENDTRY.i get exception : SOAP:14 Unexpected element -el=definitions ns=http://schemas. catch CX_AI_SYSTEM_FAULT into lr_error.TRY. lv_message = lr_error->get_text( ). Best Regards Nina Edited by: Nina C on May 5.org/wsdl/ Does anyone have an idea how to avoid this exception? P. 2009 10:33 PM mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Reply Posted: May 6. In the method lref_client_proxy.xmlsoap. 2009 6:40 AM in response to: Nina C hi nina. me again . CATCH cx_ai_application_fault.S. CALL METHOD lref_client_proxy>z_tst_performance EXPORTING input = in IMPORTING output = out.

Thanks Again :) This for work not for test.org/wsdl/ . The problem happen when i create LP VIA LPCONFIG and use the code i post .testing purpose or u need really for any of u work. if u want to check the webservice funtionality u can do from the same server also i mean create client proxy in the server in which u have created the server and try to call it i hope it will run successfully . the program u have used to call is also correct and no need to give the logical port name as it will be picked from runtime.when i create it via soamanager i can't use the first and the second method because they query other tables SRT_LT and not . i too did the same and it was successful when i tried to call from the same server if u have java stack u can test ur webservice throuhg webservice client if any queries u can aks afzal Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 6. as u said in ur queries the problem ur facing it is coincidence i too faced them . ur web service is working fien the proof is that it is prompting for user id and password of server . this is due to the problem from the client server some soap runime configuration problem which u have to take help from basis as we should have admin rights. i too tried the same callign webservice from another r/3 and faced all these problems u r creating the logical port from soamanager and the method the other guy mentioned is correct and when u try to run it u get an excepetion SOAP:14 Unexpected element -el=definitions ns=http://schemas. So you think that i need to connect to the basis guy ? if so what i need tell him exactly i'm not familiar with this part.xmlsoap. 2009 7:04 AM in response to: mohammad afzal Hi Mohammad.

as u said u want to use this webservice thats fine . it will ask for user login and then u get the webservice tesstign client and u have a test option if u click it it will ask for the parameters and if u enter and execute it will return the result . if it is fien then ur webservice is workign fine and cna be used the problem with r/3 is some soap runtime problem which we have to search for some note regards afzal Edited by: mohammad afzal on May 6. u can try this sap notes 1043195 this is for chekcing the SOAP runtime environment Reply . but do u want to use the web service from r/3 to r/3 or to call from external system to r/3. if u have java stack u can test the webservice wether workign or not for this the procedure is in ur server where u created the webservice go to transaction WSADMIN under node SOAP Application for RFC complaints FMs search for ur webservice and test it .net u can use the webservice . 2009 8:42 AM in response to: Nina C hi nina.SRT_CFG_CLI_ASGN so i don't try to to call it via code (when i try to call just the third method i get dump null reference ) because i don't find method that can do so. 2009 8:04 AM in response to: Nina C hi nina. 2009 8:40 AM mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Posted: May 6. There is other way to call it? Best Regards Nina mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Reply Posted: May 6. if u want to call r/3 to r/3 then u can use rfc instead of rfc. if u want to call from external system like java and .

build the program like i wrote in the previous post . One concerns is if i have to enter the WSDL there or the endpoint.i try to create it via soamanager and but i don't see the URL of it .1 there in the in run time tab choose the web service infrastructure after Goto call parameter tab and put the same URL that i put in the proxy class and activate (in the tab operation i don't see the operation just the service name). if i have to put the endpoint . and if the endpoint is not active how i can active it? Thanks !!!! You are great ! Best Regards Nina . Thanks a lot for your time!!! I think that maybe the problem is with the LP or the proxy classsince i create it for the first time.please try with ur basis guy and if solved please reply so that it wil be helpful afzal Edited by: mohammad afzal on May 6. 2. 2009 12:11 PM Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 6. 3.Go to transaction LPCONFIG and put the proxy class name that i build and some perfix name like test in the logical port and assign the defult port .URL in the URL package and finish. 3.I create the WS via SE37 at the and I get some tabs one of them is WSDL . 1. i take the URL from the WSDL tab and create a proxy class in the back-end ( client ) via SE80 -> proxy class -> service consumer I put the WSDL . 2009 11:00 PM in response to: mohammad afzal Hi Mohammad. 4. I bring more detail for what i was doing to create the proxy and the logical port.

40. Thanks. 2009 6:23 AM in response to: Nina C hi nina. 2009 11:50 PM in response to: Gabriel Pulido V HI Gabriel. Gabriel P.016 Re: Call to WS from abap program Reply Posted: May 6.0) abap itself cannot recognize some some wsdl elements.20. it explains depending on your ABAP version. Depending of you abap version (6.0 Best Regards Nina mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Reply Posted: May 7. 7. the procedure u have done is correct may be some mis matching i will tell u the steps to follow 1) create a RFC and from it create a webservice and activate it .Gabriel Pulido V Posts: 870 Registered: 10/9/09 Forum Points: 1. Hope this helps. I Use 7.Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 6. which wsdl tags are supported or not. Check note 944029. 2009 11:47 PM in response to: Nina C Hello Nina. 6.

search for ur client proxy and select it and under this proxy try to create the logical port . use the same URL which u haev used in creating the proxy. i too faced the problem and after trying a lot i got the break through yesterday . in that business administration tab u have web service administration link . 8) u can write the program for calling it . go to SOAMANAGER of ur client system . which method i need to use only . click on it and to search ur services wsdl . IF i don't use the first two methods. search with server proxy and when u select ur service and apply selection u get a screen below . the problem is with the wsdl file instead u try to do alternate way 3) Go to transaction soamanager .e server and save it 7) Now u can test ur client proxy from SE80 by giving the logical port . 2009 9:58 AM in response to: mohammad afzal Hi mohammad Thanks again. under overview tab u get three links for wsdl one is for port type oen is for binding one is for policy the correct file is the wsdl file for binding 4) select the link and ur wsdl file opens . so it might solve ur problem too cheers afzal Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 7. copy the url this is the wsdl file u have to use in creating the client proxy not any other wsdl file 5) in client system create the client proxy and use the url of this wsdl and activate it 6) instead of creating logical port in LPCONFIG . try this and if any problems revert back. do not use the logical port option while instantiating the proxy class it will be automatically picked form run time. and give the login details of the wsdl i.2) Do not pick the WSDL file from the tab u mentioned .

An object reference must point to an object (an instance of a class) before it can be used to access components. was not caught and therefore caused a runtime error. 2009 10:50 AM in response to: Nina C hi . in type ZSTRZSTAR. The reason for the exception is: You attempted to use a 'NULL' object reference (points to 'nothing') access a component (variable: "LREF_CLIENT_PROXY"). 2009 10:07 AM Edited by: Nina C on May 7. Can u explain how to do so please? Best Regards Nina Edited by: Nina C on May 7. 2009 10:11 AM mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Reply Posted: May 7. Either the reference was never set or it was set to 'NULL' using the CLEAR statement. lo_sys_exception TYPE REF TO cx_ai_system_fault. just use create object proxy name Data : l_proxy type ref to ZSTRCO_ZSTARWEB. The exception.the third ? the problem is when i use only the third method i get dump An exception occurred that is explained in detail below. out type ZSTRZSTAR_RESPONSE. which is assigned to class 'CX_SY_REF_IS_INITIAL'. . nina the null poitnexception is that u r referring to the logicl port while creatign the object dotn pass anything . Another thing 7) Now u can test ur client proxy from SE80 by giving the logical port .

it_controller type PRXCTRLTAB. give the logical port name and click the instance button. TRY. wa_controller type prxctrl. in-a = 8. CATCH cx_ai_system_fault into lo_sys_exception . CALL METHOD l_proxy->zstar EXPORTING input = in IMPORTING output = out . ENDTRY. i created it but never used just instantiate the object and pass the input an dout put paramters . give the values and come back and execute u will get the output hope it solves ur prob regards afzal Nina C Re: Call to Reply . in-b = 4. u can select the package in which u created the pproxy . . then ur method wil be shown execute it and u get ur input paramters just clikc them. then under enterprise services --> client proxy and ur proxy name just test from there u get a pop up of test service consumer and select the logical port from drop down and seelct the generate template data and execute it . i never used logical port . u will get a screen where the input values will be autmatically proposed and then u execute from there u wil get the output. create object l_proxy. write : out-c. 2) seond method is when in SE80 when u select the proxy u can see the prxy name in the prpoerties which will be Proxy Class (generated) . then test this class by using execute button u get a screen where u haev to instantiate the class . the logical port will be picked form run time and u can test the proxy from se80 1) just double click on th eproxy name in SE80 .

e if u have created web service in sys1 and client proxy in sys2 .e server 2) u can avoid the pop up of the same for this u have to do little settings .S. I also activate the service via SICF :/sap/bc/srt/wsdl/ 2. 1.Posts: 212 Registered: 3/22/09 Forum Points: 0 WS from abap program Posted: May 7. then u r calling from sys2 so give the details of login of sys1 i. Thanks Again You Are great !!! News!!! i get other exception :( Now i do like you tell and when i came to the method in debug mode i get pop-up for user and pass When i try to provide the user and pass for the backend that the service persist there (probably it's not it) after 2 attempts i get new exception : SOAP:1. nina u may get authorization problem u have to give the user id and password of the server where u created teh webservice i. Best Regards Nina Edited by: Nina C on May 7.007 SRT: Unsupported xstream found: ("HTTP Code 401 : Unauthorized") Which user and pass i need to provide? There is a way to avoid this pop-up ? P. the error is coming also when i test the proxy. 2009 12:49 PM in response to: Nina C hi . 2009 12:02 PM in response to: mohammad afzal HI mohammad. 2009 12:45 PM mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Reply Posted: May 7.

Thanks!!!. udner it u fidn the webservice name u have created double click on it and u have logon data tab under it maintain the logon detilas of the system u have created the webservice . Do u have any idea what to do now? Best Regards Nina mohammad afzal Posts: 750 Registered: 3/16/07 Forum Points: 982 Re: Call to WS from abap program Posted: May 7. so when ever u call thsi servcie the login detials are autmoatically picked path for the webservice default_host -->sap-->bc-->srt-->rfc-->sap-->webservice name created regards afzal Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 7. under it srt. 2009 2:08 PM in response to: Nina C Reply . under it bc. i give the user and pass of the backend i create the WS and i get the same issue . Do u have idea why? I add to the service in transcription sicf user and pass (in the server side of the server side ) and when i test the proxy from the client i get the same pop-up asking user and pass. under it sap . 2009 1:53 PM in response to: mohammad afzal Hi Muhammad . under it sap.a) go to transaction SICF in that enter hierarchy type as SERVICES b) you get tree of default_host . under it rfc .

and when i test the proxy i get the same popup for user and pass. r u able to call the service i mean is it working after u provide user id and password if u get the exception it is bcos of wrong user id and password . follow the same steps and try to test it will ask same user and password and try to test if ur able to do it then u can try to call from secodn system dotn use two ssytems use single systme for server and client if ur able to do it then doing with two systems will not be a big deal regards afzal HI Mohammad. if u want to avoid the user name and password pop up then we can do it that is not a big issue one more simple suggestion form me to you to test service is just create a simple rfc which simplly returns the string no import paramters create webservice in ur first system .hi nina. I close this treat and open new one for the user and pass problem. 2009 5:01 PM in response to: mohammad afzal HI mohammad. Thanks . There is a way to avoid it? Best Regards Nina Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 7. i try to avoid the user and pass from the service provider ->configuration ->Authentication -> none. Thanks again you are great!!! . and then create the client proxy in the same system instead of secodn system .

When i call the method SendEmailResponse from an ABAP Report i get the error SOAP:14 Unexpected element -el=SendEmailResponse ns= i guess there is ERROR in my Logical Port Connection.com/soap/soapmail. only setting i have done is with CALL PARAMETERS as Runtime .... WSDL is correct & webservice call works when using Java WebDynpro.org/wsdl/"> Abysal Systems Web Service demonstration example </documentation> <port binding="tns:SendEmailBinding" name="SendEmailPort"> <soap:address location="http://www.http://www..xmlsoap..Best Regards Nina Proxy Generation Error: SOAP:14 Unexpected element Reply Posted: Feb 5.abysal.com/soap/soapmail.... <service name="SendEmailService"> <documentation xmlns="http://schemas.wdtp"/> </port> </service> i dont understand whats going wrong.Web Service Infra URL . I have a local WSDL file . since i am using a Locally Downloaded WSDL file....wdtp The WSDL file read like. using a Local WSDL file... i create a Proxy object in ABAP. 2009 9:26 PM Hi Experts.abysal.. Any pointers would be help full Regards Prashant Marcelo Almeida Re: Proxy Generation Error: Reply ...

272 Re: Proxy Generation Error: SOAP:14 Unexpected element Reply Posted: Feb 6.Posts: 113 Registered: 1/15/08 Forum Points: 84 SOAP:14 Unexpected element Posted: Feb 6. input-airline_id = p_carrid.084 Registered: 7/13/06 Forum Points: 1. input-connection_id = p_connid. CATCH cx_ai_application_fault. TRY. CALL METHOD my_proxy->flight_get_detail EXPORTING input = input IMPORTING output = output. . ENTRY. CATCH cx_ai_system_fault. Shiva Kumar Tir. 2009 12:09 PM in response to: Prashant Try to create a connection in SM59 Type H.. See the example below ( the source code): TRY. CATCH cx_ai_system_fault. Posts: 1.. Check if you are following the below steps to consume the webservice in Proxy generation. After this you need to put the RFC in HTTP Destination. input-flight_date = p_fldate. CREATE OBJECT my_proxy EXPORTING logical_port_name = 'LP01'. ENDTRY. Regards. 2009 12:39 PM in response to: Prashant Hi.

.. i specified HTTP destination as my RFC_DEST_1 Path Prefix is empty.com/soap/AbysalEmail. 2009 1:29 PM to: Prashant Reply in response Hi Prashant .jspa?threadID=1182392&tstart=0 check with this link.Hope this solves your problem Regards Shiva Guest Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Feb 6.1) Create a Proxy Object in SE80 using the WSDL path.. Then you call the proxy in the program.wsdl. 2) Save and Activate the Proxy. N.com/thread.Neelima. 2009 2:04 PM response to: Marcelo Almeida Reply in Hi Marcelo Almeida .(You might not be having access then in debugging change the access and create a default port).abysal.. 3) Go to LPCONFIG transaction and the create a default port for the proxy object.This will create the Proxy class and the methods based on the WSDL.... https://forums. any idea why error?? Greetings Prashant .sdn. regards.sap. Prashant Posts: 373 Registered: 2/25/08 Forum Points: 412 Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Feb 6. Entire WSDL that i use is downloadable from http://www. i Created a RFC destination in SM59 of type H as RFC_DEST_1 & used your coding now the error i recoeve is SOAP:14 Unexpected element -el=root ns= while creating the Logical port.

CATCH cx_ai_application_fault . CALL METHOD my_proxy->send_email EXPORTING input = input IMPORTING output = output.Marcelo Almeida Posts: 113 Registered: 1/15/08 Forum Points: 84 Re: Proxy Generation Error: SOAP:14 Unexpected element Reply Posted: Feb 6. TRY. DATA: input TYPE zproxysend_email_input . Try to get the WSDl again and use this code below: DATA: my_proxy TYPE REF TO zproxyco_send_email_port_type . Prashant Re: Proxy Generation Error: SOAP:14 Unexpected element Reply . CREATE OBJECT my_proxy EXPORTING logical_port_name = 'MY_PROXY' . TRY. CATCH cx_ai_system_fault . ENDTRY. 2009 5:38 PM in response to: Marcelo Almeida If the connection is OK. 2009 5:30 PM in response to: Prashant Did you test the connection in SM59?? Is OK?? Marcelo Almeida Posts: 113 Registered: 1/15/08 Forum Points: 84 Re: Proxy Generation Error: SOAP:14 Unexpected element Reply Posted: Feb 6. CATCH cx_ai_system_fault . DATA: output TYPE zproxysend_email_response . ENDTRY.

lv_to_address type string. 2009 11:44 AM to: Marcelo Almeida Posts: 373 Registered: 2/25/08 Forum Points: 412 in response Sorry it still does not work :( i still get error SOAP:14 Unexpected element -el=root ns= data: sys_exception type ref to cx_ai_system_fault. data: lv_from type string. lv_ret_code type int4. lv_response type zsend_email_response. lv_input type zsend_email_input. lv_input-from_address = 'DUMMYMAILADDRESS HERE'. client_proxy type ref to zco_myesa. lv_from_address type string. lv_input-to_address = 'MAILADDRESS APPEARS HERE'. lv_input-to = 'Prashant'. . sys_exception2 type ref to cx_ai_application_fault. lv_input-subject = ' TEST'. lv_input-from = 'MYSAPTEST'.Posted: Feb 9. lv_msg type string. lv_to type string. lv_subject type string.

into sys_exception . lv_err = sys_exception->if_message~get_text( ). . try.lv_input-msg_body = ' Hi this is wonderfull to see it work'. write: / lv_err. call method client_proxy->send_email exporting input = lv_input importing output = lv_response catch cx_ai_system_fault . catch cx_ai_application_fault into sys_exception2 . create object client_proxy exporting logical_port_name = 'BASIC'. data lv_err type string. endtry. lv_err = sys_exception->if_message~get_text( ). write: / lv_err.

endif. 2009 1:33 PM in response to: Prashant Closed due to further posting requirement Reply . Prashant Posts: 373 Registered: 2/25/08 Forum Points: 412 Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Apr 17. else.if lv_response is initial. write: /'Not Executed'. write: /'Did Execute'.