Http Header for SOAP message.

Hello,
I need to set some custom HTTP Header when i send the SOAP message to an endpoint.
I tried this..but doesn't solve my requirement.
SOAPMessage soapmsg = messageFactory.createMessage();
MimeHeaders mime = soapmsg.getMimeHeaders();
mime.addHeader("SOAPAction", "xxxx");
mime.addHeader("Sender", "yyy");
SOAPMessage reply = connection.call(soapmsg, destination);
Can anyone please guide me how to set HTTP headers for SOAP?
Thanks,

The following snippet is some code froma stand-alone web service client that I use for testing. It picks up an XML as the payload of the web service, wraps it in a SOAP message and fires it at the web service endpoint.
     System.out.println("Create the SOAP message.\n"); 
     MessageFactory messageFactory = MessageFactory.newInstance();
     SOAPMessage message = messageFactory.createMessage();
     System.out.println("Creating a DOM object from the JAXB payload.");
     DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          factory.setValidating(false);
             factory.setNamespaceAware(true);
     DocumentBuilder parser = factory.newDocumentBuilder();
     Document doc = parser.parse("file:payload.xml");
     //  Add the HTTP headers.
     message.getMimeHeaders().addHeader("User-Agent", "Mozilla/4.0 [en] (WinNT; I)");
     message.getMimeHeaders().addHeader("Host", "localhost:9080");
     message.getMimeHeaders().addHeader("Content-type", "text/xml");
     message.getMimeHeaders().addHeader("SOAPAction", "http://www.xxx.com.au/wsdl/someWebService");
     message.setProperty(SOAPMessage.CHARACTER_SET_ENCODING, "utf-8");
     SOAPEnvelope envelope = message.getSOAPPart().getEnvelope();
     envelope.addNamespaceDeclaration("n", "http://xxx/webService");
     envelope.addNamespaceDeclaration("xsd", "http://www.w3.org/2001/XMLSchema");
     envelope.addNamespaceDeclaration("xsi", "http://www.w3.org/2001/XMLSchema-instance");
     System.out.println("Adding the payload to the SOAP body.\n");
     SOAPBody body = message.getSOAPBody();
     SOAPBodyElement docElement = body.addDocument(doc);
     System.out.println("This is the SOAP message.\n");
     message.writeTo(System.out);
     System.out.println("\nPutting the payload on the wire.\n");
     SOAPConnectionFactory conFactry = SOAPConnectionFactory.newInstance();
     SOAPConnection connection = conFactry.createConnection();          
     URL endpoint = new URL("http://localhost:9080/xxx/services/yyy-webservices");
     SOAPMessage response = connection.call(message, endpoint);
     System.out.println("Payload sent. Closing the connection.\n");
     connection.close();

Similar Messages

  • HTTP Headers for SOAP

    Hello,
    I need to set some custom HTTP Header when i send the SOAP message to an endpoint.
    I tried this..but doesn't solve my requirement.
    SOAPMessage soapmsg = messageFactory.createMessage();
    MimeHeaders mime = soapmsg.getMimeHeaders();
    mime.addHeader("SOAPAction", "xxxx");
    mime.addHeader("Sender", "yyy");
    SOAPMessage reply = connection.call(soapmsg, destination);
    Can anyone please guide me how to set HTTP headers for SOAP?
    Thanks,

    Hello,
    I need to set some custom HTTP Header when i send the SOAP message to an endpoint.
    I tried this..but doesn't solve my requirement.
    SOAPMessage soapmsg = messageFactory.createMessage();
    MimeHeaders mime = soapmsg.getMimeHeaders();
    mime.addHeader("SOAPAction", "xxxx");
    mime.addHeader("Sender", "yyy");
    SOAPMessage reply = connection.call(soapmsg, destination);
    Can anyone please guide me how to set HTTP headers for SOAP?
    Thanks,

  • OWSM SAML Verify step problem: Missing Security Header in SOAP message

    I'm having a problem with SAML steps. From gateway log:
    2008-09-17 13:21:32,987 INFO [HTTPThreadGroup-58] saml.InsertSAMLSVStep - User attributes map set to generate the attribute assertions: null
    2008-09-17 13:21:33,034 INFO [HTTPThreadGroup-60] saml.SAMLProcessor - Assertion Major Version :1 , Minor Version :1
    2008-09-17 13:21:33,034 WARNING [HTTPThreadGroup-60] saml.SAMLProcessor - SAML Assertion verification error: An invalid token was provided
    2008-09-17 13:21:33,034 WARNING [HTTPThreadGroup-60] saml.VerifySAMLStep - SAML Token verification failed:
    2008-09-17 13:21:33,096 SEVERE [HTTPThreadGroup-58] wssecurity.OSDTWSSecurity - Missing Security Header in SOAP message
    2008-09-17 13:21:33,096 WARNING [HTTPThreadGroup-58] wssecurity.SecurityBaseStep - Failure while applying XML Security
    FAULT CODE: InvalidSecurity FAULT MESSAGE: Missing WS Security header in the SOAP message
    at com.cfluent.policysteps.security.wssecurity.OSDTWSSecurity.decryptVerify(OSDTWSSecurity.java:369)
    at com.cfluent.policysteps.security.wssecurity.DecryptStep.performXmlSecurity(DecryptStep.java:131)
    at com.cfluent.policysteps.security.wssecurity.SecurityBaseStep.execute(SecurityBaseStep.java:238)
    at com.cfluent.pipelineengine.container.DefaultPipeline.executeStep(DefaultPipeline.java:124)
    but the wsse:Security header with SAML assertion IS confirmed in the incoming message log. Anybody seen this issue?

    Below is the log of the incoming message just prior to the failing SAML Verify step:
    <?xml version="1.0" encoding="UTF-8" ?>
    - <env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns0="http://exception.common.periop.gehc.com" xmlns:ns1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:ns2="http://www.patient.patientmanager.periop.gehc.com/service/" xmlns:ns3="http://entity.common.periop.gehc.com" xmlns:ns4="http://entity.patient.patientmanager.periop.gehc.com" xmlns:ns5="http://entity.allergy.patientmanager.periop.gehc.com" xmlns:ns6="http://pdo.domain.customizer.periop.gehc.com" xmlns:ns7="http://entity.cases.scheduler.periop.gehc.com" xmlns:ns8="http://entity.insurance.patientmanager.periop.gehc.com">
    - <env:Header>
    - <ns1:Security>
    - <saml:Assertion MajorVersion="1" MinorVersion="1" AssertionID="158RBY2QvCFPiTqdXYWh9A22" IssueInstant="2008-09-17T19:58:43Z" Issuer="GE" xmlns="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:saml="urn:oasis:names:tc:SAML:1.0:assertion">
    <saml:Conditions NotBefore="2008-09-17T19:58:13Z" NotOnOrAfter="2008-09-17T19:59:43Z" />
    - <saml:AuthenticationStatement AuthenticationInstant="2008-09-17T19:58:43Z" AuthenticationMethod="urn:oasis:names:tc:SAML:1.0:am:password">
    - <saml:Subject>
    <saml:NameIdentifier NameQualifier="www.ge.com" Format="urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified">gowri</saml:NameIdentifier>
    - <saml:SubjectConfirmation>
    <saml:ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:sender-vouches</saml:ConfirmationMethod>
    </saml:SubjectConfirmation>
    </saml:Subject>
    </saml:AuthenticationStatement>
    </saml:Assertion>
    </ns1:Security>
    </env:Header>
    - <env:Body>
    - <ns2:getPatient>
    <ns2:patientId>137115</ns2:patientId>
    </ns2:getPatient>
    </env:Body>
    </env:Envelope>

  • Changing Subject: Header for bounced messages

    Our current version:
    imsimta version
    Sun Java(tm) System Messaging Server 7.0-3.01 64bit (built Dec 9 2008)
    libimta.so 7.0-3.01 64bit (built 09:24:13, Dec 9 2008)
    Using /opt/sun/comms/messaging64/config/imta.cnf
    SunOS mmp-nhm1.its.utas.edu.au 5.10 Generic_138889-06 i86pc i386 i86pc
    I am trying to alter the Subject: header for bounced messages, especially mail bounced from our gateway servers for "User unknown" errors. The current Subject: header for such bounces reads:
    Delivery Notification: Delivery has failed
    I would like this altered to be, say:
    Delivery Notification: Remote SMTP server has rejected address
    or something similar. Now, I've read the documentation on managing status notification messages, but there seems to be no correlation between the files in ..../config/locale/C and the text being placed in deliery failure messages. For instance, the return_failed.txt file contains the text:'
    Your message cannot be delivered to the following recipients:
    %R
    Yet I can't see this anywhere in the bounced message. Nor any other text from any of these files.
    There also seems to be a lack of information on header manipulation in these files.
    Thanks for any help,
    Dave.

    brett_ac wrote:
    There also seems to be a lack of information on header manipulation in these files.The manipulation of the notification messages is documented here:
    http://docs.sun.com/app/docs/doc/819-4428/bgakm?a=view
    Unfortunately the use of the Subject override "$T" flag isn't documented for the NOTIFICATION_LANGUAGE mapping table (although it is for the DISPOSITION_LANGUAGE mapping table -- http://docs.sun.com/app/docs/doc/819-4428/bgalb?a=view).
    To replace the header for the "Delivery Notification: Delivery has failed" bounce messages I added the following to the top of the NOTIFICATION_LANGUAGE mapping table in mappings.locale:
    NOTIFICATION_LANGUAGE
    ! Change the subject for "Delivery Notification: Delivery has failed" messages
      failed|*|en*|*|*  $T$IIMTA_TABLE:locale/C/|Delivery$ Notification:$ Remote$ SMTP$ server$ has$ rejected$ address
      failed|*||*|*     $T$IIMTA_TABLE:locale/C/|Delivery$ Notification:$ Remote$ SMTP$ server$ has$ rejected$ addressSee how that goes (make sure to run ./imsimta cnbuild;./imsimta restart before testing).
    Regards,
    Shane.

  • Why should I use Publish instead of Routing for SOAP messages over JMS?

    Hi,
    I currently read the book "The Definitive Guide to SOA - Oracle Service Bus" and found the following sentence in the chapter "Wrapping an Asynchronous Web Service with a Proxy Service" on page 131, which confuses me:
    When you send a SOAP message over a JMS queue, you need to use the Publish action, not the Routing action. <<Are there general restrictions, when to use Publish and when to use the Routing action in asynchronous communication? Is this special for SOAP messages over JMS?
    Thanks for your advices,
    Katja

    Here are a few reasons why. Enjoy!!
    A
    What Can Amazon Web Services Be Used For?
    Although Amazon Web Services is a cool technology, it also provides the very useful function of enabling business partners to interact with Web site through standard protocols. This interaction can lead to a deeper, more valuable relationship for parties involved. Here are a few of the ways that partners are benefiting from Web Services:
    Associates: Associates program enables Web sites to link to Amazon.com and earn referral fees for sales that they drive through their links. Many Associates are now using Web Services to build more effective links to our store, thus enhancing their sites and earning more money.
    Sellers and Vendors: Amazon.com has thousands of third-party sellers who offer their products on our Web site. Using Web Services, these sellers can more easily manage large quantities of inventory on our platform, and download the latest product information to make sure that their products are competitively priced.
    Developers: Among the thousands of developers who have signed up to our Web Services program, many are now creating solutions to help other people work with Amazon. These solutions are powered using our Web Services APIs.
    www.amazon.com/gp/aws/landing.html

  • Http Header for a SOAP message using SAAJ.

    Hello java community,
    I need to set the 'SOAPAction' field in the HTTP Header of a soap message. I am using SAAJ to build the message.
    Does anyone know how to do this?
    Help is greatly appreciated as always.

    You have to put a Handler in front of your WebService to intercept it.

  • WSSE header in SOAP message

    How do I get a WSSE UserToken header for my ourgoing SOAP message when using a Webservice reference in APEX 3.0?
    Message was edited by:
    user479463

    anybody?

  • Java API for SOAP Messages

    Hi
    I need Java library for dealing with SOAP messages (e.g., serializing, deserializing, etc.). I don't actually need a complete server, only a library.
    Is SAAJ, http://java.sun.com/webservices/saaj/index.jsp, the right choice? Or JAXM, http://java.sun.com/xml/downloads/jaxm.html?
    In particular the SAAJ page says "SAAJ 1.3 EA (with support for SOAP 1.2) is included in the open-source Java E 5-compliant application server at Project GlassFish. " Does this mean that it is obsolete, and that I should use GlassFish?
    I'm actually a little bit confused by all these technologies...
    thanks in advance

    If you are interested in a commercial solution send me an e-mail. The company I'm working for actually offers a conversion tool which can among other things handle xml and edifact
    regards
    Spieler

  • Attaching Header to SOAP Message

    Hi Guys,
    Can anybody tell me how to attach the Header to the message body in case of SOAP messages?
    My SOAP Message is as follows( in XML format):
    <?xml version="1.0" encoding="utf-8"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:p1="http://sup/bpmscenarios">
      <soap:Body>
        <p1:mt_source_SOAP>
          <row>
            <EmpNo>10</EmpNo>
          </row>
        </p1:mt_source_SOAP>
      </soap:Body>
    </soap:Envelope>
    And SOAP action is :
    http://sap.com/xi/WebService/soap1.1
    Regards,
    Supriya.

    Hi,
    My client is Altova XML Spy, is sending the message without header.
    So, at PI end message is getting failed.
    I want to send the message by Altova only, so want to modify the message by adding header to it.
    But I am not able to understand how to add header.
    Regards,
    Supriya.

  • How to Set UserId in Http Header for SSO?

    Hello All,
    I have a requirement to set the userid into the HTTP Header so that i can use the "Header Variables for User Authentication" module provided by SAP to achieve the SSO .
    Could some 1 let me know how can I achieve this? I know abt the HTTPServlet.setheader() method, But i need to set it using my JAVA application. Is there any way to set the HTTP Header using Java. I have already done a lot of googling, but havent got any results.
    I am sure that, there must definitely be a way in which we can add the user id into the HTTP header, in all the results, they tell abt adding it using the HTTP Servlet or PHP and so on, but i need to add it from JAVA.(setting REMOTE_USER as "mysapuserid")
    I have already added the "HeaderVariableLoginModule" in my login stack in the 2nd position, as per
    http://help.sap.com/saphelp_nw04/helpdata/en/8f/ae29411ab3db2be10000000a1550b0/frameset.htm
    Any pointers will be helpful,
    Meghana
    Edited by: Meghana Phadke on Apr 14, 2008 2:49 PM

    Hi
    As I understand, your java application is an EP client, check framework HttpClient :
    http://hc.apache.org/httpclient-3.x/
    http://hc.apache.org/httpclient-3.x/tutorial.html
    Hope this help
    Jakub Krecicki

  • Configure plain http adapter for receiving message from an external system

    Hi,
    we use Pi/700.
    Now I have an external system and I have to use HTTP (plain) to send messages to XI (via plain http adapter).
    I have no experiences with HTTP!
    In the external system I can only configure "URL, Username, Password" for sending messages - that's all!
    What do I have to configure in XI (communication channel, abap-stack, java-stack,...)?
    I don't know the URL of my XI-system. Is there an transaction code to get this information?
    Why do I need a Username/Pasword?
    For testing I can use a "http-post test tool" I found here in this forum.
    Thank you all for any help!
    Regards
    Wolfgang

    Hi Hummel,
    In Exteranl System u have to use these values
    name="myhost"      value="xiserver"
    name="myport"      value="8000"
    name="mysystem"    value="XY_BSservice"
    name="myinterface" value="Order_out"
    name="mynamespace" value="urn:xi:hcl:powebapp"
    name="myqos"       value="BE"
    name="myclient"    value="300"
    name="myuser"      value="XYZCLNT"
    name="mypass"      value="xiuser"
    Here My system is the Business service created in Integration directory of XI, Interface is the one created in Integration Repository (This is Outbaound from external sys to XI)
    In XI U have to create
    Data Types : 1) Source Structure data type(from extenal sys)
                 2) Target structure (where u want to send from XI)
    Message Types : 2 with above DT's
    Message Interface: 1) Outbound, Async (Order_out)
                       2) Inbound , Async (for the target sys)
    Then Message mapping and Interface mapping as usual..
    And in ID u have to create 2 services one is XY_BSservice for sending system and the other is for receiving system...
    For sending system no communication channel required...
    Hope u will get idea from the above..
    Need any further u r welcome..
    Regards
    Sridhar

  • How to set custom HTTP header for single sign on

    Currently we just begin to use an application called "etran". This application requires user name and password to login. Now, my assignment is to integrate etran application in our internal application. This means that somewhere in our internal application, there is a link leads to the etran application.
    It is going to be single sign on, that means that once user logs into our internal application, when he/she clicks on the etran link, no sign on to etran is needed.
    I consult with the technical people in etran. they said that our internal application needs to send a "login request" to etran via SSL with the user's information encoded in base 64 format. etran captures the HTTP header containing user authentication and authorization information, and parses the required information from the HTTP header.
    My question is that how I set user information in HTTP header? From my understanding, once I am able to set the user information in HTTP header, it is in base 64 format?
    Thanks in advance for your help.

    sharon38_74 wrote:
    they said that our internal application needs to send a "login request" to etran via SSL with the user's information encoded in base 64 format. etran captures the HTTP header containing user authentication and authorization information, and parses the required information from the HTTP header.
    My question is that how I set user information in HTTP header? From my understanding, once I am able to set the user information in HTTP header, it is in base 64 format?Your application need to act like a proxy. You can invoke a HTTP request programmatically using java.net.URLConnection. You can set request headers using URLConnection#setRequestProperty(). Also see the API docs: [http://java.sun.com/javase/6/docs/api/java/net/URLConnection.html]. You only need to know the header field name where to set the Base64-encoded value in. You need to Base64-encode the value yourself.

  • Content type for soap messages

    Hi,
    i'm picking up a file via nfs, taking the content of the file and i'm trying to send the content via SOAP to a Webservice. i'm encountering the foloowing error message in the comm. channel monitoring:
    SOAP: call failed: java.io.IOException: invalid content type for SOAP: TEXT/PLAIN
    So how/where can i set TEXT/XML in XI 3.0? Or did i made another misconfiguration where i'm not aware of? Any help appreciated.

    Hi,
    thanks for the quick answers.
    The Werbservice is MS CRM Dynamics. The "GUI" is still working. so the webservice is active and alive.
    I want to query the CRM, so i sent a fetch statement to file, which is being picked up and sent as SOAP message to the webservice.
    With point 6 in the mentioned blog the error message in the rwb is gone now, but the message in SXMB_MONI is flagged red and i'm struggling to finfd out what the next error is....may be someone can point out where to look at

  • SOAP HTTP header in SOAP request

    Hi,
    How to add the soap HTTP additional header in the SOAP request?
    I want to add the headers not through coding. I want to add it manually.
    I can able to add the HTTP headers through SOAPUI. But i need to add the same inside the request.
    Could someone please help me?

    I am sending the SOAP request through SoapUI.
    Here is the sample request which i have used.
    <?xml version="1.0"?>
    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://requisition.api.newscale.com">
    <soapenv:Header>
    <req:AuthenticationToken>
    <req:Username>***</req:Username>
    <req:Password>***</req:Password>
    </req:AuthenticationToken>
    </soapenv:Header>
    <soapenv:Body>
    <req:getRequisitionStatus>
    <req:loginUserName>***</req:loginUserName>
    <req:requisitionId>123456</req:requisitionId>
    </req:getRequisitionStatus>
    </soapenv:Body>
    </soapenv:Envelope>
    Here i have to add the additional HTTP header with this request.

  • Documentation for SOAP-Messages OR RFC-Calls

    Hello,
    I am very interested in documentations about
    - the SOAP-Messages BOPC sends from Client to .NET-Server and
    - the RFC-Calls BOPC executes from .NET-Server to ABAP-Server
    Does somebody know where to get this kind of documentations? Thanks very much for your help!

    I need this documentation too. We are developing extension in .Net, ABAP and VBA to solve some problems with Workflow.

Maybe you are looking for