3 Replies Latest reply on Oct 28, 2005 8:56 AM by Thomas Diesler

    JB4 can not handle SOAP message but JB3 can

    Karl-Christian Pammer Newbie

      Hi,
      I have the following problem: I am using a Webservice from an external provider.

      At the moment I am using JB3 to access the Webservice. The interfaces and other java classes were generated from the wsdl using wsdl2java. It its working very well.

      Now I am preparing the upgrade to JB4 (4.0.2). So I used wscompile from SUNs webservice developer pack (1.6) and generated the needed java files und the mapping files. The application was successfully deployed with wsdl and mapping file packed into the ear archive.

      When I access the webservice JB4 encounters an error while parsing the response soap message.
      I get the following exception because JB4 tries to cast to the wrong type:
      org.xml.sax.SAXException: Bad types (class [...] TSoapReturnCode -> class [...]TSoapSubscriberResponse)
      at org.jboss.axis.message.RPCHandler.onStartChild(RPCHandler.java:334
      [...]

      The definition of the type in the wsdl is as follows:
      [...]
      <xs:complexType name="TSoapSubscriberResponse">
      <xs:sequence>
      <xs:element name="returnCodeArray" type="ns1:TSoapReturnCodeArray"/>
      <xs:element name="subscriber" type="ns1:TSoapSubscriber"/>
      </xs:sequence>
      </xs:complexType>
      [...]
      whereas the namespace is set to xmlns:ns1="urn:de_bmcag_visoap_model".

      In the at the log file appeared the following entry:
      org.jboss.axis.encoding.DeserializationContextImpl|Enter:getDeserializer: [class=class de.schlund.j2ee.apps.voip.bnwsocall.ws.impl.TSoapSubscriberResponse,xmlType={urn:de_bmcag_visoap_model}TSoapReturnCode]
      The Deserializer and the the xmlType do not match.

      I do not unterstand what JB4 is doing here. Especially because JB3 handles the message without any problems. I even tried JB 4.0.3. It can not handle the message either but with another SAXException.

      When I take a look at the soap message sent as response the tag can be found at the end. It inclued a href to an entry defined above?

      The entry with the id 1 is the an element of type TSoapSubscriberResponse -> the correct return type. Could this backward directed reference be the problem? (And if it is the problem, why for JB4 only?)

      Does anyone have an idea? I am grateful for every clue.

      Sincerely
      Charly

        • 1. Re: JB4 can not handle SOAP message but JB3 can
          Thomas Diesler Master

          Is this using soap encoding? If so this is not allowed by the basic-profile-1.0.

          • 2. Re: JB4 can not handle SOAP message but JB3 can
            Karl-Christian Pammer Newbie

            Yes. SOAP-ENC is used to encode several arrays.

            Together with our external partner we found the following solution: We flattened the hierarchy of the message.

            In the original version the message looked something like that:

            <response>
             <component 1>
             [...]
             <subcomponent>...</subcomponent>
             </component1>
             ...
             <component N>.../componentN>
            <return href=#1/>
            </response>
            


            Our partner changed it to:
            <response>
             <return href=#1>
            </response>
            <component1 id=1>
             [...]
             <subcomponent href=#2 />
            </component>
            <subcomponent id=2>...</subcomponent>
            

            All parts that were previously sub-tags of the reponse tag where moved to the same level as the response tag and references were inserted.
            With this version of the message JB4.0.2 is quite happy and JB3 accepts it without problems too.

            To be honest we found this solution by accident. We do not really understand why this version works and the other does not. The wsdl for the service was not changed - our partner just configured his system to produce "flattened" response messages.

            Because of the fact that JB4.0.3 does not accept the message we assume that we have only found a workarounb but have not solved the problem.

            • 3. Re: JB4 can not handle SOAP message but JB3 can
              Thomas Diesler Master

              rpc/encoded is not allowed with J2EE-1.4 web services