problem with BeanSerializer and JBoss


C

chomiq

I've got object Order with an array of OrderOwner objects.

All objets are BeanPatterns like.

I would like to send them beetwen Client and WebService useing
org.apache.axis.encoding.ser.BeanSerializer.

when I deploy WS in Tomcat with Axis everything is OK.

I can send Order with array od OrderOwners.

But when I trying deploy WS in JBoss-4.0.0 I've got errors during
deserializing.



Could You help me?



---------------------- error --------------------------------



call.invoke() throws: IllegalArgumentException: array element type mismatch



jboss console:

15:12:36,343 ERROR [BeanPropertyTarget] Could not convert
[Lcom.myapp.OrderOwner; to bean field 'owner[0]', type
[Lcom.myapp.OrderOwner;

15:12:36,343 ERROR [RPCInvocation] java.lang.IllegalArgumentException: array
element type mismatch

java.lang.IllegalArgumentException: array element type mismatch







--------------- client: -------------------



....

Order order = new Order();

order.setCustomerName("Glen Daniels");

OrderOwner[] oo = {new OrderOwner()};

oo[0].setName("Mikey Mouse");

order.setOrderName("TESTTEST-2");

order.setOwner((OrderOwner[])oo);

....

Service service = new Service();

Call call = (Call) service.createCall();

QName qn = new QName( "urn:BeanService", "Order" );

QName qn2 = new QName( "urn:BeanService", "OrderOwner" );



call.registerTypeMapping(Order.class, qn,

new
org.apache.axis.encoding.ser.BeanSerializerFactory(Order.class, qn),

new
org.apache.axis.encoding.ser.BeanDeserializerFactory(Order.class, qn));



call.registerTypeMapping(OrderOwner.class, qn2,

new
org.apache.axis.encoding.ser.BeanSerializerFactory(OrderOwner.class, qn2 ),

new
org.apache.axis.encoding.ser.BeanDeserializerFactory(OrderOwner.class,
qn2));



Order result = null;

String endpoint =
"http://localhost:8080/simple-ws4ee/exactpath/jse";

try {

call.setTargetEndpointAddress( new java.net.URL(endpoint) );

call.setOperationName( new QName("OrderProcessor",
"processOrder") );

call.addParameter( "arg1", qn, ParameterMode.IN );

call.setReturnType( qn, Order.class);

result = (Order) call.invoke( new Object[] { new Order[] {
order } } );

} catch (AxisFault fault) {

//result = "Error : " + fault.toString();

System.out.println("er = "+fault.toString());

}



---------------- classes --------------------



public class Order extends SimpleOrder

{

private String customerName;


private String shippingAddress;


private OrderOwner[] owner;


public Order() {}


public void setOwner(OrderOwner[] owner) {

this.owner = owner;

}

public OrderOwner[] getOwner() {

return this.owner;

}

public String getCustomerName() { return customerName; }


public void setCustomerName(String name) { customerName = name; }


public String getShippingAddress() { return shippingAddress; }


public void setShippingAddress(String address) { shippingAddress =
address; }

}

public class OrderOwner {

private String name = "";


public OrderOwner() {

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public String toString() {

return this.name;

}

}

public class SimpleOrder {

private String orderName = "";


public SimpleOrder() {}


public void setOrderName(String orderName) {

this.orderName = orderName;

}


public String getOrderName() {

return this.orderName;

}

}



--------- WS implements interface (nothing special)----------------

public interface BeanService extends java.rmi.Remote {

public Order processOrder(Order []orders) throws

java.rmi.RemoteException;

}



---------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.myapp</package-type>

<namespaceURI>http://myapp.com</namespaceURI>

</package-mapping>


</java-wsdl-mapping>



------------------ 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'>


<typeMapping

qname="myNS:Order"

xmlns:myNS="urn:BeanService"

serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'

deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'

type="java:com.myapp.Order"

encodingStyle=''

/>

<typeMapping

qname="myNS:OrderOwner"

xmlns:myNS="urn:BeanService"

serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'

deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'

type="java:com.myapp.OrderOwner"

encodingStyle=''

/>

</deployment>



---------------------- generated by Java2WSDL file
..wsdl --------------------


<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions targetNamespace="http://myapp.com"
xmlns:impl="http://myapp.com" xmlns:intf="http://myapp.com"
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:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">

<wsdl:types>

<schema xmlns="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://myapp.com">

<import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>

<complexType name="SimpleOrder">

<sequence>

<element name="orderName" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

<complexType name="OrderOwner">

<sequence>

<element name="name" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

<complexType name="ArrayOfOrderOwner">

<complexContent>

<restriction base="soapenc:Array">

<attribute ref="soapenc:arrayType"
wsdl:arrayType="impl:OrderOwner[]"/>

</restriction>

</complexContent>

</complexType>

<complexType name="Order">

<complexContent>

<extension base="impl:SimpleOrder">

<sequence>

<element name="customerName" nillable="true" type="xsd:string"/>

<element name="owner" nillable="true" type="impl:ArrayOfOrderOwner"/>

<element name="shippingAddress" nillable="true" type="xsd:string"/>

</sequence>

</extension>

</complexContent>

</complexType>

<complexType name="ArrayOfOrder">

<complexContent>

<restriction base="soapenc:Array">

<attribute ref="soapenc:arrayType" wsdl:arrayType="impl:Order[]"/>

</restriction>

</complexContent>

</complexType>

</schema>

</wsdl:types>



<wsdl:message name="processOrderRequest">



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



</wsdl:message>



<wsdl:message name="processOrderResponse">



<wsdl:part name="processOrderReturn" type="impl:Order"/>



</wsdl:message>



<wsdl:portType name="BeanService">



<wsdl:eek:peration name="processOrder" parameterOrder="in0">



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



<wsdl:eek:utput name="processOrderResponse"
message="impl:processOrderResponse"/>



</wsdl:eek:peration>



</wsdl:portType>



<wsdl:binding name="BeanServiceSoapBinding" type="impl:BeanService">



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



<wsdl:eek:peration name="processOrder">



<wsdlsoap:eek:peration soapAction=""/>



<wsdl:input name="processOrderRequest">



<wsdlsoap:body use="literal" namespace="http://myapp.com"/>



</wsdl:input>



<wsdl:eek:utput name="processOrderResponse">



<wsdlsoap:body use="literal" namespace="http://myapp.com"/>



</wsdl:eek:utput>



</wsdl:eek:peration>



</wsdl:binding>



<wsdl:service name="BeanServiceService">



<wsdl:port name="BeanService" binding="impl:BeanServiceSoapBinding">



<wsdlsoap:address
location="http://localhost:8080/ws4ee/services/BeanService"/>



</wsdl:port>



</wsdl:service>



</wsdl:definitions>



---------------------------------------------------------------


--

--
Krzysztof Stasiak
mailto:[email protected]
gg: 260845


===========================================
 
Ad

Advertisements

C

chomiq

It is posible that problem is in diferent version of Axis?

In webService I use Axis library included in JBoss ( I thing it is
C:\JBoss-4.0.0\server\detault\deploy\ .sar\axis-ws2ee.jar ) ,

In client I use Axis from other library from C:\axis\lib\axis.jar ( it is
version 1.2RC2 ).

How to check the versions in JBoss??

How to use the same library? I can not import axis-ws4ee.jar into client, it
doesn't works.



--
Krzysztof Stasiak
mailto:[email protected]
gg: 260845


===========================================
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top