Announcement Announcement Module
Collapse
No announcement yet.
Custom Header Help Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Custom Header Help

    Hi All,
    I am trying to inject a custom header into my request payload but I am getting this error:
    Code:
    org.springframework.ws.soap.saaj.SaajSoapMessage cannot be cast to org.springframework.ws.soap.axiom.AxiomSoapMessage
    Here is part of my config file where I am explicitly using Axiom:

    Code:
    <bean id="messageFactory"   class="org.springframework.ws.soap.axiom.AxiomSoapMessageFactory"/>
    And I am getting the error at this point:

    Code:
     public void doWithMessage(WebServiceMessage message) throws IOException, TransformerException {
            AxiomSoapMessage soapMessage = (AxiomSoapMessage) message;
            soapMessage.setSoapAction(GET_CUSTOMER_SOAP_ACTION);
            SOAPEnvelope envelope = (SOAPEnvelope) soapMessage.getAxiomMessage().getSOAPEnvelope();
    And by the way I am using xmlbeans for marshalling. This is the client side only because the service is expecting a certain header hence i need to add a custom header.

    I don't know what I am doing wrong.
    Any help on this will be very much appreciated.

    Thanks,

    Emmanuel
    Last edited by emmanuel; Mar 9th, 2011, 10:13 AM. Reason: I made a mistake in the title

  • #2
    I resolved my own problem.
    I didn't configure the WebServiceTemplate properly.
    I had to add:
    Code:
        <bean id="xbeans" class="org.springframework.oxm.xmlbeans.XmlBeansMarshaller"/>
    
        <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"
    		p:marshaller-ref="xbeans"
    		p:unmarshaller-ref="xbeans"
    		p:defaultUri="${url}"
    		p:messageSender-ref="messageSender">
            <constructor-arg ref="messageFactory"/>
        </bean>

    Comment

    Working...
    X