2009 Nov 04 9:51 AM
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 ).
2009 Nov 18 9:50 PM
2009 Nov 19 4:10 PM
Hi, Manisha,
Im aslo getting the same error "soapfaultcode:1".Can you please explain in detail how did resolve the issue.
Regards,
Brahmaji
2009 Dec 12 11:07 PM
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.
2025 Jan 21 8:58 PM
Hello, I have question , although I search , I could not find the answer maybe you know it ;
In concatinate part I need to add ,
http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
which is necessary to complete request,
But when I inspect inside the lr_header_protocol->set_request_header() , I saw that it is reserved in internal table mt_reserved_ns ,
mt_reserved_ns = value #( ( `http://schemas.xmlsoap.org/ws/2004/08/addressing` )
( `http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd` )
( `http://www.w3.org/2005/08/addressing` )
( `http://www.sap.com/webas/640/soap/features/messageId/` )
( `http://schemas.xmlsoap.org/ws/2005/02/rm` )
( `http://docs.oasis-open.org/ws-rx/wsrm/200702` )
( `http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512` )
( `http://schemas.xmlsoap.org/ws/2005/02/sc` )
( `http://www.sap.com/webas/630/soap/runtime/session/protocol` )
it means that if your uri is one the reserved list raise exception type cx_soap_core .
Do you know how can I solve it , or is there an alternative way to handle issue.
Thanks
2010 Oct 26 3:57 PM
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