5 Replies Latest reply: May 31, 2006 3:56 AM by Heiko Braun RSS

Error when returning an array

Juergen Zimmermann Master

A method of a web service should return an array, namely KundeData[].

JBossWS generates this portion in the WSDL:

 <complexType name="KundeData">
 <sequence>
 <element name="art" nillable="true" type="string"/>
 <element name="id" type="long"/>
 <element name="nachname" nillable="true" type="string"/>
 <element name="rabatt" type="int"/>
 <element name="vorname" nillable="true" type="string"/>
 </sequence>
 </complexType>
 <complexType name="KundeData.Array">
 <sequence>
 <element maxOccurs="unbounded" minOccurs="0" name="value" nillable="true" type="tns:KundeData"/>
 </sequence>
 </complexType>


The ANT task "wstools" generates this portion for jaxrpc-mapping.xml:
 <wsdl-return-value-mapping>
 <method-return-value>de.hska.ws.KundeData[]</method-return-value>
 <wsdl-message xmlns:wsdlMsgNS='http://ws.hska.de/jaws'>wsdlMsgNS:KundenverwaltungService_findKundenByNachnameResponse</wsdl-message>
 <wsdl-message-part-name>result</wsdl-message-part-name>
 </wsdl-return-value-mapping>


When a client invokes the web service this stack trace is produced:
org.jboss.ws.WSException: Cannot load java type: de.hska.ws.KundeData.Array
 at org.jboss.ws.metadata.ParameterMetaData.getJavaType(ParameterMetaData.java:141)
 at org.jboss.ws.metadata.ParameterMetaData.eagerInitialize(ParameterMetaData.java:291)
 at org.jboss.ws.metadata.OperationMetaData.eagerInitialize(OperationMetaData.java:477)
 at org.jboss.ws.metadata.EndpointMetaData.eagerInitialize(EndpointMetaData.java:353)
 at org.jboss.ws.metadata.ServiceMetaData.eagerInitialize(ServiceMetaData.java:397)
 at org.jboss.ws.metadata.UnifiedMetaData.eagerInitialize(UnifiedMetaData.java:143)
 at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:125)
 at org.jboss.ws.metadata.JSR109ClientMetaDataBuilder.buildMetaData(JSR109ClientMetaDataBuilder.java:78)
 at org.jboss.ws.jaxrpc.ServiceImpl.<init>(ServiceImpl.java:96)
 at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:157)
 at org.jboss.ws.jaxrpc.ServiceFactoryImpl.createService(ServiceFactoryImpl.java:128)
 at de.hska.test.WebServicesTest.setUp(WebServicesTest.java:58)
Caused by: java.lang.ClassNotFoundException: de.hska.ws.KundeData.Array
 at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
 at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
 at org.jboss.ws.utils.JavaUtils.loadJavaType(JavaUtils.java:81)
 at org.jboss.ws.metadata.ParameterMetaData.getJavaType(ParameterMetaData.java:137)
 ... 21 more