Uploaded image for project: 'JBoss Web Services'
  1. JBoss Web Services
  2. JBWS-951

WSDL2Java generates incomplete mapping for array

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • None
    • tools-jaxrpc
    • None

      The attached WSDL contains this in its schema part:

      <complexType name="MovieInfo">
      <sequence>
      <element name="Id" type="xsd:int" />
      <element name="Name" type="xsd:string" nillable="true" />
      </sequence>
      </complexType>
      <complexType name="MovieInfoArray">
      <sequence>
      <element name="Entry" type="tns:MovieInfo" nillable="true" minOccurs="0" maxOccurs="unbounded" />
      </sequence>
      </complexType>

      When I run wstools on the WSDL, it generates no mapping information for MovieInfoArray in the jaxrpc-mapping.xml. If I call the single operation defined in the WSDL (see attached TestCase):

      MovieInfoArray info = port.findMovieByName("Movie");

      I got this error on the client side (on the server-side everything is fine):

      java.rmi.RemoteException: Call invocation failed: Java type 'class videorentalstore.webservice.MovieInfoArray' is not assignable from: [Lvideorentalstore.webservice.MovieInfo;; nested exception is:
      org.jboss.ws.WSException: Java type 'class videorentalstore.webservice.MovieInfoArray' is not assignable from: [Lvideorentalstore.webservice.MovieInfo;
      at org.jboss.ws.jaxrpc.CallImpl.invokeInternal(CallImpl.java:719)
      at org.jboss.ws.jaxrpc.CallImpl.invoke(CallImpl.java:398)
      at org.jboss.ws.jaxrpc.CallProxy.invoke(CallProxy.java:164)
      at $Proxy2.findMovieByName(Unknown Source)
      ...

      The SOAP message is serialized as expected on the server side, but the client can't deserialize it. On the client log I can see:

      DEBUG 22-05 21:36:19,476 (JAXBDeserializer.java:deserialize:82) -deserialize: [xmlName=result,xmlType=

      {http://www.ime.usp.br/SOD06}

      MovieInfoArray]
      DEBUG 22-05 21:36:19,667 (JAXBDeserializer.java:deserialize:99) -deserialized: [Lvideorentalstore.webservice.MovieInfo;

      I think this means that JBoss deserializes a MovieInfo[] instead of a MovieInfoArray. Adding information about MovieInfoArray to jaxrpc-mapping fixes the problem:

      <java-xml-type-mapping>
      <java-type>videorentalstore.webservice.MovieInfoArray</java-type>
      <root-type-qname xmlns:typeNS="http://www.ime.usp.br/SOD06">typeNS:MovieInfoArray</root-type-qname>
      <qname-scope>complexType</qname-scope>
      <variable-mapping>
      <java-variable-name>entry</java-variable-name>
      <xml-element-name>Entry</xml-element-name>
      </variable-mapping>
      </java-xml-type-mapping>

      So I think that wstools doesn't generate a "complete" jaxrpc-mapping.xml in this paticular case.

        1. videorental-client.jar
          2 kB
        2. videorental.war
          7 kB
        3. jbws-951.zip
          22 kB

              jgreene@redhat.com Jason Greene
              ivanneto_jira Ivan Neto (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: