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