Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SOAP Request for calling a non SAP Proxy Consumer including Authentication

Former Member
0 Kudos
452

Hello everyone,

I am trying to consume a Web Service from BMC Remedy (non-SAP System) in SAP Solution Manager. I have generated the required ABAP Proxy Class from the WSDL file, created a logical port along with the authentification details using SOAMANAGER and instantiated the proxy class in an ABAP Program along with the request parameters to call the service. I keep getting the error message:- SoapFaultCode: 1.

Hence; I tried calling the service using the external open Source Program: SOAPUI 3.0.1. Here I saw that the SOAP Request includes a SOAP Header, whether the authentification details are embedded. After I added these details in the Request in SOAPUI, I could test the service successfully.

Now, I went back to the SAP system and saw that the Proxy Runtime generated only the ABAP types for the SOAP Body but no parameters were created for the SOAP Header. I found in SDN that the interface for adding SOAP Header is 'if_wsprotocol_ws_header'. Unfortunately, I did not find any documentation for it. So I just tried similar to the coding example of Thomas Jung but now I get XML parsing errors.

Can someone give me a working coding example or tutorial to solve this SOAP Header Problem? I am not sure if I am calling the following method correctly?

    • CALL METHOD lo_ws_header->if_wsprotocol_ws_header~set_request_header( name = name namespace =

    • namespace dom = xml_element ).

I would be really thankful if someone out there can help me to solve this problem.

PS: Following is the SOAP Request from SOAP UI that I need to build in the SAP System:-

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:THD_Global_Interface_Ticket_V3">

<soapenv:Header>

<urn:AuthenticationInfo>

<urn:userName>?</urn:userName>

<urn:password>?</urn:password>

<!Optional:>

<urn:authentication>?</urn:authentication>

<!Optional:>

<urn:locale>?</urn:locale>

<!Optional:>

<urn:timeZone>?</urn:timeZone>

</urn:AuthenticationInfo>

</soapenv:Header>

<soapenv:Body>

<urn:OpCreate>

<urn:GI_WS_Action_LogDelta>?</urn:GI_WS_Action_LogDelta>

.....................

<urn:GI_TransferType>Create</urn:GI_TransferType>

<urn:GI_Direction>Incoming</urn:GI_Direction>

</urn:OpCreate>

</soapenv:Body>

</soapenv:Envelope>

Edited by: Manisha Rostewitz on Nov 18, 2009 10:48 PM

Problem solved with the correct implementation of CALL METHOD lo_ws_header->if_wsprotocol_ws_header~set_request_header( name = name namespace =

    • namespace dom = xml_element ).

4 REPLIES 4

Former Member
0 Kudos
90

Problem is solved!

0 Kudos
90

Hi, Manisha,

Im aslo getting the same error "soapfaultcode:1".Can you please explain in detail how did resolve the issue.

Regards,

Brahmaji

0 Kudos
90

Hi,

in my case the Authentication was embedded in the SOAP Header. Following code was supplied by SAP support, which helped to solve the problem.

Although the SOAPFaultCode = 1, can be any other problem with the soap communication. I will recommend to use the open source tool 'SOAPUI', which gives clearer error messages!

DATA:
  lr_header_protocol TYPE REF TO if_wsprotocol_ws_header,
  lr_xml_document    TYPE REF TO if_ixml_document,
  lr_xml_element     TYPE REF TO if_ixml_element,
  lv_xstring         TYPE xstring.

CONCATENATE '<soapenv:Header xmlns:urn="urn:THD_Global_Interface_Ticket_V3">'
'<urn:AuthenticationInfo>'
'<urn:userName>' username '</urn:userName>'
'<urn:password>' password '</urn:password>'
'</urn:AuthenticationInfo>'
'</soapenv:Header>'
INTO iv_xml.

lr_header_protocol ?= ir_header_protocol.
" CONVERT to iv_xml to xstring
cl_abap_conv_out_ce=>create( )->convert( EXPORTING data = iv_xml IMPORTING buffer = lv_xstring ).
" CREATE ixml dom document from XML xstring
CALL FUNCTION 'SDIXML_XML_TO_DOM'
  EXPORTING
    xml           = lv_xstring
  IMPORTING
    document      = lr_xml_document
  EXCEPTIONS
    invalid_input = 1
    OTHERS        = 2.

IF sy-subrc = 0 AND lr_xml_document IS NOT INITIAL.
  lr_xml_element ?= lr_xml_document->get_root_element( )->get_first_child( ).
  " ADD header element by element to soap header
  WHILE NOT lr_xml_element IS INITIAL.
    lr_header_protocol->set_request_header(
    name = lr_xml_element->get_name( )
     namespace = lr_xml_element->get_namespace_uri( )
    dom = lr_xml_element ).
    lr_xml_element ?= lr_xml_element->get_next( ).
  ENDWHILE.
ENDIF.

Former Member
0 Kudos
90

Hi Manisha,

I am just wondering where you stored the user ID and password and how you read it to pass it when you called the non SAP webservice.

Nilesh