Announcement Announcement Module
Collapse
No announcement yet.
SOAP1.2 and SOAPAction Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • SOAP1.2 and SOAPAction

    I have a simple ws client using Spring-WS

    The beans are configured as
    <bean id="messageFactory" class="org.springframework.ws.soap.saaj.SaajSoapMe ssageFactory">
    <property name="soapVersion">
    <util:constant static-field="org.springframework.ws.soap.SoapVersion.SOA P_12"/>
    </property>
    </bean>

    <bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServi ceTemplate">
    <constructor-arg ref="messageFactory"/>
    <property name="defaultUri" value="http://<DestinationURL or IP Address>"/>
    </bean>

    The systemOut from the App Server shows
    [9/24/10 13:59:50:173 CDT] 0000001b SystemErr R 3238386 [ORB.thread.pool : 1] INFO context.ContextLoader - Root WebApplicationContext: initialization started
    [9/24/10 13:59:50:173 CDT] 0000001b SystemErr R 3238386 [ORB.thread.pool : 1] INFO support.XmlWebApplicationContext - Refreshing Root WebApplicationContext: startup date [Fri Sep 24 13:59:50 CDT 2010]; root of context hierarchy
    [9/24/10 13:59:50:173 CDT] 0000001b SystemErr R 3238386 [ORB.thread.pool : 1] INFO xml.XmlBeanDefinitionReader - Loading XML bean definitions from URL [file:/appl/data/isco/pgms/config/applicationContext.xml]
    [9/24/10 13:59:50:204 CDT] 0000001b SystemErr R 3238417 [ORB.thread.pool : 1] INFO support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultL istableBeanFactory@79a679a6: defining beans [appCtx,messageFactory,webServiceTemplate]; root of factory hierarchy
    [9/24/10 13:59:50:204 CDT] 0000001b SystemErr R 3238417 [ORB.thread.pool : 1] INFO saaj.SaajSoapMessageFactory - Creating SAAJ 1.3 MessageFactory with SOAP 1.2 Protocol
    [9/24/10 13:59:50:204 CDT] 0000001b SystemErr R 3238417 [ORB.thread.pool : 1] INFO context.ContextLoader - Root WebApplicationContext: initialization completed in 31 ms

    When trying to use the webServiceTemplate in my program

    WebServiceTemplate wsClient = (WebServiceTemplate) appCtx.getBean("webServiceTemplate");
    Result r = new StreamResult();
    System.out.println(wsClient.sendSourceAndReceiveTo Result(new StreamSource(new StringReader(newParam1)) , r));

    I get the Error message.
    [9/24/10 14:00:20:062 CDT] 00000024 SystemErr R org.springframework.ws.soap.client.SoapFaultClient Exception: Unable to handle request without a valid action parameter. Please supply a valid soap action.


    I thought SOAP 1.2 doesnt need the SOAPAction header anymore.

    Separately just using the SAAP API I was able to get this working by not setting any headers and just streaming the text/string into SOAPMessage and using the call of SOAPConnection interface as
    SOAPMessage reply = connection.call(soapMessage, URL);

    Is there anything I need to do to specify for the WebServiceTemplate

    Please help. I'm running this under RAD WTE (6.1)

    Thanks in advance.

  • #2
    I've resolved the problem this way.

    After much reading and knowing SOAP internals more than I wanted to. I realized that SOAP1.1 and SOAP1.2 are different and not compatible.
    My server was running J2EE 1.4 which does'nt support SOAP1.2 i.e. MessageFactory.newInstance(SOAP1.2) is not available.
    The app runs and serves as webService Client interacting with an external webService over which I have no control.

    The wsClient acts as a Gateway to multiple internal clients to the external webService.

    So I've taken the route of treating the SOAP/XML as plain old XML and started to use the org.springframework.ws.pox.dom.DomPoxMessageFactor y instead. There are some limitations with the capability of treating the message as SOAP.

    No SOAPAction tag is necessary when interacting with SOAP1.2 service.
    And in my code I explicitly set the contentType as "text/xml"

    ((DomPoxMessageFactory) messageFactory).setContentType("text/xml");

    which results in doing a HTTP POST of the message with the result being retrieved.
    I can then use wsTemplate.sendSourceAndReceiveToResult(request, result);
    which gets me the response in the Result object.

    The wsTemplate also extends the WebServiceGatewaySupport for the Gateway functionality.

    case closed.

    Comment

    Working...
    X