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 Ambekar Venu <ve...@siemens.com> on 2003/09/18 17:18:05 UTC

Usage of ParameterMode.OUT with Call.invoke()

Guys,

I am having issues to retrieve the output
parameters(ParameterMode.OUT/ParameterMode.INOUT) after calling invoke
().

Appreciate if anyone can tell me what I am doing wrong or point me to a
sample code.

Thanks a ton,
Venu.



My code looks as follows:

       Service  service = new Service();
       Call     perCall    = (Call) service.createCall();
       QName    personqn      = new QName( "urn:DBInsertService", "Person"
);

       perCall.registerTypeMapping(Person.class, personqn,
                     new
org.apache.axis.encoding.ser.BeanSerializerFactory(Person.class, personqn),
                     new
org.apache.axis.encoding.ser.BeanDeserializerFactory(Person.class,
personqn));

       perCall.setTargetEndpointAddress( new java.net.URL(endpoint) );
       perCall.setOperationName( new QName("DBInsertService", "insertPerson"
) );
       perCall.addParameter( "person", personqn, ParameterMode.IN );
       perCall.addParameter( "serviceTimes", XMLType.XSD_STRING,
ParameterMode.OUT );
       perCall.setReturnType( XMLType.XSD_BOOLEAN );            // set
return type

      Person dbP = new Person();
      String str = null;     // also tried with new, the result was that
there was no value.

      //   This method sets the result to str;
      boolean l_result = ((Boolean)perCall.invoke(new Object[] {dbP,
str})).booleanValue();

      System.out.println("Output: " + str);    // this line showed up str as
null.

_____________________________________________________
SIEMENS		Medical Solutions - Health Services
Venu Ambekar
Software Engineer, DC6 - Architecture
51 Valley Stream Parkway, Malvern, PA, 19355-1406
Phone:                 		+01 610 219 7982
Fax:                     		+01 610 219 8470
E-Mail:                 		 venu.Ambekar@siemens.com
_______________________________________________________



-------------------------------------------------------------------------------
This message and any included attachments are from Siemens Medical Solutions 
USA, Inc. and are intended only for the addressee(s).  
The information contained herein may include trade secrets or privileged or 
otherwise confidential information.  Unauthorized review, forwarding, printing, 
copying, distributing, or using such information is strictly prohibited and may 
be unlawful.  If you received this message in error, or have reason to believe 
you are not authorized to receive it, please promptly delete this message and 
notify the sender by e-mail with a copy to CSOffice@smed.com.  Thank you

Re: Usage of ParameterMode.OUT with Call.invoke()

Posted by jk...@opensource.lk.
Hi Venu,
I have bit confused with your question. What is the error you exactly get?.
If the string value is null that seems it is correct. Because you set the
String as null and it is an OUT parameter.

Actually the OUT parameter means, in wsdl If a part name appears in only
the output message, it is an out parameter. You check your wsdl whether
the String is an OUT parameter or not.(You can check it in the part
name.If it only occurs in the out message then only it will be a OUT
parameter).

I think it is right when it is an OUT parameter.(String is null). You
better set a value to that String and check it whether it works.

Hope it would help you a bit.
regards,
Jeyakumaran
> Guys,
>
> I am having issues to retrieve the output
> parameters(ParameterMode.OUT/ParameterMode.INOUT) after calling invoke
> ().
>
> Appreciate if anyone can tell me what I am doing wrong or point me to a
> sample code.
>
> Thanks a ton,
> Venu.
>
>
>
> My code looks as follows:
>
>        Service  service = new Service();
>        Call     perCall    = (Call) service.createCall();
>        QName    personqn      = new QName( "urn:DBInsertService",
> "Person"
> );
>
>        perCall.registerTypeMapping(Person.class, personqn,
>                      new
> org.apache.axis.encoding.ser.BeanSerializerFactory(Person.class,
> personqn),
>                      new
> org.apache.axis.encoding.ser.BeanDeserializerFactory(Person.class,
> personqn));
>
>        perCall.setTargetEndpointAddress( new java.net.URL(endpoint) );
> perCall.setOperationName( new QName("DBInsertService",
> "insertPerson"
> ) );
>        perCall.addParameter( "person", personqn, ParameterMode.IN );
> perCall.addParameter( "serviceTimes", XMLType.XSD_STRING,
> ParameterMode.OUT );
>        perCall.setReturnType( XMLType.XSD_BOOLEAN );            // set
> return type
>
>       Person dbP = new Person();
>       String str = null;     // also tried with new, the result was that
> there was no value.
>
>       //   This method sets the result to str;
>       boolean l_result = ((Boolean)perCall.invoke(new Object[] {dbP,
> str})).booleanValue();
>
>       System.out.println("Output: " + str);    // this line showed up
> str as
> null.
>
> _____________________________________________________
> SIEMENS		Medical Solutions - Health Services
> Venu Ambekar
> Software Engineer, DC6 - Architecture
> 51 Valley Stream Parkway, Malvern, PA, 19355-1406
> Phone:                 		+01 610 219 7982
> Fax:                     		+01 610 219 8470
> E-Mail:                 		 venu.Ambekar@siemens.com
> _______________________________________________________
>
>
>
> -------------------------------------------------------------------------------
> This message and any included attachments are from Siemens Medical
> Solutions  USA, Inc. and are intended only for the addressee(s).
> The information contained herein may include trade secrets or privileged
> or  otherwise confidential information.  Unauthorized review,
> forwarding, printing,  copying, distributing, or using such information
> is strictly prohibited and may  be unlawful.  If you received this
> message in error, or have reason to believe  you are not authorized to
> receive it, please promptly delete this message and  notify the sender
> by e-mail with a copy to CSOffice@smed.com.  Thank you