Back Forum Reply New

SOAP1.2 and SOAPAction

I have a simple ws client using Spring-WS

The beans are configured as    lt;bean id=quot;messageFactoryquot; class=quot;org..ws.soap.saaj.SaajSoapMe  ssageFactoryquot;gt;       lt;property name=quot;soapVersionquot;gt;lt;util:constant static-field=quot;org..ws.soap.SoapVersion.SOA  P_12quot;/gt;       lt;/propertygt;   lt;/beangt;      lt;bean id=quot;webServiceTemplatequot; class=quot;org..ws.client.core.WebServi  ceTemplatequot;gt;       lt;constructor-arg ref=quot;messageFactoryquot;/gt;       lt;property name=quot;defaultUriquot; value=quot;gt;   lt;/beangt;

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 ucl [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..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(quot;webServiceTemplatequot;);
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..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, ucl);

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.

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..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 quot;text/xmlquot;

((DomPoxMessageFactory) messageFactory).setContentType(quot;text/xmlquot;);

which results in doing a from 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.
¥
Back Forum Reply New