Null Values From MS Web Services Toolkit Client

Hi,

I've been bashing my head against a wall on this one for too long now.

I've got a JAX-WS web service deployed to Glassfish v2 b33 which works fine when called by a Java client. It also works fine when methods with no parameters are called from the MS client, i.e. simple and complex types are returned as they should be. However the problem I am having is that when the web service methods that take parameters are called from the MS client, the values received by the service are always null. I've montitored the service and values are being sent in the soap request, but a simple System.out.println statement in the first line of the method indicates a null value. I've captured a request from the Java client and the MS client to show the difference:

A java request:

<soapenv:Envelope

xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:xsd="http://www.w3.org/2001/XMLSchema"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<soapenv:Header/>

<soapenv:Body>

<ns0:getConfig xmlns:ns0="http://ws.firestorm.alternativenetworks.com/">

<arg0>Inbound</arg0>

</ns0:getConfig>

</soapenv:Body>

</soapenv:Envelope>

and a request from the web services toolkit:

<SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"

xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"

xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<SOAPSDK4:getConfig xmlns:SOAPSDK4="http://ws.firestorm.alternativenetworks.com/">

<SOAPSDK4:arg0>Inbound</SOAPSDK4:arg0>

</SOAPSDK4:getConfig>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

I've tried everything I can think of, including changing the style from RPC/LITERAL to DOCUMENT/LITERAL, but the Java web service just seem to like the way the SOAP message is wrapped up.

Any help on this would be greatly appreciated.

Cheers

Tony

[2425 byte] By [thewhirlwinda] at [2007-11-27 3:48:36]
# 1

Hi Tony,

you should check why there's this difference:

With MS client,

<SOAPSDK4:arg0>Inbound</SOAPSDK4:arg0>

the "arg0" parameter is in "SOAPSDK4" xml namespace (which is actually "http://ws.firestorm.alternativenetworks.com" ).

With Java client, the arg0 parameter is not in any xml namespace:

<arg0>Inbound</arg0>

I can imagine that this is a cause of the problem, but depends on the WSDL (what is right) and on the implementation.

Ciao,

Milan

http://www.boruvka.net/blog

Milan.Boruvkaa at 2007-7-12 8:52:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...
# 2

Thanks Milan, your suggestion put me on the right track, however I've hit another snag.

I decided the best way to solve the problem was to use the Glassfish Transformation Rules feature to take the SOAP request and transform it to a valid format before reaching the code. The XSLT file I created looks like this (I'm no XSLT guru so this will definitely need some tidying up, but for now it works): <?xml version="1.0" encoding="ISO-8859-1"?>

<xsl:stylesheet version="1.0"

xmlns:xsl="http://www.w3.org/1999/XSL/Transform"

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"

xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"

xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/">

<xsl:output method="xml" indent="yes"/>

<xsl:template match="*">

<xsl:copy><xsl:copy-of select="@*"/><xsl:apply-templates/></xsl:copy>

</xsl:template>

<xsl:template match="/SOAP-ENV:Envelope/SOAP-ENV:Body/*">

<xsl:copy>

<xsl:copy-of select="@*"/>

<xsl:for-each select="*">

<xsl:text disable-output-escaping="yes"><arg></xsl:text>

<xsl:value-of select="position() - 1"/>

<xsl:text disable-output-escaping="yes">></xsl:text>

<xsl:value-of select="."/>

<xsl:text disable-output-escaping="yes"></arg></xsl:text>

<xsl:value-of select="position() - 1"/>

<xsl:text disable-output-escaping="yes">></xsl:text>

</xsl:for-each>

</xsl:copy>

</xsl:template>

</xsl:stylesheet>

which transforms the problem SOAP request: <SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"

xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"

xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<SOAPSDK4:getConfig xmlns:SOAPSDK4="http://ws.firestorm.alternativenetworks.com/">

<SOAPSDK4:arg0>Inbound</SOAPSDK4:arg0>

</SOAPSDK4:getConfig>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

to the following valid format: <?xml version="1.0" encoding="utf-8"?>

<SOAP-ENV:Envelope

xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"

xmlns:SOAPSDK1="http://www.w3.org/2001/XMLSchema"

xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema-instance"

xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/">

<SOAP-ENV:Header/>

<SOAP-ENV:Body>

<SOAPSDK4:getConfig xmlns:SOAPSDK4="http://ws.firestorm.alternativenetworks.com/">

<arg0>Inbound</arg0>

</SOAPSDK4:getConfig>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

But when I load the .xsl file using the Transformation Rules page and call the web service using the Microsoft Web Services Toolkit, I'm getting the following exception: [#|2007-05-11T09:23:46.530+0100|INFO|sun-appserver9.1|javax.enterprise.system.tools.admin|_ThreadID=15;_ThreadName=Thread-15;com.sun.enterprise.admin.event.wsmgmt.TransformationRuleEvent -- server [1 Change(s), Id:1, ts:1178871826530];|ADM1041:Sent the event to instance:[com.sun.enterprise.admin.event.wsmgmt.TransformationRuleEvent -- server [1 Change(s), Id:1, ts:1178871826530]]|#]

[#|2007-05-11T09:27:31.675+0100|INFO|sun-appserver9.1|javax.enterprise.system.tools.admin|_ThreadID=12;_ThreadName=httpWorkerThread-4848-0;com.sun.enterprise.admin.event.wsmgmt.TransformationRuleEvent -- server [1 Change(s), Id:2, ts:1178872051675];|ADM1041:Sent the event to instance:[com.sun.enterprise.admin.event.wsmgmt.TransformationRuleEvent -- server [1 Change(s), Id:2, ts:1178872051675]]|#]

[#|2007-05-11T09:28:00.269+0100|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=13;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=89eadb09-2894-4ace-95f6-75043c1e6988;|

ERROR: ''|#]

[#|2007-05-11T09:28:00.285+0100|WARNING|sun-appserver9.1|javax.enterprise.system.stream.err|_ThreadID=13;_ThreadName=httpSSLWorkerThread-8080-0;_RequestID=89eadb09-2894-4ace-95f6-75043c1e6988;|

com.sun.enterprise.admin.wsmgmt.transform.TransformException: javax.xml.transform.TransformerException: java.lang.NullPointerException

at com.sun.enterprise.admin.wsmgmt.transform.FilterChain.process(FilterChain.java:238)

at com.sun.enterprise.admin.wsmgmt.transform.TransformFilter.process(TransformFilter.java:144)

at com.sun.enterprise.admin.wsmgmt.filter.spi.FilterRouter.applyFilters(FilterRouter.java:69)

at com.sun.enterprise.admin.wsmgmt.agent.GlobalMessageListenerImpl.processRequest(GlobalMessageListenerImpl.java:181)

at com.sun.enterprise.webservice.monitoring.WebServiceEngineImpl.processRequest(WebServiceEngineImpl.java:265)

at com.sun.enterprise.webservice.monitoring.JAXWSEndpointImpl.processRequest(JAXWSEndpointImpl.java:53)

at com.sun.enterprise.webservice.MonitoringPipe.process(MonitoringPipe.java:127)

at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:79)

at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)

at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)

at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)

at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)

at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:70)

at com.sun.xml.ws.mex.server.MetadataServerPipe.process(MetadataServerPipe.java:97)

at com.sun.enterprise.webservice.CommonServerSecurityPipe.processRequest(CommonServerSecurityPipe.java:191)

at com.sun.enterprise.webservice.CommonServerSecurityPipe.process(CommonServerSecurityPipe.java:113)

at com.sun.xml.ws.api.pipe.helper.PipeAdapter.processRequest(PipeAdapter.java:79)

at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559)

at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518)

at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503)

at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400)

at com.sun.xml.ws.server.WSEndpointImpl$2.process(WSEndpointImpl.java:208)

at com.sun.xml.ws.transport.http.HttpAdapter$HttpToolkit.handle(HttpAdapter.java:374)

at com.sun.xml.ws.transport.http.HttpAdapter.handle(HttpAdapter.java:175)

at com.sun.xml.ws.transport.http.servlet.ServletAdapter.handle(ServletAdapter.java:134)

at com.sun.enterprise.webservice.Ejb3MessageDispatcher.handlePost(Ejb3MessageDispatcher.java:100)

at com.sun.enterprise.webservice.Ejb3MessageDispatcher.invoke(Ejb3MessageDispatcher.java:74)

at com.sun.enterprise.webservice.EjbWebServiceServlet.dispatchToEjbEndpoint(EjbWebServiceServlet.java:187)

at com.sun.enterprise.webservice.EjbWebServiceServlet.service(EjbWebServiceServlet.java:116)

at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)

at com.sun.enterprise.web.AdHocContextValve.invoke(AdHocContextValve.java:101)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)

at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:74)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:207)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)

at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)

at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)

at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)

at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:249)

at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)

at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)

at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)

at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)

at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)

at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)

at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:328)

at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)

at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)

Caused by: javax.xml.transform.TransformerException: java.lang.NullPointerException

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:651)

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:281)

at com.sun.enterprise.admin.wsmgmt.transform.FilterChain.process(FilterChain.java:224)

... 54 more

Caused by: java.lang.NullPointerException

at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1235)

at com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter.parse(TrAXFilter.java:105)

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transformIdentity(TransformerImpl.java:588)

at com.sun.org.apache.xalan.internal.xsltc.trax.TransformerImpl.transform(TransformerImpl.java:642)

... 56 more

Could this be a bug or am I doing something wrong?

Cheers again,

Tony

thewhirlwinda at 2007-7-12 8:52:29 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...