Skip to Content
0

consuming .net SOAP webservice and cookie handling.

Jan 10 at 10:55 PM

59

avatar image
Former Member

Hi,

I was able to consume two webservices which were created in .net. I did it with use of enterprise services -> consumer class and so on. The proxy classes were generated from WSDL URI/FILE.

Services are working, it means that I can call methods and I receive responses.

First webservice is for logging in, and it returns session token.

Secon webservice is to make some operations and I can provide him a session token.

When I provide a session token to the secon webservice I'm receiving message from it that I'm not signed in or session has expired. That's strange as I'm doing this in one simple program line after line.

There is a webservice documentation for consuming from .net envirement and it's written there that beside of session token I need to create a cookieContainer and pass cookies toghether with the session token. Is it possible to do in ABAP?

.net code looks like this:

CookieContainer authCookieContainer = newCookieContainer();
string sessionToken;
ItgSrv svc = newItgSrv();
svc.CookieContainer = authCookieContainer;
eWSAuthData authdata = neweWSAuthData();
authdata.ClientVersion = "1.0.0";
authdata.Company = "COMPANY";
authdata.Login = "USER";
authdata.Password = "PASSWORD";
eWSAuthResult authresult = svc.SignIn(authdata);
if (authresult.IsLogged)
{
/* Successfull Login */
}
ItgSrvObjects svc_objects;
svc_objects = new ItgSrvObjects();
svc_objects.CookieContainer = authCookieContainer;

How can I obtain the cookies from first proxy_class/object and pass them to the secon one?

My test abap code looks like this:

DATA: lo_eleader_login TYPE REF TO zeleaderco_itg_srv_soap,
lo_eleader_object TYPE REF TO zeleaderco_itg_srv_objects_soa,
ls_test_input TYPE ZELEADERTEST_CONNECTION_SOAP_I,
ls_test_output TYPE ZELEADERTEST_CONNECTION_SOAP_O,
ls_login_input TYPE ZELEADERSIGN_IN_SOAP_IN,
ls_login_output TYPE ZELEADERSIGN_IN_SOAP_OUT,
ls_logout_input TYPE ZELEADERSIGN_OUT_SOAP_IN,
ls_logout_output TYPE ZELEADERSIGN_OUT_SOAP_OUT,
ls_objcode_input TYPE zeleaderget_object_person_by_1,
ls_objcode_output TYPE zeleaderget_object_person_by_c,
lt_controller TYPE prxctrltab, ls_controller_line LIKE LINE OF lt_controller.

CREATE OBJECT lo_eleader_login.
CREATE OBJECT lo_eleader_object.
lo_eleader_login->test_connection( EXPORTING input = ls_test_input IMPORTING output = ls_test_output ).
ls_login_input-auth_data-client_version = '1.0.4'.
ls_login_input-auth_data-company = '********'.
ls_login_input-auth_data-login = 'webservice'.
ls_login_input-auth_data-password = '****************'.
lo_eleader_login->sign_in( EXPORTING input = ls_login_input IMPORTING output = ls_login_output ).
ls_objcode_input-session_token = ls_login_output-sign_in_result-session_token. ls_objcode_input-code = '8001001000'.
lo_eleader_object->get_object_person_by_code( EXPORTING input = ls_objcode_input IMPORTING output = ls_objcode_output ).

lo_eleader_object->get_object_person_by_code gives my back this 'session expired / not signed in' message. I think that the session is killed instantly after calling first webservice but I have no more ideas how to solve it. I read a lot of topics but non of them is realy helpful.

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

0 Answers