2 Replies Latest reply on Aug 25, 2008 11:08 AM by Alessio Soldano

    JBossWS throws exception when receiving unbound soap header

    Dennis Kunst Newbie


      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/">
       <ns1:getDatabasesResponse xmlns:ns1="http://tservice.services.xxxxxxxx.com/">
       ............deleted contents of message..................

      Thanks in advance for looking at this problem...regards,