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 Shyamal Shah <sh...@gmail.com> on 2007/01/16 00:47:49 UTC

Consuming Web Service that returns object - blank object problem

Hi,
   I am consuming a web service in a client. I have two methods one that
returns back an xml string and another one that returns the object. When I
call the method that returns xml back it works fine as expected. In case of
calling method that returns object, it returns blank object. Is there
anything I am doing wrong in the client code? Could anyone please advise if
I am missing something obvious? Below is my client code :

        Service service = new Service();
        Call call = (Call) service.createCall();
        call.setTargetEndpointAddress(new
java.net.URL("http://localhost:8080/axis2/services/CustomerInformationWS?wsdl
"));

        String custId = "999";
        String maSrNo = "555";
            call.setOperationName(new QName("
http://businessobject.o2c.adt.com/xsd", "getCustomerTO"));
        call.addParameter ("custId", org.apache.axis.encoding
.XMLType.XSD_INT,
javax.xml.rpc.ParameterMode.IN<http://javax.xml.rpc.parametermode.in/>
);
        call.addParameter("maSrNo", org.apache.axis.encoding.XMLType.XSD_INT
, javax.xml.rpc.ParameterMode.IN <http://javax.xml.rpc.parametermode.in/>);
        QName qnm = new QName("
http://transferobject.o2c.adt.com/xsd)<http://transferobject.o2c.adt.com/xsd%29>",
"getCustomerTO");
        call.registerTypeMapping (CustInfoTO.class, qnm, new
org.apache.axis.encoding.ser.BeanSerializerFactory (CustInfoTO.class, qnm),
new org.apache.axis.encoding.ser.BeanDeserializerFactory(CustInfoTO.class,
qnm));
        call.setReturnType(new QName("http://transferobject.o2c.adt.com/xsd)
<http://transferobject.o2c.adt.com/xsd%29>", "getCustomerTO"));
        CustInfoTO result = (CustInfoTO) call.invoke(new Object[] { custId,
maSrNo });
        System.out.println("Result is " + result.getCCVL_CU_NO());
//////////all the attributes in the object are set to null or 0 and not what
I expect in the object.


    I will appreciate any help/suggestion on this.

Thanks,
Shyam

Re: Consuming Web Service that returns object - blank object problem

Posted by Anne Thomas Manes <at...@gmail.com>.
Please post the WSDL for the service.

On 1/15/07, Shyamal Shah <sh...@gmail.com> wrote:
> Hi,
>    I am consuming a web service in a client. I have two methods one that
> returns back an xml string and another one that returns the object. When I
> call the method that returns xml back it works fine as expected. In case of
> calling method that returns object, it returns blank object. Is there
> anything I am doing wrong in the client code? Could anyone please advise if
> I am missing something obvious? Below is my client code :
>
>         Service service = new Service();
>         Call call = (Call) service.createCall();
>         call.setTargetEndpointAddress(new java.net.URL("
> http://localhost:8080/axis2/services/CustomerInformationWS?wsdl"));
>
>         String custId = "999";
>         String maSrNo = "555";
>             call.setOperationName(new QName("
> http://businessobject.o2c.adt.com/xsd", "getCustomerTO"));
>         call.addParameter ("custId", org.apache.axis.encoding
> .XMLType.XSD_INT, javax.xml.rpc.ParameterMode.IN);
>         call.addParameter("maSrNo",
> org.apache.axis.encoding.XMLType.XSD_INT,
> javax.xml.rpc.ParameterMode.IN);
>         QName qnm = new QName("
> http://transferobject.o2c.adt.com/xsd)", "getCustomerTO");
>         call.registerTypeMapping (CustInfoTO.class, qnm, new
> org.apache.axis.encoding.ser.BeanSerializerFactory
> (CustInfoTO.class, qnm), new
> org.apache.axis.encoding.ser.BeanDeserializerFactory(CustInfoTO.class,
> qnm));
>         call.setReturnType(new QName("
> http://transferobject.o2c.adt.com/xsd) ",
> "getCustomerTO"));
>         CustInfoTO result = (CustInfoTO) call.invoke(new Object[] { custId,
> maSrNo });
>         System.out.println("Result is " + result.getCCVL_CU_NO());
> //////////all the attributes in the object are set to null or 0 and not what
> I expect in the object.
>
>
>     I will appreciate any help/suggestion on this.
>
> Thanks,
> Shyam

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org