Consume SOAP WebService by SAP and add custom Header

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

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.


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 ( ), 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,

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...":

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

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

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

make use of the abap pattern, it makes the life easy...
<request> = ls_req
<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.

exceptions for debugging...

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( ).
if lr_ex_service is not INITIAL.

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

The main reason for errors from this FM is a malformed XML header you provided. DATA l_string TYPE string. namespace = xml_element->get_namespace_uri( ). DATA: name TYPE string..       convert to xstring l_xstring = cl_proxy_service=>cstring2xstring( l_string ).">' '<n1:password xmlns:n1="http://webservices. IF l_string IS NOT INITIAL. ENDWHILE. ENDIF.provider. namespace TYPE string. play around until it works. CONCATENATE '<soapenv:Header>' '<n0:UserToken xmlns:n0="http://services. ENDIF. name = xml_element->get_name( ). add header element by element to soap header WHILE xml_element IS NOT INITIAL.. xml_element ?= xml_element->get_next( ).provider. If it still fails.DATA l_xstring TYPE xstring. . is the FM is successful. lr_header_protocol->set_request_header( name = name namespace = namespace dom = xml_element ). 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 =">YOURpassword</n1:password>' '<n1:username xmlns:n1="http://webservices. reformat XML until it works. Use SMICM to look at the response. Test your header in soapUI before copy into the concatenate. Get some good coffee and music. IF sy-subrc = 0 AND xml_document IS NOT INITIAL. xml_root = xml_document->get_root_element( ). 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. The common problems here are: SDIXML_XML_TO_DOM needs to be successful. xml_element ?= xml_root->get_first_child( ). that just a missing slash (/) in the XML can ruin your result. This is maybe hard and">YOURusername</n1:username>' '</n0:UserToken>' '</soapenv:Header>' INTO l_string.

.>.. spaces and so on.) the namespace names (xmlns:) might be different. Instead. because in soapUI it does. n1. Step 2 .. Step 1 .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. but the concept can be applied to any webservice you find. preferably use short reference names (n0.. if you send the header successfully. Below are the steps required for consuming a webservice WSDL with ABAP and SE80. other tricks:   make sure your reference names do not contain special chars. It is using a webservice called Currency converter available on thexmethods. give the reference on each data website. as long as you have the url of its WSDL.) it looks not sufficient if you provide the reference information (xmlns:.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. .) in the <soapenv:Header xmlns.. but the webservice does not accept your username+password (but should. Make sure lower/uppercase is correct.. watch out for slahes.

com/currencyconverter/rates. this prefix helps ensure it does not encounter any duplication problems when it trims dowm names to fit in the field available. For this example the WSDL will be http://webservice. enter the url of your webservice WSDL and press continue.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. . Now press Continue and on the next screen press Complete. When the auto generation occurs SAP only has a finite number of of characters for the name of the proxy.

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. Tick the Default Port checkbox and press create. . Save and activate it! Step 3 .Your ABAP proxy should now generate and you should be presented with the following screen.

Step 4 .Setup Call parameters Within the 'Call Parameters' tab select URL and enter the url of the WSDL again (http://webservice.

com/GetSupportedCurrencies".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. 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.Step 5 . We simply need to find this soapAction url and enter it into the operations tab for the appropriate operation. To do this select the GET_SUPPORTED_CURRENCIES operation and enter the SOAP Action as "http://websevriceshare. This was found in the following section of the WSDL: <wsdl:operation name="GetSupportedCurrencies"> .

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

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 7 . . Step 8 .Enter input details The webservice results should now be displayed.

1) Do we need to pass WSDL or URL in LPCONFIG (Do we can pass URL also?) 2) LPCONFIG .) Report Reply 0 Chandra· 52 weeks ago I have a question.Click here to Add transition layers to your VC application so that each form is on a separate page.. Otherwise you might get the error "Unexpected element -el=definitions ns =http://schemas.xmlsoap. and successfully implemented a call to a web service.. 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" (or similar.Operations tab do we need to provide SOAP Actions? (with out providing also will it work?) Please respond ASAP. it is going live next weekend. the URL should NOT end with "?WSDL". Thank you! Report Reply 0 Roland· 21 weeks ago In step 4. Report Reply . I am struck up with support issue. as this does not run the webservice it returns the WSDL which starts with definitions..

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

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

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. 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. Best Regards Nina Edited by: Nina C on May 5. me again . ENDTRY.i get exception : SOAP:14 Unexpected element -el=definitions ns=http://schemas. CALL METHOD lref_client_proxy>z_tst_performance EXPORTING input = in IMPORTING output = out.S. i want u to ask wether u r trying the webservice for just . catch CX_AI_SYSTEM_FAULT into lr_error. 2009 6:40 AM in response to: Nina C hi nina.xmlsoap. lv_message = lr_error->get_text( ).org/wsdl/ Does anyone have an idea how to avoid this exception? P. In the method lref_client_proxy. CATCH cx_ai_application_fault.TRY.

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. 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. 2009 7:04 AM in response to: mohammad afzal Hi Mohammad. The problem happen when i create LP VIA LPCONFIG and use the code i post . 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. as u said in ur queries the problem ur facing it is coincidence i too faced them . 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 . ur web service is working fien the proof is that it is prompting for user id and password of server . Thanks Again :) This for work not for . 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.xmlsoap.testing purpose or u need really for any of u work.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 . 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.

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. 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. as u said u want to use this webservice thats fine . 2009 8:04 AM in response to: Nina C hi nina. 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 want to call from external system like java and . if u want to call r/3 to r/3 then u can use rfc instead of rfc. u can try this sap notes 1043195 this is for chekcing the SOAP runtime environment Reply . 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 . 2009 8:42 AM in response to: Nina C hi nina. 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.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 u can use the webservice . 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 .

1.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.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). 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 .i try to create it via soamanager and but i don't see the URL of it . One concerns is if i have to enter the WSDL there or the endpoint. build the program like i wrote in the previous post . 2. 4. 3. and if the endpoint is not active how i can active it? Thanks !!!! You are great ! Best Regards Nina . 3. 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. 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. 2009 11:00 PM in response to: mohammad afzal Hi Mohammad. I bring more detail for what i was doing to create the proxy and the logical port.URL in the URL package and finish. if i have to put the endpoint .I create the WS via SE37 at the and I get some tabs one of them is WSDL .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 .

it explains depending on your ABAP version. Thanks. Check note 944029. 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 .Nina C Posts: 212 Registered: 3/22/09 Forum Points: 0 Re: Call to WS from abap program Reply Posted: May 6.20. 2009 11:50 PM in response to: Gabriel Pulido V HI Gabriel. which wsdl tags are supported or not. Hope this helps. 2009 6:23 AM in response to: Nina C hi nina.40. 6.0) abap itself cannot recognize some some wsdl elements.016 Re: Call to WS from abap program Reply Posted: May 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. I Use 7. Depending of you abap version (6. 7. Gabriel P. 2009 11:47 PM in response to: Nina C Hello Nina.Gabriel Pulido V Posts: 870 Registered: 10/9/09 Forum Points: 1.

and give the login details of the wsdl i.e server and save it 7) Now u can test ur client proxy from SE80 by giving the logical port . use the same URL which u haev used in creating the proxy. try this and if any problems revert back.2) Do not pick the WSDL file from the tab u mentioned . i too faced the problem and after trying a lot i got the break through yesterday . 2009 9:58 AM in response to: mohammad afzal Hi mohammad Thanks again. 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. search with server proxy and when u select ur service and apply selection u get a screen below . IF i don't use the first two methods. do not use the logical port option while instantiating the proxy class it will be automatically picked form run time. in that business administration tab u have web service administration link . which method i need to use only . the problem is with the wsdl file instead u try to do alternate way 3) Go to transaction soamanager . click on it and to search ur services wsdl . 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 . go to SOAMANAGER of ur client system . search for ur client proxy and select it and under this proxy try to create the logical port . 8) u can write the program for calling it . 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 .

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

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 . in-b = 4. i created it but never used just instantiate the object and pass the input an dout put paramters . then ur method wil be shown execute it and u get ur input paramters just clikc them. in-a = 8. 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 . CATCH cx_ai_system_fault into lo_sys_exception . CALL METHOD l_proxy->zstar EXPORTING input = in IMPORTING output = out . u will get a screen where the input values will be autmatically proposed and then u execute from there u wil get the output. then test this class by using execute button u get a screen where u haev to instantiate the class . create object l_proxy. ENDTRY.it_controller type PRXCTRLTAB. 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) . u can select the package in which u created the pproxy . wa_controller type prxctrl. 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 . give the logical port name and click the instance button. TRY. write : out-c.

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. 1.e server 2) u can avoid the pop up of the same for this u have to do little settings . I also activate the service via SICF :/sap/bc/srt/wsdl/ 2. nina u may get authorization problem u have to give the user id and password of the server where u created teh webservice i.Posts: 212 Registered: 3/22/09 Forum Points: 0 WS from abap program Posted: May 7.S.e if u have created web service in sys1 and client proxy in sys2 . 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. 2009 12:49 PM in response to: Nina C hi .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. Best Regards Nina Edited by: Nina C on May 7. the error is coming also when i test the proxy. then u r calling from sys2 so give the details of login of sys1 i. 2009 12:02 PM in response to: mohammad afzal HI mohammad.

under it sap . under it bc. under it srt. under it rfc . under it sap.a) go to transaction SICF in that enter hierarchy type as SERVICES b) you get tree of default_host . 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. 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. 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. 2009 2:08 PM in response to: Nina C Reply . 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 . 2009 1:53 PM in response to: mohammad afzal Hi Muhammad . i give the user and pass of the backend i create the WS and i get the same issue . Thanks!!!.

and then create the client proxy in the same system instead of secodn system . 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. and when i test the proxy i get the same popup for user and pass. 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 . Thanks again you are great!!! . 2009 5:01 PM in response to: mohammad afzal HI mohammad. Thanks . I close this treat and open new one for the user and pass problem.hi nina. i try to avoid the user and pass from the service provider ->configuration ->Authentication -> none. 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.

i create a Proxy object in ABAP..abysal.. since i am using a Locally Downloaded WSDL file..abysal.wdtp The WSDL file read like..... only setting i have done is with CALL PARAMETERS as Runtime .com/soap/soapmail.... <service name="SendEmailService"> <documentation xmlns=""> Abysal Systems Web Service demonstration example </documentation> <port binding="tns:SendEmailBinding" name="SendEmailPort"> <soap:address location="http://www. I have a local WSDL file . WSDL is correct & webservice call works when using Java"/> </port> </service> i dont understand whats going wrong.Web Service Infra URL .... 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.Best Regards Nina Proxy Generation Error: SOAP:14 Unexpected element Reply Posted: Feb 5.http://www.xmlsoap. using a Local WSDL file... 2009 9:26 PM Hi Experts. Any pointers would be help full Regards Prashant Marcelo Almeida Re: Proxy Generation Error: Reply ..

CATCH cx_ai_application_fault. CATCH cx_ai_system_fault. CALL METHOD my_proxy->flight_get_detail EXPORTING input = input IMPORTING output = output. 2009 12:09 PM in response to: Prashant Try to create a connection in SM59 Type H.Posts: 113 Registered: 1/15/08 Forum Points: 84 SOAP:14 Unexpected element Posted: Feb 6.. Shiva Kumar Tir. CREATE OBJECT my_proxy EXPORTING logical_port_name = 'LP01'. Regards.272 Re: Proxy Generation Error: SOAP:14 Unexpected element Reply Posted: Feb 6. ENDTRY. 2009 12:39 PM in response to: Prashant Hi. ENTRY.. Check if you are following the below steps to consume the webservice in Proxy generation. input-airline_id = p_carrid. input-flight_date = p_fldate. After this you need to put the RFC in HTTP Destination. See the example below ( the source code): TRY. Posts: 1. TRY.084 Registered: 7/13/06 Forum Points: 1. CATCH cx_ai_system_fault. . input-connection_id = p_connid. N. Prashant Posts: 373 Registered: 2/25/08 Forum Points: 412 Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Feb 3) Go to LPCONFIG transaction and the create a default port for the proxy object.wsdl.This will create the Proxy class and the methods based on the WSDL..Hope this solves your problem Regards Shiva Guest Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Feb 6.. any idea why error?? Greetings Prashant .com/thread. 2) Save and Activate the Proxy.sdn.abysal. i specified HTTP destination as my RFC_DEST_1 Path Prefix is empty.Neelima. 2009 2:04 PM response to: Marcelo Almeida Reply in Hi Marcelo Almeida .. 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.. Then you call the proxy in the program. Entire WSDL that i use is downloadable from http://www. https://forums..1) Create a Proxy Object in SE80 using the WSDL path..(You might not be having access then in debugging change the access and create a default port). 2009 1:29 PM to: Prashant Reply in response Hi Prashant ..jspa?threadID=1182392&tstart=0 check with this link.

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

data: lv_from type string. lv_ret_code type int4. lv_to 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. lv_msg type string.Posted: Feb 9. client_proxy type ref to zco_myesa. lv_to_address type string. sys_exception2 type ref to cx_ai_application_fault. lv_subject type string. lv_input type zsend_email_input. lv_input-to_address = 'MAILADDRESS APPEARS HERE'. lv_input-from = 'MYSAPTEST'. lv_input-subject = ' TEST'. . lv_from_address type string. lv_input-to = 'Prashant'. lv_input-from_address = 'DUMMYMAILADDRESS HERE'. lv_response type zsend_email_response.

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

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