You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Niklas Wirstrom <ni...@sics.se> on 2008/05/29 09:19:21 UTC
Arguments of class Object in POJOs
Hi,
I have a POJO service that I have decided to move from Axis1 to Axis2. I
have, however run in to some problems: Methods taking arguments of class
java.lang.Object (and arrays of that class), receive a
javax.activation.DataHandler object instead of the "real" object. Other
methods that takes other kinds of arguments work fine.
Is there a way to fix this problem without changing the code on the server?
This is how I have done:
I deploy the service. I generate client the stub using Axis2's
wsdl2java, and the wsdl file created by Axis2. I call the method (that
takes an Object argument) with an argument of class java.lang.String.
The service receives the DataHandler object.
Please help
/Niklas
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Arguments of class Object in POJOs
Posted by Niklas Wirstrom <ni...@sics.se>.
Yes, the client stub takes the correct parameters, but the object
received on the server is a DataHandler. If you call your service (e.g.
with a String) what class does the object o have?
( I am familiar with the use of DataHandlers for binary data, and that
works fine for me)
/Niklas
Paul Fremantle wrote:
> Niklas
>
> The DataHandler type is used for binary data (it efficiently supports
> large data), so I'm surprised that the data is being bound to that.
>
> There must be more to what you are telling us :) The reason I say this
> is because if you take a simple POJO:
>
> class Pojo {
> public Object hello(Object o) {
> return o;
> }
> }
>
> and deploy in Axis2, and then run WSDL2Java against the generated
> WSDL, you get this client stub:
>
> public java.lang.Object hello(java.lang.Object param01)
>
> Which I think is the behaviour you want.
>
> Paul
>
>
> On Thu, May 29, 2008 at 8:19 AM, Niklas Wirstrom <ni...@sics.se> wrote:
>
>> Hi,
>> I have a POJO service that I have decided to move from Axis1 to Axis2. I
>> have, however run in to some problems: Methods taking arguments of class
>> java.lang.Object (and arrays of that class), receive a
>> javax.activation.DataHandler object instead of the "real" object. Other
>> methods that takes other kinds of arguments work fine.
>>
>> Is there a way to fix this problem without changing the code on the server?
>>
>> This is how I have done:
>> I deploy the service. I generate client the stub using Axis2's wsdl2java,
>> and the wsdl file created by Axis2. I call the method (that takes an Object
>> argument) with an argument of class java.lang.String. The service receives
>> the DataHandler object.
>>
>> Please help
>> /Niklas
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-user-help@ws.apache.org
>>
>>
>>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Arguments of class Object in POJOs
Posted by Paul Fremantle <pz...@gmail.com>.
Niklas
The DataHandler type is used for binary data (it efficiently supports
large data), so I'm surprised that the data is being bound to that.
There must be more to what you are telling us :) The reason I say this
is because if you take a simple POJO:
class Pojo {
public Object hello(Object o) {
return o;
}
}
and deploy in Axis2, and then run WSDL2Java against the generated
WSDL, you get this client stub:
public java.lang.Object hello(java.lang.Object param01)
Which I think is the behaviour you want.
Paul
On Thu, May 29, 2008 at 8:19 AM, Niklas Wirstrom <ni...@sics.se> wrote:
> Hi,
> I have a POJO service that I have decided to move from Axis1 to Axis2. I
> have, however run in to some problems: Methods taking arguments of class
> java.lang.Object (and arrays of that class), receive a
> javax.activation.DataHandler object instead of the "real" object. Other
> methods that takes other kinds of arguments work fine.
>
> Is there a way to fix this problem without changing the code on the server?
>
> This is how I have done:
> I deploy the service. I generate client the stub using Axis2's wsdl2java,
> and the wsdl file created by Axis2. I call the method (that takes an Object
> argument) with an argument of class java.lang.String. The service receives
> the DataHandler object.
>
> Please help
> /Niklas
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
--
Paul Fremantle
Co-Founder and CTO, WSO2
Apache Synapse PMC Chair
OASIS WS-RX TC Co-chair
blog: http://pzf.fremantle.org
paul@wso2.com
"Oxygenating the Web Service Platform", www.wso2.com
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org