[JBossWS] - SimpleDeserializer error on returning complex type
by jaki
Hi,
I have exposed a stateless ejb3 bean as a WS and it has a method returning a complex type.
Signature:
@WebMethod
| public MapBean getMap(String test)
The class MapBean just has 2 string members along with their getters/setters.
I'm using an axis WS client for it (using the Call interface) but invoking the Web service gives me the below error:
Caused by: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
| at org.apache.axis.encoding.ser.SimpleDeserializer.onStartChild(SimpleDeserializer.java:145)
| at org.apache.axis.encoding.DeserializationContext.startElement(DeserializationContext.java:1035)
| at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:165)
| at org.apache.axis.message.MessageElement.publishToHandler(MessageElement.java:1141)
| at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:236)
| at org.apache.axis.message.RPCElement.getParams(RPCElement.java:384)
| at org.apache.axis.client.Call.invoke(Call.java:2448)
| ... 3 more
What's wierd is, it works without the error if I change the binding from document/wrapped to document/BARE but in that case the input arguements take the form '<arg0 xsi:type='xsd:string' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>nabble</arg0>' even inside the webmethod! Kindly help me here.
WSDL for response:
xs:complexType name="getMapResponse">
| <xs:sequence>
| <xs:element minOccurs="0" name="return" type="tns:mapBean"/>
| </xs:sequence>
| </xs:complexType>
| <xs:complexType name="mapBean">
| <xs:sequence>
| <xs:element minOccurs="0" name="key" type="xs:string"/>
| <xs:element minOccurs="0" name="value" type="xs:string"/>
| </xs:sequence>
| </xs:complexType>
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171275#4171275
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171275
16 years, 4 months
[JBossWS] - JBossWS throws exception when receiving unbound soap header
by Dennisk
Hello,
I hope some one can help me with this problem, it's causing me headaches:
I use Jax-ws in my webservice client project deployed on JBoss4.2.2GA (with JBossWs patch) to communicate with a party through soap. When I receive a reply to my request I get the following exception:
2008-08-19 10:37:42,020 ERROR [org.jboss.ws.core.soap.SOAPMessageUnMarshaller] Cannot unmarshall SOAPMessage
| javax.xml.soap.SOAPException: Invalid SOAPHeaderElement name: api-version
| at org.jboss.ws.core.soap.SOAPHeaderImpl.addChildElement(SOAPHeaderImpl.java:64)
| at org.jboss.ws.core.soap.EnvelopeBuilderDOM.buildSOAPHeader(EnvelopeBuilderDOM.java:174)
| at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:138)
| at org.jboss.ws.core.soap.EnvelopeBuilderDOM.build(EnvelopeBuilderDOM.java:96)
| at org.jboss.ws.core.soap.MessageFactoryImpl.createMessage(MessageFactoryImpl.java:262)
| at org.jboss.ws.core.soap.SOAPMessageUnMarshaller.read(SOAPMessageUnMarshaller.java:84)
| at org.jboss.remoting.transport.http.HTTPClientInvoker.readResponse(HTTPClientInvoker.java:473)
| at org.jboss.remoting.transport.http.HTTPClientInvoker.useHttpURLConnection(HTTPClientInvoker.java:305)
| at org.jboss.remoting.transport.http.HTTPClientInvoker.transport(HTTPClientInvoker.java:135)
| at org.jboss.remoting.MicroRemoteClientInvoker.invoke(MicroRemoteClientInvoker.java:122)
| at org.jboss.remoting.Client.invoke(Client.java:1634)
| at org.jboss.remoting.Client.invoke(Client.java:548)
| at org.jboss.ws.core.client.RemotingConnectionImpl.invoke(RemotingConnectionImpl.java:183)
| at org.jboss.ws.core.client.SOAPRemotingConnection.invoke(SOAPRemotingConnection.java:77)
| at org.jboss.ws.core.CommonClient.invoke(CommonClient.java:337)
| at org.jboss.ws.core.jaxws.client.ClientImpl.invoke(ClientImpl.java:243)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:164)
| at org.jboss.ws.core.jaxws.client.ClientProxy.invoke(ClientProxy.java:150)
| at $Proxy389.getDatabases(Unknown Source)
| at com.myorganize.services.mail.MailServiceBean.getDatabaseId(MailServiceBean.java:180)
|
|
It looks like the parsing of the unbound soap header element (api-version) causes an exception (I do not need this info anyway). Strangely enough in Eclipse I used the jaxws-rt implementation for testing these calls and there it worked perfectly and caused no exceptions. I looked at the jboss code (org.jboss.ws.core.soap.SOAPHeaderImpl.addChildElement) that trows the exception and it seems to throw it when the namespace or prefix is null, but I do not exactly know how or why these could be null.
Can anybody give me some info on what the exact problem could be and maybe what the best solution is? Or is there a setting or configuration item that can direct jboss to ignore soap header elements.
I already tried to use the jaxws-rt implementation in JBoss (4.2.2.GA) but I could not get a working set because the jbossws core seems to be tightly coupled with the jboss application server, and I keep getting compatibility and classloading issues with implementation classes of jbossws/saaj and jaxws-rt.
ps. I cannot change the wsdl and define the header elements because the other party will not change the wsdl.
pss. I hope to avoid having to write a raw soap msg handler to remove the element since it is a lot of work and I think it should not be necessary.
The return message with the api-version soap header element that causes the problem:
| <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
| <soap:Header>
| <api-version>1.82</api-version>
| </soap:Header>
| <soap:Body>
| <ns1:getDatabasesResponse xmlns:ns1="http://tservice.services.xxxxxxxx.com/">
| <databaseInfos>
| <id>yDK</id>
| <name>_Expeditie</name>
| <subscriberFields>email</subscriberFields>
| ............deleted contents of message..................
| <subscriberFields>naam</subscriberFields>
| </databaseInfos>
| </ns1:getDatabasesResponse>
| </soap:Body>
| </soap:Envelope>
|
Thanks in advance for looking at this problem...regards,
Dennis
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4171205#4171205
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4171205
16 years, 4 months