2 Replies Latest reply on Feb 15, 2005 4:35 PM by Marcelo Klein

    TypeMapping of custom class with an array in it

    Marcelo Klein Newbie

      Hi, I've been using JBoss.NET with jboss-3.2.3 to access webservices. Everything worked ok, but we decided to move on to JBoss4. I've downloaded it and followed the steps to reconfigure the webservices for JBossWS.
      Every WS work OK, except one wich uses a custom class that has an array in itself as an attribute. When I run the client, jboss throws the following error message:


      15:59:40,698 ERROR [BeanPropertyTarget] Could not convert [Lcom.primary.common.paginasFijas.PaginaFija; to bean field 'paginas[0]', type [Lcom.primary.common.paginasFijas.PaginaFija;
      15:59:40,700 ERROR [RPCInvocation] java.lang.IllegalArgumentException: array element type mismatch
      java.lang.IllegalArgumentException: array element type mismatch
      at org.apache.axis.encoding.ser.BeanPropertyTarget.set(BeanPropertyTarget.java:243)
      at org.apache.axis.encoding.DeserializerImpl.valueComplete(DeserializerImpl.java:305)
      at org.apache.axis.encoding.ser.ArrayDeserializer.valueComplete(ArrayDeserializer.java:664)
      at org.apache.axis.encoding.DeserializerImpl.endElement(DeserializerImpl.java:590)
      at org.apache.axis.encoding.DeserializationContextImpl.endElement(DeserializationContextImpl.java:1247)
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:252)
      at org.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1387)
      at org.apache.axis.encoding.DeserializerImpl.startElement(DeserializerImpl.java:436)
      at org.apache.axis.encoding.DeserializationContextImpl.startElement(DeserializationContextImpl.java:1180)
      at org.apache.axis.message.SAX2EventRecorder.replay(SAX2EventRecorder.java:244)
      at org.apache.axis.message.SOAPElementAxisImpl.publishToHandler(SOAPElementAxisImpl.java:1387)
      at org.apache.axis.message.RPCElement.deserialize(RPCElement.java:262)
      at org.apache.axis.message.RPCElement.getParams(RPCElement.java:396)
      at org.apache.axis.providers.java.RPCInvocation.prepareFromRequestEnvelope(RPCInvocation.java:234)
      at org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:103)
      at org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:358)
      at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:73)
      at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:160)
      at org.apache.axis.SimpleChain.invoke(SimpleChain.java:123)
      at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:560)
      at org.jboss.webservice.server.ServerEngine.invokeInternal(ServerEngine.java:202)
      at org.jboss.webservice.server.ServerEngine.invoke(ServerEngine.java:91)
      at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:975)
      at org.jboss.webservice.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:84)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:370)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:75)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:44)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:169)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      at java.lang.Thread.run(Thread.java:534)
      15:59:40,726 INFO [PaginasFijasService] Destroying
      15:59:40,810 ERROR [ServerEngine] Server error: AxisFault
      faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Client
      faultSubcode:
      faultString: array element type mismatch
      faultActor:
      faultNode:
      faultDetail:
      {http://xml.apache.org/axis/}stackTrace: java.lang.IllegalArgumentException: array element type mismatch
      ....


      As I stated before, I've read every Wiki, post or whatever, but found no answer to this so I post this. These are my config files for the wsr archive:

      webservices.xml:


      <?xml version='1.0' encoding='UTF-8' ?>
      <webservices
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:impl="http://com.myapp/ws4ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://www.ibm.com/webservices/xsd/j2ee_web_services_1_1.xsd"
      version="1.1">

      <webservice-description>
      <webservice-description-name>AnaliticsService</webservice-description-name>
      <wsdl-file>WEB-INF/wsdl/analitics.wsdl</wsdl-file>
      <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
      <port-component>
      <port-component-name>Analitics</port-component-name>
      <wsdl-port>Analitics</wsdl-port>
      <service-endpoint-interface>com.primary.server.analitics.AnaliticsInterface</service-endpoint-interface>
      <service-impl-bean>
      <servlet-link>AnaliticsServlet</servlet-link>
      </service-impl-bean>
      </port-component>
      </webservice-description>

      <webservice-description>
      <webservice-description-name>PaginasFijasService</webservice-description-name>
      <wsdl-file>WEB-INF/wsdl/paginasFijas.wsdl</wsdl-file>
      <jaxrpc-mapping-file>WEB-INF/jaxrpc-mapping.xml</jaxrpc-mapping-file>
      <port-component>
      <port-component-name>PaginasFijas</port-component-name>
      <wsdl-port>PaginasFijas</wsdl-port>
      <service-endpoint-interface>com.primary.server.paginasFijas.PaginasFijasInterface</service-endpoint-interface>
      <service-impl-bean>
      <servlet-link>PaginasFijasServlet</servlet-link>
      </service-impl-bean>
      </port-component>
      </webservice-description>

      </webservices>


      ws4ee-deployment.xml:

      <deployment
      xmlns='http://xml.apache.org/axis/wsdd/'
      xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
      xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
      xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
      xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

      <!-- mappings analitics -->
      <typeMapping
      qname='myNS:AnaliticUpdate' xmlns:myNS='urn:Gxws'
      type='java:com.primary.common.events.AnaliticUpdate'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      />

      <typeMapping
      qname='myNS:AnaliticData' xmlns:myNS='urn:Analitics'
      type='java:com.primary.common.product.AnaliticData'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      />

      <!-- mappings paginas fijas -->
      <typeMapping
      qname='myNS:PaginasFijasUpdate' xmlns:myNS='urn:Gxws'
      type='java:com.primary.common.events.PaginasFijasUpdate'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      />

      <typeMapping
      qname='myNS:PaginasFijasTitle' xmlns:myNS='urn:PaginasFijas'
      type='java:com.primary.common.paginasFijas.PaginasFijasTitle'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      />

      <typeMapping
      qname='myNS:PaginaFija' xmlns:myNS='urn:PaginasFijas'
      type='java:com.primary.common.paginasFijas.PaginaFija'
      serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
      deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
      encodingStyle=''
      />

      </deployment>


      jaxrpc-mapping.xml:

      <?xml version='1.0' encoding='UTF-8' ?>
      <java-wsdl-mapping
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd"
      version="1.1">
      <package-mapping>
      <package-type>com.primary.common.paginasFijas</package-type>
      <namespaceURI>urn:PaginasFijas</namespaceURI>
      <!--namespaceURI>http://paginasFijas.common.primary.com/PaginasFijasTitle</namespaceURI-->
      </package-mapping>

      <package-mapping>
      <package-type>com.primary.server.analitics</package-type>
      <namespaceURI>urn:Analitics</namespaceURI>
      </package-mapping>

      <package-mapping>
      <package-type>com.primary.common.events</package-type>
      <namespaceURI>urn:Gxws</namespaceURI>
      <!--namespaceURI>http://events.common.primary.com/AnaliticUpdate</namespaceURI-->
      </package-mapping>

      <package-mapping>
      <package-type>com.primary.common.product</package-type>
      <namespaceURI>urn:Analitics</namespaceURI>
      <!--namespaceURI>http://product.common.primary.com/AnaliticData</namespaceURI-->
      </package-mapping>

      <!-- MAPPING DE PaginasFijas

      <package-mapping>
      <package-type>com.primary.common.events</package-type>
      <namespaceURI>urn:PaginasFijas</namespaceURI>
      </package-mapping>
      -->


      </java-wsdl-mapping>


      I generate the WSDL using the Java2WSDL and the generated wsdl is the following (for the PaginasFijas WebService):

      <?xml version="1.0" encoding="UTF-8"?>
      <wsdl:definitions targetNamespace="urn:PaginasFijas" xmlns:impl="urn:PaginasFijas" xmlns:intf="urn:PaginasFijas" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns1="urn:Gxws" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/">
      <wsdl:types>
      <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:PaginasFijas">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType name="PaginasFijasTitle">
      <sequence>
      <element name="externalWebPage" type="xsd:boolean"/>
      <element name="noPage" type="xsd:boolean"/>
      <element name="title" nillable="true" type="xsd:string"/>
      <element name="webAddress" nillable="true" type="xsd:string"/>
      </sequence>
      </complexType>
      <complexType name="PaginaFija">
      <sequence>
      <element name="content" nillable="true" type="xsd:string"/>
      <element name="externalWebPage" type="xsd:boolean"/>
      <element name="paginaFijaTitle" nillable="true" type="impl:PaginasFijasTitle"/>
      </sequence>
      </complexType>
      <complexType name="ArrayOfPaginaFija">
      <complexContent>
      <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:PaginaFija[]"/>
      </restriction>
      </complexContent>
      </complexType>
      </schema>
      <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:Gxws">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
      <complexType name="PaginasFijasUpdate">
      <sequence>
      <element name="paginas" nillable="true" type="impl:ArrayOfPaginaFija"/>
      <element name="password" nillable="true" type="xsd:string"/>
      <element name="userName" nillable="true" type="xsd:string"/>
      </sequence>
      </complexType>
      </schema>
      </wsdl:types>

      <wsdl:message name="addPaginasFijasTitleRequest">

      <wsdl:part name="in0" type="impl:PaginasFijasTitle"/>

      </wsdl:message>

      <wsdl:message name="addPaginasFijasTitleResponse">

      </wsdl:message>

      <wsdl:message name="publishRequest">

      <wsdl:part name="in0" type="tns1:PaginasFijasUpdate"/>

      </wsdl:message>

      <wsdl:message name="publishResponse">

      </wsdl:message>

      <wsdl:portType name="PaginasFijasInterface">

      <wsdl:operation name="publish" parameterOrder="in0">

      <wsdl:input name="publishRequest" message="impl:publishRequest"/>

      <wsdl:output name="publishResponse" message="impl:publishResponse"/>

      </wsdl:operation>

      <wsdl:operation name="addPaginasFijasTitle" parameterOrder="in0">

      <wsdl:input name="addPaginasFijasTitleRequest" message="impl:addPaginasFijasTitleRequest"/>

      <wsdl:output name="addPaginasFijasTitleResponse" message="impl:addPaginasFijasTitleResponse"/>

      </wsdl:operation>

      </wsdl:portType>

      <wsdl:binding name="PaginasFijasSoapBinding" type="impl:PaginasFijasInterface">

      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>

      <wsdl:operation name="publish">

      <wsdlsoap:operation soapAction=""/>

      <wsdl:input name="publishRequest">

      <wsdlsoap:body use="literal" namespace="urn:PaginasFijas"/>

      </wsdl:input>

      <wsdl:output name="publishResponse">

      <wsdlsoap:body use="literal" namespace="urn:PaginasFijas"/>

      </wsdl:output>

      </wsdl:operation>

      <wsdl:operation name="addPaginasFijasTitle">

      <wsdlsoap:operation soapAction=""/>

      <wsdl:input name="addPaginasFijasTitleRequest">

      <wsdlsoap:body use="literal" namespace="urn:PaginasFijas"/>

      </wsdl:input>

      <wsdl:output name="addPaginasFijasTitleResponse">

      <wsdlsoap:body use="literal" namespace="urn:PaginasFijas"/>

      </wsdl:output>

      </wsdl:operation>

      </wsdl:binding>

      <wsdl:service name="PaginasFijasInterfaceService">

      <wsdl:port name="PaginasFijas" binding="impl:PaginasFijasSoapBinding">

      <wsdlsoap:address location="http://192.168.7.192:8080/ws4ee/services/PaginasFijas"/>

      </wsdl:port>

      </wsdl:service>

      </wsdl:definitions>


      I would appreciate your help.
      Thanks a lot,
      Marcelo