Accessing SOAP header information in a custom adaptor module

Hi Guys,
Could anyone point me in the direction of information on how to access the SOAP:Header element when writing a custom adaptor module for a http/ SOAP communication channel?
I'm trying to add some WS-Security stuff which isn't available in XI 3.0.
Many thanks,
John

The solution is as follows:
Mark as Do Not Use SOAPEnvelope in the communication channel.
It may be possible to use the SAP implementation of MessageFactory, SOAPEnvelope etc., I forced XI the Apache Axis implementation, a thread on which can be found here Link: [Accessing SOAP header information in a custom adaptor module;
The SOAP Envelope is created by
javax.xml.soap.MessageFactory mf= org.apache.axis.soap.MessageFactoryImpl.newInstance();
This doesn't work it creates a com.sap.engine.services.webservices.jaxm.soap.SOAPMessageImpl
org.apache.axis.message.SOAPEnvelope env = new org.apache.axis.message.SOAPEnvelope();
org.apache.axis.Message iSoapMessage = new org.apache.axis.Message(env);
SOAPMessage sm = iSoapMessage;
SOAPBody iBody = se.getBody();
if(iBody!=null)
     iBody.addDocument(iDoc);
     addDocument failed for some reason when called in XI returning
     Exception caught by adapter framework: Exception in method process.
     The code below is copied straight from the addDocument method, but it works.
     org.w3c.dom.Element iDocRoot= iDoc.getDocumentElement();
     org.apache.axis.message.SOAPBodyElement bodyElement = new org.apache.axis.message.SOAPBodyElement(iDocRoot);
     iBody.addChildElement(bodyElement);
In order to get a document representation of the Envelope you can use
Document iEnvelopeDoc = ((org.apache.axis.message.SOAPEnvelope)env).getAsDocument();
You are now in a position to add or adjust the SOAP Envelope as your require. It enabled me to add WS-Security information to a message.
It is normally possible to use javax.xml.transform.Transformer on the various classes SOAPEnvelope, SOAPBody etc. as they implement Node. However doing this in XI caused a crash.
The final document can be then be set in the xmlPayload before being sent out the door.
Hope this helps someone,
John

Similar Messages

  • Extension of Standard SOAP Header Information in SOAP Adapter

    We are currently trying to call an eBay Web Service via SAP XI and we are using the SOAP Adapter in XI to achieve this.
    The following Authentication Information is required in the SOAP Header for accessing the eBay Web Service:
    - Token
    - ApplicationID
    - DevelopmentID
    - CertificationID.
    Unfortunately, the standard SOAP Adapter supports only certain SOAP Header Information (like User Authentication or Certificate Authentication).
    Is it possible to extend the SOAP Header Information in the SOAP Adapter (or somewhere else in XI) beyond the standard configurations?
    Thanks for your support.
    Alexander Bange

    Hi Jin,
    thanks for your input and sorry for my late reply but I wanted to wait for feedback from SAP who actually confirmed your recommendation.
    I had a second thought about this and it came to my mind that I actually don't want to extend the SOAP Header elements but simply fill the mentioned authentication elements with values. This cannot be done in the message mapping as only the SOAP body elements (i.e. the payload) can be mapped.
    Do you know if and how I can fill the SOAP header elements with values in XI?
    I already tried to include this information as fixed values in the WSDL description and load it into XI. Then I looked into the WSDL description and an error message occured stating that XI could not parse the XML Document (Fatal Error: com.sap.engine.lib.xml.parser.ParserException:  = expected in attlist(:main:, row:18074, col:54)).
    If there is no solution for the latter, I will have to try nosoap solution. Still this would be a little awkward.
    Thanks again for your valuable support.
    Best Regards.
    Alex

  • Custom Adaptor Module on Soap Receiver

    Hi All,
    In PI 7.1.1 I have a soap receiver communication channel with a call to a simple custom adaptor module before and after the call to the XISoapAdaptorBean
    The call before works displaying the message in the call. It seems that the module is not being called for the response.
    This used to work in XI. What's changed?
    John

    Hi Stefan,
    To the best of my knowledge I've followed the API when switching the code. The module is extremely simple at the moment; it just logs that it's been called.
         public ModuleData process(ModuleContext moduleContext, ModuleData inputModuleData)
              throws ModuleException
         { // process
    //          get the XI message
              try
                   Message msg = (Message)inputModuleData.getPrincipalData();
                   MessageDirection iDirection=msg.getMessageDirection();
                   amk = new MessageKey(msg.getMessageId(), iDirection);
                   Audit.addAuditLogEntry(amk, AuditLogStatus.SUCCESS, "CreateKeyFields: Module called");
              catch (Exception e)
                   ModuleException me = new ModuleException(e);
                   throw me;
              return inputModuleData;
         } // process
    I'm missing com.sap.aii.af.cpa.svc_api.jar, is this likely to be the culprit? It still compiles, deploys and works for all the outbound modules I've worked on.
    Kind regards,
    John

  • Read SOAP Header Information

    Hello All,
    We want to read SOAP header from incoming message. We followed blog from William to use the option "Do not use SOAP Envelop". However, we are not sure if we need to modify Sender Interface to include Envelope / Header in the message structure itself.
    How to Read SOAP Header Information
    If we modify the message structure , it changes the WSDL as well and generating request message something like below :
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aif="urn://transport.nsw.gov.au/test/poc/aif">
       <soapenv:Header/>
       <soapenv:Body>
          <aif:Envelope>   <------- Added by Modifying the structure
             <Header>
                <FileType>?</FileType>
             </Header>
             <Body>
                <MessageHeader>
                   <!--Optional:-->
    How can we use  "Do not use SOAP Envelop" feature without modifying the WSDL structure?
    If we don't modify the message structure , it is failing to identify the receiver and also we would not be able to see the fields while doing graphical mapping.
    Thanks !!

    Hi,
    Did you check the namespaces in your receiver determination? In interface determination, this could be solved by creating another mapping. Which PI version are you using?
    Regards,
    Mark

  • SOAP header information [continued]

    Dear,
    It all started here Get SOAP header information
    The fact is that I get the WSDL delivered and I need to upload that into the ESR.
    Next step is to create/generate a Service Interface.
    What I see in the WSDL binding
    After I generated a Service Interface
    Where is my SOAP header part? It seems to be gone in the Service interface?
    I tried this for both SOAP 1.1 and 1.2. Both the same phenomenon.
    Any suggestions?
    Thanks a lot
    Kind regards, Dimitri

    Hello Dimitri,
    Have you got any solution of the issue ?
    I think William's blog answer's that :
    http://scn.sap.com/community/pi-and-soa-middleware/blog/2009/07/30/how-to-read-soap-header-information
    However, It suggests to modify XML structure for sender interface as well. By doing so , it gives other challenge as described below :
    If we modify the message structure , it changes the WSDL as well and generating request message something like below :
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:aif="urn://transport.nsw.gov.au/test/poc/aif">
      <soapenv:Header/>
      <soapenv:Body>
          <aif:Envelope>   <------- Added by Modifying the structure
             <Header>
                <FileType>?</FileType>
             </Header>
             <Body>
                <BusinessPartner>
                   <!--Optional:-->
    How can we use  "Do not use SOAP Envelop" feature without modifying the WSDL structure?
    If we don't modify the message structure , it is failing to identify the receiver and also we would not be able to see the fields while doing graphical mapping.
    Let me know if you got any other alternative.
    Thanks & Regards,
    Dijesh Tanna

  • Could not access SOAP header - sending sopa message using weblogic

    i am using saaj to send a SOAP message ,through weblogic, i am getting an error like below
    Could not access SOAP header
    what should i do for sending a soap message using weblogic

    You're going to have to provide many more details than that. If it's useful, you could go here and read all the documentation books covering web services.

  • How to access SOAP header without using SOAP message handler

    I have a requirement to retrieve SOAP header information within each web services operation. So I can't use SOAP message handler. Is there any way to do that? BTW, I am not using workshop.
    Thanks.

    Howeve how can I put data into soap header in UDF? DynamicConfiguration won't work for soap header, right?
    Which data do you want ot put into the Header section.
    ASMA or Dynamic Configuration is used to read/ put the details from/ into the header elements.....
    Refer: http://help.sap.com/saphelp_nw04/helpdata/en/43/0a7d1be4e622f3e10000000a1553f7/frameset.htm
    From the help section:
    This information is not located in the payload of the message, but in additional message header fields.
    Regards,
    Abhishek.

  • Access soap header

    Hey there,
    is there a way to read out the custom header elements of the invoking soap message in a process? E.g. a client creates a soap message, adds optional information to the header and sends it to the bpel server. In order to react on that information, the process needs to access these data.
    Thanks!

    Another example to look at for this is the Sabre HotelShopFlow (I’ll see if I can send you this sample - please email me). All the interesting work is done in the WSDL for the service. If the WSDL for the service defines a multi-part input message, where some parts are mapped to the SOAP header and some to the soap body, then you are in good shape and can set those parts in BPEL like any other input message data. From the enterprise.wsdl in salesforce demo:
    <operation name="describeSObject">
    <soap:operation soapAction=""/>
    <input>
    <soap:header use="literal" message="tns:Header" part="SessionHeader"/>
    <soap:body parts="parameters" use="literal"/>
    </input>
    And then from the BPEL code, the SessionHeader is set with:
    <copy>
    <from variable="loginResponse" part="parameters" query="/salesforce:loginResponse/salesforce:result/salesforce:sessionId">
    </from>
    <to variable="headerRequest" part="SessionHeader" query="/salesforce:SessionHeader/salesforce:sessionId"/>
    </copy>
    Note that if the WSDL does not define the header data as a messageType, then you will need to create your own local copy of the WSDL for the service and edit it to be what you want.
    (taken from one of the devloper responses to this question already available). Please let me know if you can move forward with this response.

  • Soap Sender Adapter Preserve And Access Soap Header

    Hi,
    I would like to preserve the Soap Header created by a client and access it in a mapping using the the Soap Sender Adapter (SP16). Does anybody know how to do this?
    Kind regards,
    Heiko

    Hello Udo,
    I have found a solution to this problem. It is possible to add header entries to the DynamicConfiguration which is available by an API:
    soapMsg.append("<SOAP-ENV:Header>");
    soapMsg.append("<SAP:DynamicConfiguration xmlns:SAP=\"http://sap.com/xi/XI/Message/30\" xmlns:SOAP=\"http://schemas.xmlsoap.org/soap/envelope/\" SOAP:mustUnderstand=\"1\">");
    soapMsg.append("<SAP:Record namespace=\"http://sap.com/xi/XI/System/SOAP\" name=\"SRmsUser\">test</SAP:Record>");      
    This code snip shows Java client code to add an element to the SOAP header which corresponds to the DynamicConfiguration. In XI it will be accessable using the respective API.
    Cheers,
    Heiko

  • XI APIs to access SOAP Header Tags

    Hi Forum,
    The way we use DynamicConfiguration class from com.sap.aii.mapping.api.* API, to access file names etc,
    is there classes available for accessing other tags in the SOAP Header, for example ReliableMessaging, PerformanceHeader, etc

    U can look into Adapter Specific attributes for soap adapter also. If you want to transfer header fields, set the relevant indicator for Variable Header in the SOAP communication channel. This is generic for header fields. Not sure about the particual fields
    Regards,
    Prateek

  • Access SOAP:Header section

    Hello,
    I need to call a WebService with some extensions in the SOAP:Header. I don't find a solution without a custom develop Adaptermodul which renders the whole SOAP request and uses the SOAP Adapter without the SOAP functions.
    What do you think ?
    Regards,
    Gerald

    Hi,
    We have the same problem with SP14.
    Looks like the soap adapter can't handle soap headers correctly.
    A workaround may be to use the http adapter instead and generate the xml envelope messages for request and parsing the response. We have tried this for document based soap and it works.
    Obbviously you would like to have the soap adapter fixed so it can support soap headers.
    Best regards otto

  • Accessing Soap header in webservices

    Hi,
    My webservice needs to read a soap header "locale" and do some processing based on this soap header.
    I understand the concept of handlers..but anywhere I see examples, the handler handles it and returns the data back.
    My requirement is that once this locale is retrieved, each of the webservice method should be able to read this locale, and do some processing based on that, as they need to return the localized data.
    I am not sure if I am missing something, but not yet able to find a direct way of doing it..
    Any response would be highly appreciated..
    Thanks

    user10455639 wrote:
    Yes I can..what I still dont understand from yourr email is why are you askign this..
    "if you can get the soap header"
    Because any header we should be able to retrieve from this context...Because I saw the following statement from [JavaDoc | http://e-docs.bea.com/wls/docs103/javadocs/weblogic/wsee/jws/JwsContext.html#getInputHeaders()].
    <<<<<<<<<<
    ....The SOAP headers used by WebLogic Workshop to manage conversations are included in the list of headers returned.
    <<<<<<<<<<
    If it works, then just use it :) because it is public supported
    Edited by: LJ on Apr 23, 2009 10:04 PM
    Edited by: LJ on Apr 23, 2009 10:21 PM

  • Get SOAP header information

    Dear,
    In our synchronous scenario SOAP <-> SAP PI <-> ABAP proxy, I face a problem reading the SOAP header from the incoming message.
    PI version used is 7.11
    This is how the incoming SOAP header looks like
    What I need is the content of field UserId.
    Already tried a lot and also ticked this option in the sender SOAP adapter: Do Not User SOAP Envelope.
    If I do that, I get an error saying premature end of file.
    Any lead is welcome.
    Thanks a lot!
    Dimitri

    Hi Dimitri,
    Have you tried to set a technical name in the ASMA attributes (Configuring the Sender SOAP Adapter (SAP Library - SAP NetWeaver Exchange Infrastructure) and later take this variable with the dynamic configuration during the mapping?
    I havent tried it, it's only an idea.
    Regards.

  • Create/access SOAP header

    Hello,
    How can I implement a web service in jdev that extracts some elements from the SOAP header ?
    How can I implement a web service proxy in jdev so that it inserts elements in SOAP header?
    Thank you.
    The operation WSDL looks approx like this:
              <operation name="SoapDDXML">
                   <soap:operation soapAction="someaction"/>
                   <input>
                        <soap:body
                             use="encoded"
                             namespace="ns"
                             encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                             parts="psXML"/>
                   </input>
                   <output>
    <soap:Header>
    <OurCredentials xmlns="ns">
    <UserName>string</UserName>
    <Password>string</Password>
    </OurCredentials>
    </soap:Header>
                        <soap:body
                             use="encoded"
                             namespace="ns"
                             encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                             parts="Result"/>
                   </output>
              </operation>

    Also facing the same problem - has anyone found an answer?
    Thanks,

  • Soap Header information

    Hi All,
    We are doing a CRM->XI->webservice(SOAP) scenario. I need to put in 2 headers in the SOAP envelope. The 2 headers are like identfiers (eg: trading partner). Is it enough if I set this in the adapter configuration Variable Header Name? If so How do I set the values.?
    For example: If need to set tradingpartner = “Dell” in the header of the SOAP envelope, how can I go about setting this?
    Thanks,
    Teresa

    Hi,
    You will have to create the SOAP envelope manually in your mapping!
    1. In the receiver SOAP adapter , select the option ,  "<b>Do Not Use SOAP Envelope."</b> When you select this option, the SOAP adapter will not embed your XML message with the SOAP envelope. Instead, it will expect the output of the mapping to have the SOAP envelope.
    2. Now, use a Java or XSL mapping and create the entire SOAP message out of your mapping. JAVa and XSL mapping do not validate the target message against the XSD.
    Regards
    Bhavesh

Maybe you are looking for

  • Can i copy my settings from one mac to another?

    Hi Since I had a problem with my Mac's drive that suddenly failed (I am able to read ONLY), I replaced the internal HD with my emergency HD that I had backedup a few months before. I would like to know if there's a way to copy my settings from one ma

  • Read group membership for a user object and populate every group with matching user from another domain

    I have LON\JSmith in LON domain and DEL\JimSmith in DEL domain I would like to extract group memberships of LON\JSmith in LON domain and append matching by email (i.e. DEL\JimSmith) user object in every group in LON domain. for instance LON\JSmith an

  • Preview/Presenation mode

    What is the Best way to Create a DVD with Preview/Presenation mode with the presenation mode going to a black screen before the clip and after with the user haveing to hit enter to activate the clip and then back to the menu at the end.

  • How do I skew a vector onto another vector?

    I have a vector that I would like to skew in order to match the blue block as shown above. I did this using the Object > Transform > Transform Each function, however the result is less than ideal. Is there any way to accurately and easily map the vec

  • Quicktime Broadcaster H.264 Configuration

    Hey, Does anyone have any knowledge of how to configure H.264 settings in Quicktime Broadcaster? The specs on www.apple.com/quicktime/broadcaster/specs.html say it supports both H.264 Baseline profile and H.264 Main profile, but the software only giv