‎2009 May 05 8:13 PM
Hi,
I Create WS in BE1 (Server ) and i want to call it explicitly via Code from other backend BE2 (Client) .
I followed this procedure
1. Create WS on the Target system (in the Server).
2. Generate proxy on the client (in the client).
3. Create logical port Via Lpconfig (in client).
I use this code to call to the service :
DATA: lv_port_name TYPE srt_lp_name,
lv_text TYPE string,
lt_return TYPE bapirettab.
DATA: lref_client_proxy TYPE REF TO z_ser_test_perf,
in TYPE z_ser_tst_per,
out TYPE z_ser_tst_per_r.
* Get Default Logical Port for Proxy
CONSTANTS: lc_proxy TYPE srt_lp_proxyclass VALUE 'ZHCO_SER_T_PER'.
in-user = 'AST'.
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.
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 Regards
Nina
Edited by: Nina C on May 5, 2009 10:33 PM
‎2009 May 06 5:40 AM
hi 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 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.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 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 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
‎2009 May 06 5:40 AM
hi 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 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.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 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 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
‎2009 May 06 6:04 AM
Hi 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 Regards
Nina
‎2009 May 06 7:04 AM
hi 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 webservice
go 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 client
and u have a test option if u click it it will ask for the parameters and if u enter and execute it will return the result , if it is fien then ur webservice is workign fine and cna be used
the problem with r/3 is some soap runtime problem which we have to search for some note
regards
afzal
Edited by: mohammad afzal on May 6, 2009 8:40 AM
‎2009 May 06 7:42 AM
hi nina,
u can try this sap notes 1043195
this is for chekcing the SOAP runtime environment
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
‎2009 May 06 10:00 PM
Hi 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 Regards
Nina
‎2009 May 07 5:23 AM
hi nina,
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
2) Do not pick the WSDL file from the tab u mentioned , 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 , 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 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 , 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 , 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 it
7) Now u can test ur client proxy from SE80 by giving the logical port .
😎 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 too
cheers
afzal
‎2009 May 07 8:58 AM
Hi 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 dump
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_REF_IS_INITIAL', was not
caught and
therefore 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 the
CLEAR statement.
Another thing
7) Now u can test ur client proxy from SE80 by giving the logical port .
Can u explain how to do so please?
Best Regards
Nina
Edited by: Nina C on May 7, 2009 10:07 AM
Edited by: Nina C on May 7, 2009 10:11 AM
‎2009 May 07 9:50 AM
hi , nina
the null poitnexception is that u r referring to the logicl port while creatign the object
dotn pass anything , just use
create 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->zstar
EXPORTING
input = in
IMPORTING
output = out
.
. CATCH cx_ai_system_fault into lo_sys_exception .
ENDTRY.
write : out-c.
i never used logical port , i created it but never used
just 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 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 , 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 output
hope it solves ur prob
regards
afzal
‎2009 May 07 11:02 AM
HI 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 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,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 Regards
Nina
Edited by: Nina C on May 7, 2009 12:45 PM
‎2009 May 07 11:49 AM
hi , nina u may get authorization problem
u 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 server
2) u can avoid the pop up of the same for this u have to do little settings
a) go to transaction SICF in that enter hierarchy type as SERVICES
b) 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
regards
afzal
‎2009 May 07 12:53 PM
Hi 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-up
asking user and pass.
Do u have any idea what to do now?
Best Regards
Nina
‎2009 May 07 1:08 PM
hi nina,
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 ,
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 , 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 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
‎2009 May 07 1:28 PM
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 Regards
Nina
‎2009 May 07 4:01 PM
HI mohammad,
I close this treat and open new one for the user and pass problem.
Thanks again you are great!!!
Best Regards
Nina
‎2009 May 06 10:47 PM
Hello 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.-
‎2009 May 06 10:50 PM