cancel
Showing results for 
Search instead for 
Did you mean: 

call a webservice in abap from an old system (sap_basis 620)

matteo_montalto
Contributor
0 Kudos

Hi all experts, please forgive the noobyness, it's the first time I have to work on WS calls in abap and I'm absolutely a newbie on the argument...

Can anybody help me writing a simple abap report that calls a simple java webservice (without input parameters) ? I've read many posts on the argument but understood a few, also because what's available is often referred to modern system while the one I'm working on is quite old (the "caller" is an SRM machine (BBPCRM 400) while the WS resides on the "portal" machine).

So far, I tried to follow the steps described in [this article|https://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/1988%3Fpage%3Dlast] [original link is broken] [original link is broken] [original link is broken];. However, I can't get it to work... first of all, here's the sketch of the test code:

CLEAR wf_string .
wf_string = 'http://local_IP_of_the_system/SRM_Portal_XYZ_WS/Config1?style=document'.

CALL METHOD cl_http_client=>create_by_url
 EXPORTING
   url = wf_string
 IMPORTING
   client = http_client
 EXCEPTIONS
   argument_not_found = 1
   plugin_not_active = 2
   internal_error = 3
   OTHERS = 4.

CALL METHOD http_client->send
 EXCEPTIONS
   http_communication_failure = 1
   http_invalid_state = 2.

CALL METHOD http_client->receive
 EXCEPTIONS
   http_communication_failure = 1
   http_invalid_state = 2
   http_processing_failed = 3.
CLEAR result .
result = http_client->response->get_cdata( ).

REFRESH result_tab .
SPLIT result AT cl_abap_char_utilities=>cr_lf INTO TABLE result_tab .
LOOP AT result_tab INTO r_str.
 WRITE:/ r_str .
ENDLOOP.

Here are the doubts:

1 - using that url (http://local_IP_of_the_system/SRM_Portal_XYZ_WS/Config1?style=document) in a web browser prompts immediately an authentication popup in which I have to put userid and password. Everything goes fine. Executing the code above, the call to HTTP_CLIENT->RECEIVE prompts the same userid/password request... But using the SAME values we used on the web browser leads to a failed authentication (it asks for userid/pswd 3 times, then looking at the output I can see that authentication's failed).

Edited by: Matteo Montalto on May 26, 2009 11:44 AM

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi All,

I'm working on a 4.6 SAP release and here the class cl_http_client is not existing.

Do you know if there is a similar one that can be used to call HTTP services?

Thanks in advance and best regards,

Domenico.

matteo_montalto
Contributor
0 Kudos

Thx to ya all, solved using a (tricky) workaround

Former Member
0 Kudos

Hello Matteo,

Can you please explain, how you solved the problem?

Regards

Gladson

matteo_montalto
Contributor
0 Kudos

We simply found out that our task could be accomplished starting from a web application on the portal side. We simply created some function modules, RFC enabled, to accomplish tasks that have to be done on the SRM side. We then managed to reverse the original idea; a web application does an RFC call to the FM and imports the data structure which contains the result of the SRM elaboration.

We managed this for two tasks; the first uses a direct call (RFC) to the SRM's FM. A second task instead passes throu XI (the basic architecture remains the same: Web App -> RFC -> FM on SRM -> results -> analysis of the result and output managed in the WebApp).

matteo_montalto
Contributor
0 Kudos

2 - I tried to manage the authentication via abap code: before the call to RECEIVE, I simply inserted this few lines of code:

HTTP_CLIENT->PROPERTYTYPE_LOGON_POPUP = HTTP_CLIENT->CO_DISABLED.
CALL METHOD HTTP_CLIENT->AUTHENTICATE
    EXPORTING
      PROXY_AUTHENTICATION = ' ' 
      USERNAME             = 'username'
      PASSWORD             = 'password'.

where username and password are obviously the ones that leads to a positive authentication via web browser. Again, I get in output an error 401 Unauthorized due probably to a login procedure error.

Can anyone help me with this task? Thanks in advance

EDIT: sorry for the double post, I wasn't able to get a decent text output in a single message so I had to split the original message in two..

matteo_montalto
Contributor
0 Kudos

No hints for me ?

I was thinking if there's a way to understand if the failed authentication could be connected to the (missing) definition of a proxy. If this is the case, where can I learn how to create a proxy in order to communicate with the WS? Please note that I'm on an old system (620) and most of the docs I found is referred to 640...

Thanks in advance

Former Member
0 Kudos

Hi Matteo,

Sorry but the WAS 6.20 is now really obsolete and as it was not officially able to call web services, very few people have tried to use this way.

For my part I just published web services from was 6.20 (R/3 4.7) but never tried to call web services.

Neatweaver 7.0 is so much more able to deal with web services...

Regards,

Olivier

Former Member
0 Kudos

Hi Matteo,

I had faced a similar issue when I tried to consume a external web-service from SAP(4.7 with WAS 6.20). But, there was a difference that, there were no authentication required while accessing from a browser, as you have mentioned. So, my solution probably won't work in your case.

Anyways I thought, I should share it. I solved the issue by changing the HTTP proxy settings in transaction SICF(Goto-->Http Proxy). In my case actually I solved the issue by removing the Http proxy settings completely(direct connection). For you I think, you have to probably use the USERID/PASSWORD for the Http proxy.

I may be wrong, just check it out.

Regards

Barada