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.

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

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

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

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

Tick the Default Port checkbox and press create. Then with the Logical Port enter an appropriate name such as CURR_CONV_XMETHODS.Your ABAP proxy should now generate and you should be presented with the following screen. . Save and activate it! Step 3 .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. .asmx?WSDL).Setup Call parameters Within the 'Call Parameters' tab select URL and enter the url of the WSDL again ( 4 .

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. I am just going to set up the 'GET_SUPPORTED_CURRENCIES' operation but feel setup the others at any point. 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. 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 .<soap:operation soapAction="http://websevriceshare.Test your webservice ABAP proxy Make sure you save and activate the logical port and return to your ABAP proxy with SE80. 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 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. Step 8 .Step 7 . a list of all the currency codes supported by the webservice.

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

I use this code to call to the service : DATA: lv_port_name TYPE srt_lp_name. . Create logical port Via Lpconfig (in client). out TYPE z_ser_tst_per_r. I followed this procedure 1. 3. lv_text TYPE string. lt_return TYPE bapirettab. 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. I Create WS in BE1 (Server ) and i want to call it explicitly via Code from other backend BE2 (Client) . Create WS on the Target system (in the Server). in TYPE z_ser_tst_per. DATA: lref_client_proxy TYPE REF TO z_ser_test_perf.

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

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

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

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

One concerns is if i have to enter the WSDL there or the endpoint. 4.URL in the URL package and finish.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 . 3. 2009 11:00 PM in response to: mohammad afzal Hi Mohammad. 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 . 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. 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. 2. build the program like i wrote in the previous post . 3. I bring more detail for what i was doing to create the proxy and the logical port.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). 1.I create the WS via SE37 at the and I get some tabs one of them is WSDL .

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

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

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

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

then u r calling from sys2 so give the details of login of sys1 i.S. 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.e server 2) u can avoid the pop up of the same for this u have to do little settings .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. 1.e if u have created web service in sys1 and client proxy in sys2 . 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. 2009 12:49 PM in response to: Nina C hi . I also activate the service via SICF :/sap/bc/srt/wsdl/ 2. Best Regards Nina Edited by: Nina C on May 7. 2009 12:02 PM in response to: mohammad afzal HI mohammad. the error is coming also when i test the proxy. 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.

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

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

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

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

Prashant Posts: 373 Registered: 2/25/08 Forum Points: 412 Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Feb 6. 2009 1:29 PM to: Prashant Reply in response Hi Prashant . 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. 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). any idea why error?? Greetings Prashant . N.This will create the Proxy class and the methods based on the Entire WSDL that i use is downloadable from regards.sdn...... Then you call the proxy in the program. https://forums. 3) Go to LPCONFIG transaction and the create a default port for the proxy object.jspa?threadID=1182392&tstart=0 check with this link.1) Create a Proxy Object in SE80 using the WSDL path.Hope this solves your problem Regards Shiva Guest Re: Proxy Generation Error: SOAP:14 Unexpected element Posted: Feb 6.Neelima. i specified HTTP destination as my RFC_DEST_1 Path Prefix is empty.abysal..wsdl.. 2) Save and Activate the

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

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

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

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

Sign up to vote on this title
UsefulNot useful