42
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. File > New soapUI Project 2. give a project name (free to choose) and provide the WSDL file. Create everything soapUI provides (except the webTest-Case) 3. in "generate testsuite", select "one testcase for each operation" and select all soapActions we require 4. in "generate mock service" select also "starts the mock service immediately" 5. once created, in the project tree, look for the soapAction you like to test, below "Test Steps" doubble-click 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...

Consume SOAP WebService Workaround

Embed Size (px)

DESCRIPTION

ddddd

Citation preview

Consume SOAP WebService by SAP and add custom Header Added byRoland Jungnickel, last edited byRoland Jungnickelon 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. File > New soapUI Project

2. give a project name (free to choose) and provide the WSDL file. Create everything soapUI provides (except the webTest-Case)

3. in "generate testsuite", select "one testcase for each operation" and select all soapActions we require

4. in "generate mock service" select also "starts the mock service immediately"

5. once created, in the project tree, look for the soapAction you like to test, below "Test Steps" doubble-click 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. Execute TA SPROXSET.

2. Create a new parameter NO_RPC_STYLE with your username and set the value to 'X'

3. 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,lr_ex_service TYPE REF TO z,lr_ex_system type ref to cx_ai_system_fault,lr_ex_application type ref to cx_ai_application_fault,

DATA: ls_req TYPE zlt_ret TYPE z,ls_ret TYPE z.

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 = 'get_default_port_by_proxy

EXPORTING

proxyclass = lc_proxy

RECEIVING

lp_name = lv_port_name.

TRY.

CREATE OBJECT lref_client_proxy

EXPORTING

logical_port_name = lv_port_name.

CATCH cx_ai_system_fault.

ENDTRY.

TRY.

CALL METHOD lref_client_proxy->z_tst_performance

EXPORTING

input = in

IMPORTING

output = out.

catch CX_AI_SYSTEM_FAULT into lr_error.

lv_message = lr_error->get_text( ).

CATCH cx_ai_application_fault.

ENDTRY.

In the method lref_client_proxy- i get exception :SOAP:14 Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/

Does anyone have an idea how to avoid this exception?

P.S.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 RegardsNina

Edited by: Nina C on May 5, 2009 10:33 PM

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 6:40 AM in response to:Nina C

Replyhi nina,me again , i want u to ask wether u r trying the webservice for just testing purpose or u need really for any of u work, as u said in ur queries the problem ur facing it is coincidence i too faced them ,i too tried the same callign webservice from another r/3 and faced all these problemsu r creating the logical port from soamanager and the method the other guy mentioned is correctand when u try to run it u get an excepetionSOAP:14 Unexpected element -el=definitions ns=http://schemas.xmlsoap.org/wsdl/ ,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,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, ur web service is working fien the proof is that it is prompting for user id and password of server ,if u want to check the webservice funtionality u can do from the same server alsoi 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 did the same and it was successful when i tried to call from the same serverif u have java stack u can test ur webservice throuhg webservice clientif any queries u can aksafzal

Nina C

Posts: 212Registered: 3/22/09Forum Points: 0

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 7:04 AM in response to:mohammad afzal

ReplyHi Mohammad,

Thanks Again :)

This for work not for test.

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.

The problem happen when i create LP VIA LPCONFIG and use the code i post ,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 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.

There is other way to call it?

Best RegardsNina

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 8:04 AM in response to:Nina C

Replyhi nina,as u said u want to use this webservice thats fine , 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 r/3 to r/3 then u can use rfc instead of rfc, if u want to call from external system like java and .net u can use the webservice ,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 webservicego to transaction WSADMIN under node SOAP Application for RFC complaints FMs search for ur webservice and test it , it will ask for user login and then u get the webservice tesstign clientand 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 usedthe problem with r/3 is some soap runtime problem which we have to search for some noteregardsafzal

Edited by: mohammad afzal on May 6, 2009 8:40 AM

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 8:42 AM in response to:Nina C

Replyhi nina,u can try this sap notes 1043195this is for chekcing the SOAP runtime environmentplease 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: 212Registered: 3/22/09Forum Points: 0Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 11:00 PM in response to:mohammad afzal

ReplyHi Mohammad,

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.I bring more detail for what i was doing to create the proxy and the logical port.1.I create the WS via SE37 at the and I get some tabs one of them is WSDL .2. 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 - URL in the URL package and finish.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 .3.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).4. build the program like i wrote in the previous post .

One concerns is if i have to enter the WSDL there or the endpoint.if i have to put the endpoint ,i try to create it via soamanager and but i don't see the URL of it .and if the endpoint is not active how i can active it?

Thanks !!!!You are great !

Best RegardsNina

Gabriel Pulido V

Posts: 870Registered: 10/9/09Forum Points: 1,016

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 11:47 PM in response to:Nina C

ReplyHello Nina,

Depending of you abap version (6.20, 6.40, 7.0) abap itself cannot recognize some some wsdl elements.

Check note 944029, it explains depending on your ABAP version, which wsdl tags are supported or not.

Hope this helps,

Gabriel P.-

Nina C

Posts: 212Registered: 3/22/09Forum Points: 0Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 6, 2009 11:50 PM in response to:Gabriel Pulido V

ReplyHI Gabriel,

Thanks,

I Use 7.0

Best RegardsNina

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 6:23 AM in response to:Nina C

Replyhi nina,the procedure u have done is correct may be some mis matching i will tell u the steps to follow1) create a RFC and from it create a webservice and activate it2) Do not pick the WSDL file from the tab u mentioned , the problem is with the wsdl fileinstead u try to do alternate way3) Go to transaction soamanager , in that business administration tab u have web service administration link , click on it and to search ur services wsdl , search with server proxy and when u select ur service and apply selection u get a screen below , under overview tab u get three links for wsdlone is for port typeoen is for bindingone is for policythe correct file is the wsdl file for binding4) select the link and ur wsdl file opens , copy the url this is the wsdl file u have to use in creating the client proxy not any other wsdl file5) in client system create the client proxy and use the url of this wsdl and activate it6) 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 , use the same URL which u haev used in creating the proxy, and give the login details of the wsdl i,e server and save it7) Now u can test ur client proxy from SE80 by giving the logical port .8) u can write the program for calling it , do not use the logical port option while instantiating the proxy class it will be automatically picked form run time.

try this and if any problems revert back,i too faced the problem and after trying a lot i got the break through yesterday , so it might solve ur problem toocheersafzal

Nina C

Posts: 212Registered: 3/22/09Forum Points: 0Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 9:58 AM in response to:mohammad afzal

ReplyHi mohammad

Thanks again,

IF i don't use the first two methods, which method i need to use only the third ?

the problem is when i use only the third method i get dumpAn exception occurred that is explained in detail below.The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was notcaught andtherefore caused a runtime error.The reason for the exception is:You attempted to use a 'NULL' object reference (points to 'nothing')access a component (variable: "LREF_CLIENT_PROXY").An object reference must point to an object (an instance of a class)before it can be used to access components.Either the reference was never set or it was set to 'NULL' using theCLEAR statement.

Another thing7) Now u can test ur client proxy from SE80 by giving the logical port .

Can u explain how to do so please?

Best RegardsNina

Edited by: Nina C on May 7, 2009 10:07 AM

Edited by: Nina C on May 7, 2009 10:11 AM

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 10:50 AM in response to:Nina C

Replyhi , ninathe null poitnexception is that u r referring to the logicl port while creatign the objectdotn pass anything , just usecreate object proxy name

Data : l_proxy type ref to ZSTRCO_ZSTARWEB,lo_sys_exception TYPE REF TO cx_ai_system_fault,out type ZSTRZSTAR_RESPONSE,in type ZSTRZSTAR,it_controller type PRXCTRLTAB,wa_controller type prxctrl.

create object l_proxy.in-a = 8.in-b = 4.

TRY.CALL METHOD l_proxy->zstarEXPORTINGinput = inIMPORTINGoutput = out.. CATCH cx_ai_system_fault into lo_sys_exception .

ENDTRY.

write : out-c.i never used logical port , i created it but never usedjust instantiate the object and pass the input an dout put paramters , 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 can select the package in which u created the pproxy , then under enterprise services --> client proxy and ur proxy namejust 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 , u will get a screen where the input values will be autmatically proposed and then u execute from there u wil get the output.

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 , give the logical port name and click the instance button, then ur method wil be shown execute it and u get ur input paramters just clikc them, give the values and come back and execute u will get the outputhope it solves ur probregardsafzal

Nina C

Posts: 212Registered: 3/22/09Forum Points: 0Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 12:02 PM in response to:mohammad afzal

ReplyHI mohammad,

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 passWhen 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,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.S.1. I also activate the service via SICF :/sap/bc/srt/wsdl/2. the error is coming also when i test the proxy.

Best RegardsNina

Edited by: Nina C on May 7, 2009 12:45 PM

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 12:49 PM in response to:Nina C

Replyhi , nina u may get authorization problemu have to give the user id and password of the server where u created teh webservice i,e if u have created web service in sys1 and client proxy in sys2 , then u r calling from sys2 so give the details of login of sys1 i,e server2) u can avoid the pop up of the same for this u have to do little settingsa) go to transaction SICF in that enter hierarchy type as SERVICESb) you get tree of default_host , under it sap , under it bc, under it srt, under it rfc , under it sap, 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 , 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

regardsafzal

Nina C

Posts: 212Registered: 3/22/09Forum Points: 0Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 1:53 PM in response to:mohammad afzal

ReplyHi Muhammad ,

Thanks!!!,

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-upasking user and pass.

Do u have any idea what to do now?

Best RegardsNina

mohammad afzal

Posts: 750Registered: 3/16/07Forum Points: 982

Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 2:08 PM in response to:Nina C

Replyhi nina,r u able to call the service i mean is it working after u provide user id and passwordif u get the exception it is bcos of wrong user id and password ,

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 paramterscreate webservice in ur first system , and then create the client proxy in the same system instead of secodn system , follow the same steps and try to test it will ask same user and password and try to testif 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 dealregardsafzal

HI Mohammad,

Thanks ,

i try to avoid the user and pass from the service provider ->configuration ->Authentication -> none.and when i test the proxy i get the same popup for user and pass.There is a way to avoid it?

Best RegardsNina

Nina C

Posts: 212Registered: 3/22/09Forum Points: 0Top of Form

Bottom of Form

Re: Call to WS from abap programPosted: May 7, 2009 5:01 PM in response to:mohammad afzal

ReplyHI mohammad,

I close this treat and open new one for the user and pass problem.Thanks again you are great!!!

Best RegardsNina

Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 5, 2009 9:26 PM

Reply

Hi Experts,I have a local WSDL file , i create a Proxy object in ABAP, using a Local WSDL file. When i call the method SendEmailResponse from an ABAP Report i get the errorSOAP:14 Unexpected element -el=SendEmailResponse ns=

i guess there is ERROR in my Logical Port Connection, since i am using a Locally Downloaded WSDL file... only setting i have done is with CALL PARAMETERS asRuntime - Web Service InfraURL -http://www.abysal.com/soap/soapmail.wdtpThe WSDL file read like...............

Abysal Systems Web Service demonstration example

i dont understand whats going wrong. WSDL is correct & webservice call works when using Java WebDynpro. Any pointers would be help full

RegardsPrashant

Marcelo Almeida

Posts: 113Registered: 1/15/08Forum Points: 84Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 6, 2009 12:09 PM in response to:Prashant

ReplyTry to create a connection in SM59 Type H. After this you need to put the RFC in HTTP Destination. See the example below ( the source code):

TRY.

CREATE OBJECT my_proxyEXPORTINGlogical_port_name = 'LP01'.CATCH cx_ai_system_fault.ENDTRY.

TRY.input-airline_id = p_carrid.input-connection_id = p_connid.input-flight_date = p_fldate.

CALL METHOD my_proxy->flight_get_detailEXPORTINGinput = inputIMPORTINGoutput = output.CATCH cx_ai_system_fault.CATCH cx_ai_application_fault.ENTRY.

Regards,

Shiva Kumar Tir...

Posts: 1,084Registered: 7/13/06Forum Points: 1,272

Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 6, 2009 12:39 PM in response to:Prashant

ReplyHi,Check if you are following the below steps to consume the webservice in Proxy generation.

1) Create a Proxy Object in SE80 using the WSDL path...This will create the Proxy class and the methods based on the WSDL..2) Save and Activate the Proxy.3) Go to LPCONFIG transaction and the create a default port for the proxy object...(You might not be having access then in debugging change the access and create a default port)..

Then you call the proxy in the program..Hope this solves your problem

RegardsShiva

Guest

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 6, 2009 1:29 PM in response to:Prashant

ReplyHi Prashant ,

https://forums.sdn.sap.com/thread.jspa?threadID=1182392&tstart=0check with this link.

regards,N.Neelima.

Prashant

Posts: 373Registered: 2/25/08Forum Points: 412

Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 6, 2009 2:04 PM in response to:Marcelo Almeida

ReplyHi Marcelo Almeida ,i Created a RFC destination in SM59 of type H as RFC_DEST_1 & used your coding now the error i recoeve isSOAP:14 Unexpected element -el=root ns=while creating the Logical port, i specified HTTP destination as my RFC_DEST_1

Path Prefix is empty.

Entire WSDL that i use is downloadable fromhttp://www.abysal.com/soap/AbysalEmail.wsdl.

any idea why error??

GreetingsPrashant

Marcelo Almeida

Posts: 113Registered: 1/15/08Forum Points: 84Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 6, 2009 5:30 PM in response to:Prashant

ReplyDid you test the connection in SM59?? Is OK??

Marcelo Almeida

Posts: 113Registered: 1/15/08Forum Points: 84

Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 6, 2009 5:38 PM in response to:Marcelo Almeida

ReplyIf the connection is OK, Try to get the WSDl again and use this code below:

DATA: my_proxy TYPE REF TO zproxyco_send_email_port_type .TRY.CREATE OBJECT my_proxyEXPORTINGlogical_port_name = 'MY_PROXY'.CATCH cx_ai_system_fault .ENDTRY.DATA: output TYPE zproxysend_email_response .DATA: input TYPE zproxysend_email_input .TRY.CALL METHOD my_proxy->send_emailEXPORTINGinput = inputIMPORTINGoutput = output.CATCH cx_ai_system_fault .CATCH cx_ai_application_fault .ENDTRY.

Prashant

Posts: 373Registered: 2/25/08Forum Points: 412Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Feb 9, 2009 11:44 AM in response to:Marcelo Almeida

ReplySorry 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,

sys_exception2 type ref to cx_ai_application_fault,

client_proxy type ref to zco_myesa,

lv_ret_code type int4,

lv_input type zsend_email_input,

lv_response type zsend_email_response.

data: lv_from type string,

lv_from_address type string,

lv_to type string,

lv_to_address type string,

lv_subject type string,

lv_msg type string.

lv_input-from = 'MYSAPTEST'.

lv_input-from_address = 'DUMMYMAILADDRESS HERE'.

lv_input-to = 'Prashant'.

lv_input-to_address = 'MAILADDRESS APPEARS HERE'.

lv_input-subject = ' TEST'.

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

try.

create object client_proxy

exporting

logical_port_name = 'BASIC'.

call method client_proxy->send_email

exporting

input = lv_input

importing

output = lv_response .

catch cx_ai_system_fault into sys_exception .

data lv_err type string.

lv_err = sys_exception->if_message~get_text( ).

write: / lv_err.

catch cx_ai_application_fault into sys_exception2 .

lv_err = sys_exception->if_message~get_text( ).

write: / lv_err.

endtry.

if lv_response is initial.

write: /'Not Executed'.

else.

write: /'Did Execute'.

endif.

Prashant

Posts: 373Registered: 2/25/08Forum Points: 412

Top of Form

Bottom of Form

Re: Proxy Generation Error: SOAP:14 Unexpected elementPosted: Apr 17, 2009 1:33 PM in response to:Prashant

ReplyClosed due to further posting requirement