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 Mauro Molinari <ma...@cardinis.com> on 2007/11/12 10:28:19 UTC

Custom message receivers vs RPCMessageReceiver

Hello all!
I have a question about message receivers.

Suppose I have a WSDL with just an in & out operation, whose input and 
output parameters eventually are simple types.

Suppose I want to generate the Java code using WSDL2Java, with the 
unwrapping option (-uw).

For the server-side, WSDL2Java creates a specialized message receiver 
for the service. But, as long as I understood it correctly, because of 
the fact that the only operation in the service uses simple types 
(strings, ints, etc.), I should be able to use an RPCMessageReceiver... 
at last, this is what I find in services.xml if I write equivalent code 
and follow the POJO guide in Axis2 documentation...

So, am I correct? Is there any advantage or drawback on using 
RPCMessageReceiver when working with operations with just simple types 
involved instead of the "customized" message receivers generated by 
WSDL2Java?

Thanks in advance.

-- 
Mauro Molinari
Software Developer
mauro.molinari@cardinis.com

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


Re: Custom message receivers vs RPCMessageReceiver

Posted by Amila Suriarachchi <am...@gmail.com>.
On Nov 12, 2007 4:06 PM, Mauro Molinari <ma...@cardinis.com> wrote:
> Amila Suriarachchi ha scritto:
> > hi,
> >
> > I think this is a confusion lot of people made.
> >
> > when developing web services there are two mehtods.
> > 1. contract first approach.
> >       here you start with the wsdl file (contract ) and use the
> > wsdl2java to generte the code. so it generates a
> >       custom message receiver for you.
> > 2. code first approach.
> >        here you start with code and axis2 generates a wsdl for you.
> > here you must use the RPCMessageReceiver.
> >
> > when developing a service you have to choose one. and you can not use
> > RPCMessageReceiver with the generated code.
> >
> > thanks,
> > Amila.
>
> Hi Amila,
> yes, this is clear. But suppose that I follow a mixed approach:
> 1) I (manually) write the WSDL
> 2) I (manually) write the Java code that implements the service on the
> server, as a POJO, respecting the interface defined in the WSDL (so: a
> method for each operation, with the same name; method signatures
> coherent with the messages defined in the WSDL for each operation and so on)
> 3) I (manually) write a services.xml that declares my Java code as the
> service class and that states to use RPCMessageReceiver

if you have done the wsdl and message receiver mapping correctly. it
should work.
RPCMessageReceiver is also another message receiver.

thanks,
Amila.
>
> This should work, shouldn't it?
>
> The benefits of this approach I can think of are:
> - I do not have to care about WSDL2Java problems like the missing
> unwrapping of elements corresponding to empty types
> - I do not have to manage any (useless?) custom message receivers
> - I should have total control over both the WSDL and the Java code,
> while keeping the implementation simple and straightforward
>
> The only drawback I can think of is that it could become quite hard to
> manage services that exchange complex types (e.g.: Java beans) by using
> this approach. In that case, using a custom message receiver may be
> compulsory...
>
> Do I have understood it correctly? Or do you think I'm missing something
> else?
>
>
> Thanks in advance!
>
> --
> Mauro Molinari
> Software Developer
> mauro.molinari@cardinis.com
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>



-- 
Amila Suriarachchi,
WSO2 Inc.

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


Re: Custom message receivers vs RPCMessageReceiver

Posted by Mauro Molinari <ma...@cardinis.com>.
Amila Suriarachchi ha scritto:
> hi,
> 
> I think this is a confusion lot of people made.
> 
> when developing web services there are two mehtods.
> 1. contract first approach.
>       here you start with the wsdl file (contract ) and use the
> wsdl2java to generte the code. so it generates a
>       custom message receiver for you.
> 2. code first approach.
>        here you start with code and axis2 generates a wsdl for you.
> here you must use the RPCMessageReceiver.
> 
> when developing a service you have to choose one. and you can not use
> RPCMessageReceiver with the generated code.
> 
> thanks,
> Amila.

Hi Amila,
yes, this is clear. But suppose that I follow a mixed approach:
1) I (manually) write the WSDL
2) I (manually) write the Java code that implements the service on the 
server, as a POJO, respecting the interface defined in the WSDL (so: a 
method for each operation, with the same name; method signatures 
coherent with the messages defined in the WSDL for each operation and so on)
3) I (manually) write a services.xml that declares my Java code as the 
service class and that states to use RPCMessageReceiver

This should work, shouldn't it?

The benefits of this approach I can think of are:
- I do not have to care about WSDL2Java problems like the missing 
unwrapping of elements corresponding to empty types
- I do not have to manage any (useless?) custom message receivers
- I should have total control over both the WSDL and the Java code, 
while keeping the implementation simple and straightforward

The only drawback I can think of is that it could become quite hard to 
manage services that exchange complex types (e.g.: Java beans) by using 
this approach. In that case, using a custom message receiver may be 
compulsory...

Do I have understood it correctly? Or do you think I'm missing something 
else?

Thanks in advance!

-- 
Mauro Molinari
Software Developer
mauro.molinari@cardinis.com


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


Re: Custom message receivers vs RPCMessageReceiver

Posted by Amila Suriarachchi <am...@gmail.com>.
hi,

I think this is a confusion lot of people made.

when developing web services there are two mehtods.
1. contract first approach.
      here you start with the wsdl file (contract ) and use the
wsdl2java to generte the code. so it generates a
      custom message receiver for you.
2. code first approach.
       here you start with code and axis2 generates a wsdl for you.
here you must use the RPCMessageReceiver.

when developing a service you have to choose one. and you can not use
RPCMessageReceiver with the generated code.

thanks,
Amila.


On Nov 12, 2007 2:58 PM, Mauro Molinari <ma...@cardinis.com> wrote:
> Hello all!
> I have a question about message receivers.
>
> Suppose I have a WSDL with just an in & out operation, whose input and
> output parameters eventually are simple types.
>
> Suppose I want to generate the Java code using WSDL2Java, with the
> unwrapping option (-uw).
>
> For the server-side, WSDL2Java creates a specialized message receiver
> for the service. But, as long as I understood it correctly, because of
> the fact that the only operation in the service uses simple types
> (strings, ints, etc.), I should be able to use an RPCMessageReceiver...
> at last, this is what I find in services.xml if I write equivalent code
> and follow the POJO guide in Axis2 documentation...
>
> So, am I correct? Is there any advantage or drawback on using
> RPCMessageReceiver when working with operations with just simple types
> involved instead of the "customized" message receivers generated by
> WSDL2Java?
>
> Thanks in advance.
>
> --
> Mauro Molinari
> Software Developer
> mauro.molinari@cardinis.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>



-- 
Amila Suriarachchi,
WSO2 Inc.

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