cancel
Showing results for 
Search instead for 
Did you mean: 

SAP calling thrid party WebService issue

Former Member
0 Kudos

Hi All,

I am seeing the below issue when I am trying to consume third party web service in sap. Tried different options and gone through lot of threads but I am still not able to get solution. I really need some input and help here to move little further.

1. I have created consumer proxy

2. Create logical port 'ABC' - the authentication method is http, userid/password, as part of the logical port creation I have proved the user/password details. Since I already provided in SOAMANAGER as part logical port configurations, I am not explicitly passing those credentials in my ABAP code as WS_HEADER protocol.

3. Program to execute the web service and provide input and expected to see success.

The below is the error I am facing.

Class Name: CL_SOAP_RUNTIME_CLIENT

SOAP Fault Exception caught: : Server was unable to
process request. ---> The type PageUp.WebService.PageUpPeople could not be
initialized. Unable to determine the correct instance ID for this service call!
---> Unable to determine the correct instance ID for this service
call!

The below is the code i am using:

DATA: client_proxy TYPE REF TO ZTEST_SOAP,
input TYPE ZGET_REVIEW_SOAP,
output TYPE ZGET_REVIEW_SOAP1,
oref TYPE REF TO cx_root,
text TYPE string.

DATA: ixml TYPE REF TO if_ixml,
xml_document TYPE REF TO if_ixml_document,
xml_root TYPE REF TO if_ixml_element,
xml_element TYPE REF TO if_ixml_element,
xml_node TYPE REF TO if_ixml_node.


DATA l_xstring TYPE xstring.
DATA l_string TYPE string.
DATA: lr_header_protocol TYPE REF TO if_wsprotocol_ws_header.
DATA: interface TYPE REF TO ZTEST_SOAP.
DATA: name TYPE string,
namespace TYPE string.

TRY.
    CREATE OBJECT client_proxy
      EXPORTING
        logical_port_name = 'ABC'.
  CATCH cx_ai_system_fault INTO oref.
    text = oref->get_text( ).
ENDTRY.
IF NOT text IS INITIAL.
  WRITE / text.
ENDIF.


*convert to xstring
l_xstring = cl_proxy_service=>cstring2xstring( l_string ).
IF l_string IS NOT INITIAL.
*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.
IF sy-subrc = 0 AND xml_document IS NOT INITIAL.
    xml_root = xml_document->get_root_element( ).
    xml_element ?= xml_root->get_first_child( ).
*add header element by element to soap header
     WHILE xml_element IS NOT INITIAL.
    name = xml_element->get_name( ).
    namespace = xml_element->get_namespace_uri( ).
    lr_header_protocol->set_request_header( name = name namespace = namespace dom = xml_element ).
    xml_element ?= xml_element->get_next( ).
  ENDWHILE.
ENDIF.
ENDIF.

*Fill request with to be retrieved
input-OFFER_STATUS = 'Made'.
input-filter-USER_EMAIL = 'test.ws@xxxxxxx.org'.
TRY.
CALL METHOD client_proxy->GET_REVIEW
    EXPORTING
      input  = input
    IMPORTING
      output = output.
   CATCH cx_ai_system_fault INTO oref.
    text = oref->get_text( ).
  CATCH cx_ai_application_fault INTO oref.
    text = oref->get_text( ).
  ENDTRY.

IF NOT text IS INITIAL.
  WRITE / text.
ELSE.
  WRITE 'Success'.
ENDIF.

Attached are the my logical port settings:

I just slightly modified the host names due to security reasons.

I highly appreciate your time in reviewing my question and helping me out here.

Thanks

Krish

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

update....

if I add the below code it is working fine but due to security reason , client doesn't want to maintain the user/password in ABAP code.

I maintained user/password in SOAMANGER while selecting the userid/password authentication radio box  field. Then if I comment out below code, where I am seeing this error:

****************************************

get WS_HEADER protocol

    lr_header_protocol ?= client_proxy->get_protocol( if_wsprotocol=>ws_header ).

CONCATENATE

'<Header>'
'<AuthHeader xmlns="http://webservices.reviewtest.com.au/Value/ValueTestsome/">'
'<sUserName>testuser</sUserName>'
'<sPassword>testpwdddd</sPassword>'
'</AuthHeader>'
'</Header>'
INTO l_string.

Error:

Class Name: CL_SOAP_RUNTIME_CLIENT

SOAP Fault Exception caught: : Server was unable to
process request. ---> The type PageUp.WebService.PageUpPeople could not be
initialized. Unable to determine the correct instance ID for this service call!
---> Unable to determine the correct instance ID for this service
call!

The question is, why Web service is not accepting the user/password from soamanger configuration , where as if I pass hard coded  from the ABAP code using WS_HEader protocol it works fine but we do not want to pass user/password from ABAP code .

is any one experienced this kind of behavior?

Thanks

Krishna

Former Member
0 Kudos

Still going through lots of threads but not getting much help.

Created high sap note but still nothing heard yet.

Thanks

Kriss

Former Member
0 Kudos

The question is, why this WebService works  when I pass the AuthHeader as part of the soap message. but we do not want to keep the usr/password in abap code.

If I comment out the below code , it throws an error.

********************************************

* get WS_HEADER protocol

    lr_header_protocol ?= client_proxy->get_protocol( if_wsprotocol=>ws_header ).
CONCATENATE
'<Header>'
'<AuthHeader xmlns="http://webservices.test.com.ie/values/ValueOneService/">'
'<sUserName>test</sUserName>'
'<sPassword>test</sPassword>'
'</AuthHeader>'
'</Header>'
INTO l_string.

Thanks

Krish