You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by goelshek <go...@yahoo.com> on 2009/03/20 22:49:11 UTC

CXF @Oneway annotation

I need to implement a web service with a method that allows one way transport
only. I started by implementing a CXF web service with a two way method and
tested it using a CXF client. Then I created a .NET web service with a two
way method and tested it using the same CXF client. Everything went
smoothly.

Then I changed my .NET web service to not return anything and added an
annotation of OneWay=true. Now the .NET web service has a one way method
that works as it is supposed to. I figured changing CXF would be similarly
easy. However, even after I have removed the return type for my method and
added a @Oneway annotation right before the @WebMethod annotation, my client
still waits for the CXF server to finish execution.

The @Oneway annotation was added to the SEI and a new WSDL was generated
using that SEI. As a result, my operation in the WSDL now only has an input
element and no output element. So clearly CXF is aware of the @Oneway
annotation since the WSDL is correct.

I realize this was a bug prior to CXF 2.1.4. I have used both CXF 2.1.5 and
2.2 to no avail.

I tested wsdl_first and in CXF samples and everything there works fine. The
server relinquishes control as soon as it is invoked. So I tried to copy the
sample's working, but the SEI there is Greeter which seems to be in a jar.
To find the Greeter SEI, I downloaded CXF source. I found the interface, but
it did not have the greetMeOneWay method in it. That method was found in
binding2.xml and binding3.xml. It seems to me that the greetMeOneWay method
is defined dynamically by spring somehow. I am confused as to why things are
getting this complicated. To change a two way method into a one way method,
shouldn't I simply be able to change the method signature in SEI and its
Impl, add an @Oneway annotation, change my WSDL, and everything should work.

Either I am doing something ridiculously stupid or I just don't understand
how to implement oneway methods in CXF.

Can someone please guide me in the right direction? Any help is much
appreciated.

Thanks.
-- 
View this message in context: http://www.nabble.com/CXF-%40Oneway-annotation-tp22629459p22629459.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF @Oneway annotation

Posted by Daniel Kulp <dk...@apache.org>.
On Tue March 24 2009 10:14:40 am goelshek wrote:
> Added the bug to CXF Jira and also added the source code - simply a
> modified version of samples/java_first_jaxws.

Thanks for that.  This is now fixed in lastnight's snapshots.

Dan


>
> Thanks.
>
> dkulp wrote:
> > On Tue March 24 2009 9:15:46 am goelshek wrote:
> >> So, another colleague confirmed that using a parameter style of BARE
> >> doesn't work with Oneway. The elements seem to need to be of complex
> >> type.
> >> I haven't been able to find any theory behind why this must be so. Is it
> >> possible that this is a CXF bug?
> >
> > That definitely sounds like a bug.   Could you package up your test case
> > and
> > attach it to a jira?
> >
> > Thanks!
> > Dan
> >
> >> dkulp wrote:
> >> > The "java_first_pojo" sample uses the "simple" frontend and Aegis.
> >>
> >> It
> >>
> >> > would
> >> > have no idea  how to process the @Oneway annotation.   That's a jaxws
> >> > frontend
> >> > annotation.
> >> >
> >> > Try playing with the java_first_jaxws sample.  That's jaxws and thus
> >> > should
> >> > honor it.
> >> >
> >> > Dan
> >> >
> >> > On Mon March 23 2009 11:20:21 am goelshek wrote:
> >> >> Bryan Kearney wrote:
> >> >> > goelshek wrote:
> >> >> >> Bryan Kearney wrote:
> >> >> >>> goelshek wrote:
> >> >> >>>> I need to implement a web service with a method that allows one
> >>
> >> way
> >>
> >> >> >>>> transport
> >> >> >>>> only. I started by implementing a CXF web service with a two way
> >> >> >>>> method and
> >> >> >>>> tested it using a CXF client. Then I created a .NET web service
> >> >> >>>> with
> >> >>
> >> >> a
> >> >>
> >> >> >>>> two
> >> >> >>>> way method and tested it using the same CXF client. Everything
> >>
> >> went
> >>
> >> >> >>>> smoothly.
> >> >> >>>>
> >> >> >>>> Then I changed my .NET web service to not return anything and
> >>
> >> added
> >>
> >> >> an
> >> >>
> >> >> >>>> annotation of OneWay=true. Now the .NET web service has a one
> >> >> >>>> way method
> >> >> >>>> that works as it is supposed to. I figured changing CXF would be
> >> >> >>>> similarly
> >> >> >>>> easy. However, even after I have removed the return type for my
> >> >>
> >> >> method
> >> >>
> >> >> >>>> and
> >> >> >>>> added a @Oneway annotation right before the @WebMethod
> >>
> >> annotation,
> >>
> >> >> my
> >> >>
> >> >> >>>> client
> >> >> >>>> still waits for the CXF server to finish execution.
> >> >> >>>>
> >> >> >>>> The @Oneway annotation was added to the SEI and a new WSDL was
> >> >> >>>> generated
> >> >> >>>> using that SEI. As a result, my operation in the WSDL now only
> >>
> >> has
> >>
> >> >> an
> >> >>
> >> >> >>>> input
> >> >> >>>> element and no output element. So clearly CXF is aware of the
> >> >>
> >> >> @Oneway
> >> >>
> >> >> >>>> annotation since the WSDL is correct.
> >> >> >>>>
> >> >> >>>> I realize this was a bug prior to CXF 2.1.4. I have used both
> >> >> >>>> CXF 2.1.5 and
> >> >> >>>> 2.2 to no avail.
> >> >> >>>>
> >> >> >>>> I tested wsdl_first and in CXF samples and everything there
> >> >> >>>> works fine. The
> >> >> >>>> server relinquishes control as soon as it is invoked. So I tried
> >>
> >> to
> >>
> >> >> >>>> copy
> >> >> >>>> the
> >> >> >>>> sample's working, but the SEI there is Greeter which seems to be
> >>
> >> in
> >>
> >> >> a
> >> >>
> >> >> >>>> jar.
> >> >> >>>> To find the Greeter SEI, I downloaded CXF source. I found the
> >> >> >>>> interface,
> >> >> >>>> but
> >> >> >>>> it did not have the greetMeOneWay method in it. That method was
> >> >>
> >> >> found
> >> >>
> >> >> >>>> in
> >> >> >>>> binding2.xml and binding3.xml. It seems to me that the
> >> >> >>>> greetMeOneWay method
> >> >> >>>> is defined dynamically by spring somehow. I am confused as to
> >> >> >>>> why things
> >> >> >>>> are
> >> >> >>>> getting this complicated. To change a two way method into a one
> >>
> >> way
> >>
> >> >> >>>> method,
> >> >> >>>> shouldn't I simply be able to change the method signature in SEI
> >> >> >>>> and its
> >> >> >>>> Impl, add an @Oneway annotation, change my WSDL, and everything
> >> >>
> >> >> should
> >> >>
> >> >> >>>> work.
> >> >> >>>>
> >> >> >>>> Either I am doing something ridiculously stupid or I just don't
> >> >> >>>> understand
> >> >> >>>> how to implement oneway methods in CXF.
> >> >> >>>>
> >> >> >>>> Can someone please guide me in the right direction? Any help is
> >> >> >>>> much appreciated.
> >> >> >>>>
> >> >> >>>> Thanks.
> >> >> >>>
> >> >> >>> Are you using WS-Addressing or WSRM?
> >> >> >>>
> >> >> >>> -- bk
> >> >> >>
> >> >> >> AFAIK, neither. I guess whatever CXF sets up as the default. I
> >>
> >> don't
> >>
> >> >> >> even have a configuration file. All I have are the source files
> >>
> >> from
> >>
> >> >> >> wsdl_first
> >> >> >> sample. And since that sample did not have the Greeter interface,
> >> >> >> I simply
> >> >> >> created my own Greeter interface which looks as follows:
> >> >> >>
> >> >> >> @WebService(targetNamespace =
> >> >>
> >> >> "http://apache.org/hello_world_soap_http",
> >> >>
> >> >> >> name = "SOAPService", portName = "SOAPService")
> >> >> >> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> >> >> >> public interface Greeter
> >> >> >> {
> >> >> >>     @Oneway
> >> >> >>     @WebMethod
> >> >> >>     public abstract void greetMeOneWay(@WebParam(name = "param")
> >> >>
> >> >> String
> >> >>
> >> >> >> param);
> >> >> >> }
> >> >> >
> >> >> > I started with a java class which looks like yours (well... not
> >> >> > abtract and @WebMethod comes first), generated the WSDL from it,
> >> >> > and then
> >> >>
> >> >> pulled
> >> >>
> >> >> > it into a client and it works fine. Can you test Java first?
> >> >> >
> >> >> > -- bk
> >> >>
> >> >> So what I did is used the sample in
> >> >> apache-cxf-2.2/samples/java_first_pojo.
> >> >> Without doing anything, I started the server and client and just did
> >> >> a quick call. Of course things worked fine. Then I created a new
> >> >> method sayHiOneWay, which looks as follows in the interface:
> >> >>     void sayHiOneWay(String text);
> >> >> and following in HelloWorldImpl:
> >> >>     public void sayHiOneWay(String text)
> >> >>     {
> >> >>         System.out.println("sayHiOneWay called");
> >> >>         System.out.println("sleeping for 10 secs");
> >> >>         try { Thread.sleep(10000); }
> >> >>         catch (InterruptedException e) { e.printStackTrace(); }
> >> >> 		System.out.println("woke up after 10 secs");
> >> >>         System.out.println("accepted: " + text);
> >> >>     }
> >> >> I changed my client and added the following right before
> >>
> >> System.exit(0):
> >> >>         System.out.println("Invoke sayHiOneWay()....");
> >> >>         long startTime = System.currentTimeMillis();
> >> >>         client.sayHiOneWay(System.getProperty("user.name"));
> >> >>         System.out.println("Time taken to call sayHiOneWay(): " +
> >> >> (System.currentTimeMillis()-startTime) + " ms");
> >> >>
> >> >> Now when I start the server and look at the wsdl, the sayHiOneWay
> >> >> operation
> >> >> looks as follows:
> >> >> <wsdl:operation name="sayHiOneWay">
> >> >> <wsdl:input message="tns:sayHiOneWay" name="sayHiOneWay">
> >> >>     </wsdl:input>
> >> >> <wsdl:output message="tns:sayHiOneWayResponse"
> >> >> name="sayHiOneWayResponse">
> >> >>     </wsdl:output>
> >> >> </wsdl:operation>
> >> >> From what I've read, a one way method must not contain the output
> >> >> element.
> >> >> So quite obviously, just creating a void method does not really make
> >>
> >> the
> >>
> >> >> method one way. So I added the @Oneway annotation on right before the
> >> >> method in both the interface and the impl. Then I ran the server and
> >> >> observed the following two:
> >> >> 1. The wsdl still contains the output tag.
> >> >> 2. The client DOES wait for 10 secs for the method to finish.
> >> >>
> >> >> It seems like creating oneway methods is not simple. There seems to
> >> >> be more
> >> >> to it than simply making a method return void and adding a @Oneway
> >> >> annotation.
> >> >
> >> > --
> >> > Daniel Kulp
> >> > dkulp@apache.org
> >> > http://www.dankulp.com/blog
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: CXF @Oneway annotation

Posted by goelshek <go...@yahoo.com>.
Added the bug to CXF Jira and also added the source code - simply a modified
version of samples/java_first_jaxws.

Thanks.


dkulp wrote:
> 
> On Tue March 24 2009 9:15:46 am goelshek wrote:
>> So, another colleague confirmed that using a parameter style of BARE
>> doesn't work with Oneway. The elements seem to need to be of complex
>> type.
>> I haven't been able to find any theory behind why this must be so. Is it
>> possible that this is a CXF bug?
> 
> That definitely sounds like a bug.   Could you package up your test case
> and 
> attach it to a jira?
> 
> Thanks!
> Dan
> 
> 
>> dkulp wrote:
>> > The "java_first_pojo" sample uses the "simple" frontend and Aegis.   
>> It
>> > would
>> > have no idea  how to process the @Oneway annotation.   That's a jaxws
>> > frontend
>> > annotation.
>> >
>> > Try playing with the java_first_jaxws sample.  That's jaxws and thus
>> > should
>> > honor it.
>> >
>> > Dan
>> >
>> > On Mon March 23 2009 11:20:21 am goelshek wrote:
>> >> Bryan Kearney wrote:
>> >> > goelshek wrote:
>> >> >> Bryan Kearney wrote:
>> >> >>> goelshek wrote:
>> >> >>>> I need to implement a web service with a method that allows one
>> way
>> >> >>>> transport
>> >> >>>> only. I started by implementing a CXF web service with a two way
>> >> >>>> method and
>> >> >>>> tested it using a CXF client. Then I created a .NET web service
>> >> >>>> with
>> >>
>> >> a
>> >>
>> >> >>>> two
>> >> >>>> way method and tested it using the same CXF client. Everything
>> went
>> >> >>>> smoothly.
>> >> >>>>
>> >> >>>> Then I changed my .NET web service to not return anything and
>> added
>> >>
>> >> an
>> >>
>> >> >>>> annotation of OneWay=true. Now the .NET web service has a one way
>> >> >>>> method
>> >> >>>> that works as it is supposed to. I figured changing CXF would be
>> >> >>>> similarly
>> >> >>>> easy. However, even after I have removed the return type for my
>> >>
>> >> method
>> >>
>> >> >>>> and
>> >> >>>> added a @Oneway annotation right before the @WebMethod
>> annotation,
>> >>
>> >> my
>> >>
>> >> >>>> client
>> >> >>>> still waits for the CXF server to finish execution.
>> >> >>>>
>> >> >>>> The @Oneway annotation was added to the SEI and a new WSDL was
>> >> >>>> generated
>> >> >>>> using that SEI. As a result, my operation in the WSDL now only
>> has
>> >>
>> >> an
>> >>
>> >> >>>> input
>> >> >>>> element and no output element. So clearly CXF is aware of the
>> >>
>> >> @Oneway
>> >>
>> >> >>>> annotation since the WSDL is correct.
>> >> >>>>
>> >> >>>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF
>> >> >>>> 2.1.5 and
>> >> >>>> 2.2 to no avail.
>> >> >>>>
>> >> >>>> I tested wsdl_first and in CXF samples and everything there works
>> >> >>>> fine. The
>> >> >>>> server relinquishes control as soon as it is invoked. So I tried
>> to
>> >> >>>> copy
>> >> >>>> the
>> >> >>>> sample's working, but the SEI there is Greeter which seems to be
>> in
>> >>
>> >> a
>> >>
>> >> >>>> jar.
>> >> >>>> To find the Greeter SEI, I downloaded CXF source. I found the
>> >> >>>> interface,
>> >> >>>> but
>> >> >>>> it did not have the greetMeOneWay method in it. That method was
>> >>
>> >> found
>> >>
>> >> >>>> in
>> >> >>>> binding2.xml and binding3.xml. It seems to me that the
>> >> >>>> greetMeOneWay method
>> >> >>>> is defined dynamically by spring somehow. I am confused as to why
>> >> >>>> things
>> >> >>>> are
>> >> >>>> getting this complicated. To change a two way method into a one
>> way
>> >> >>>> method,
>> >> >>>> shouldn't I simply be able to change the method signature in SEI
>> >> >>>> and its
>> >> >>>> Impl, add an @Oneway annotation, change my WSDL, and everything
>> >>
>> >> should
>> >>
>> >> >>>> work.
>> >> >>>>
>> >> >>>> Either I am doing something ridiculously stupid or I just don't
>> >> >>>> understand
>> >> >>>> how to implement oneway methods in CXF.
>> >> >>>>
>> >> >>>> Can someone please guide me in the right direction? Any help is
>> >> >>>> much appreciated.
>> >> >>>>
>> >> >>>> Thanks.
>> >> >>>
>> >> >>> Are you using WS-Addressing or WSRM?
>> >> >>>
>> >> >>> -- bk
>> >> >>
>> >> >> AFAIK, neither. I guess whatever CXF sets up as the default. I
>> don't
>> >> >> even have a configuration file. All I have are the source files
>> from
>> >> >> wsdl_first
>> >> >> sample. And since that sample did not have the Greeter interface, I
>> >> >> simply
>> >> >> created my own Greeter interface which looks as follows:
>> >> >>
>> >> >> @WebService(targetNamespace =
>> >>
>> >> "http://apache.org/hello_world_soap_http",
>> >>
>> >> >> name = "SOAPService", portName = "SOAPService")
>> >> >> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>> >> >> public interface Greeter
>> >> >> {
>> >> >>     @Oneway
>> >> >>     @WebMethod
>> >> >>     public abstract void greetMeOneWay(@WebParam(name = "param")
>> >>
>> >> String
>> >>
>> >> >> param);
>> >> >> }
>> >> >
>> >> > I started with a java class which looks like yours (well... not
>> >> > abtract and @WebMethod comes first), generated the WSDL from it, and
>> >> > then
>> >>
>> >> pulled
>> >>
>> >> > it into a client and it works fine. Can you test Java first?
>> >> >
>> >> > -- bk
>> >>
>> >> So what I did is used the sample in
>> >> apache-cxf-2.2/samples/java_first_pojo.
>> >> Without doing anything, I started the server and client and just did a
>> >> quick call. Of course things worked fine. Then I created a new method
>> >> sayHiOneWay, which looks as follows in the interface:
>> >>     void sayHiOneWay(String text);
>> >> and following in HelloWorldImpl:
>> >>     public void sayHiOneWay(String text)
>> >>     {
>> >>         System.out.println("sayHiOneWay called");
>> >>         System.out.println("sleeping for 10 secs");
>> >>         try { Thread.sleep(10000); }
>> >>         catch (InterruptedException e) { e.printStackTrace(); }
>> >> 		System.out.println("woke up after 10 secs");
>> >>         System.out.println("accepted: " + text);
>> >>     }
>> >> I changed my client and added the following right before
>> System.exit(0):
>> >>         System.out.println("Invoke sayHiOneWay()....");
>> >>         long startTime = System.currentTimeMillis();
>> >>         client.sayHiOneWay(System.getProperty("user.name"));
>> >>         System.out.println("Time taken to call sayHiOneWay(): " +
>> >> (System.currentTimeMillis()-startTime) + " ms");
>> >>
>> >> Now when I start the server and look at the wsdl, the sayHiOneWay
>> >> operation
>> >> looks as follows:
>> >> <wsdl:operation name="sayHiOneWay">
>> >> <wsdl:input message="tns:sayHiOneWay" name="sayHiOneWay">
>> >>     </wsdl:input>
>> >> <wsdl:output message="tns:sayHiOneWayResponse"
>> >> name="sayHiOneWayResponse">
>> >>     </wsdl:output>
>> >> </wsdl:operation>
>> >> From what I've read, a one way method must not contain the output
>> >> element.
>> >> So quite obviously, just creating a void method does not really make
>> the
>> >> method one way. So I added the @Oneway annotation on right before the
>> >> method in both the interface and the impl. Then I ran the server and
>> >> observed the following two:
>> >> 1. The wsdl still contains the output tag.
>> >> 2. The client DOES wait for 10 secs for the method to finish.
>> >>
>> >> It seems like creating oneway methods is not simple. There seems to be
>> >> more
>> >> to it than simply making a method return void and adding a @Oneway
>> >> annotation.
>> >
>> > --
>> > Daniel Kulp
>> > dkulp@apache.org
>> > http://www.dankulp.com/blog
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-%40Oneway-annotation-tp22629459p22681303.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF @Oneway annotation

Posted by Daniel Kulp <dk...@apache.org>.
On Tue March 24 2009 9:15:46 am goelshek wrote:
> So, another colleague confirmed that using a parameter style of BARE
> doesn't work with Oneway. The elements seem to need to be of complex type.
> I haven't been able to find any theory behind why this must be so. Is it
> possible that this is a CXF bug?

That definitely sounds like a bug.   Could you package up your test case and 
attach it to a jira?

Thanks!
Dan


> dkulp wrote:
> > The "java_first_pojo" sample uses the "simple" frontend and Aegis.    It
> > would
> > have no idea  how to process the @Oneway annotation.   That's a jaxws
> > frontend
> > annotation.
> >
> > Try playing with the java_first_jaxws sample.  That's jaxws and thus
> > should
> > honor it.
> >
> > Dan
> >
> > On Mon March 23 2009 11:20:21 am goelshek wrote:
> >> Bryan Kearney wrote:
> >> > goelshek wrote:
> >> >> Bryan Kearney wrote:
> >> >>> goelshek wrote:
> >> >>>> I need to implement a web service with a method that allows one way
> >> >>>> transport
> >> >>>> only. I started by implementing a CXF web service with a two way
> >> >>>> method and
> >> >>>> tested it using a CXF client. Then I created a .NET web service
> >> >>>> with
> >>
> >> a
> >>
> >> >>>> two
> >> >>>> way method and tested it using the same CXF client. Everything went
> >> >>>> smoothly.
> >> >>>>
> >> >>>> Then I changed my .NET web service to not return anything and added
> >>
> >> an
> >>
> >> >>>> annotation of OneWay=true. Now the .NET web service has a one way
> >> >>>> method
> >> >>>> that works as it is supposed to. I figured changing CXF would be
> >> >>>> similarly
> >> >>>> easy. However, even after I have removed the return type for my
> >>
> >> method
> >>
> >> >>>> and
> >> >>>> added a @Oneway annotation right before the @WebMethod annotation,
> >>
> >> my
> >>
> >> >>>> client
> >> >>>> still waits for the CXF server to finish execution.
> >> >>>>
> >> >>>> The @Oneway annotation was added to the SEI and a new WSDL was
> >> >>>> generated
> >> >>>> using that SEI. As a result, my operation in the WSDL now only has
> >>
> >> an
> >>
> >> >>>> input
> >> >>>> element and no output element. So clearly CXF is aware of the
> >>
> >> @Oneway
> >>
> >> >>>> annotation since the WSDL is correct.
> >> >>>>
> >> >>>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF
> >> >>>> 2.1.5 and
> >> >>>> 2.2 to no avail.
> >> >>>>
> >> >>>> I tested wsdl_first and in CXF samples and everything there works
> >> >>>> fine. The
> >> >>>> server relinquishes control as soon as it is invoked. So I tried to
> >> >>>> copy
> >> >>>> the
> >> >>>> sample's working, but the SEI there is Greeter which seems to be in
> >>
> >> a
> >>
> >> >>>> jar.
> >> >>>> To find the Greeter SEI, I downloaded CXF source. I found the
> >> >>>> interface,
> >> >>>> but
> >> >>>> it did not have the greetMeOneWay method in it. That method was
> >>
> >> found
> >>
> >> >>>> in
> >> >>>> binding2.xml and binding3.xml. It seems to me that the
> >> >>>> greetMeOneWay method
> >> >>>> is defined dynamically by spring somehow. I am confused as to why
> >> >>>> things
> >> >>>> are
> >> >>>> getting this complicated. To change a two way method into a one way
> >> >>>> method,
> >> >>>> shouldn't I simply be able to change the method signature in SEI
> >> >>>> and its
> >> >>>> Impl, add an @Oneway annotation, change my WSDL, and everything
> >>
> >> should
> >>
> >> >>>> work.
> >> >>>>
> >> >>>> Either I am doing something ridiculously stupid or I just don't
> >> >>>> understand
> >> >>>> how to implement oneway methods in CXF.
> >> >>>>
> >> >>>> Can someone please guide me in the right direction? Any help is
> >> >>>> much appreciated.
> >> >>>>
> >> >>>> Thanks.
> >> >>>
> >> >>> Are you using WS-Addressing or WSRM?
> >> >>>
> >> >>> -- bk
> >> >>
> >> >> AFAIK, neither. I guess whatever CXF sets up as the default. I don't
> >> >> even have a configuration file. All I have are the source files from
> >> >> wsdl_first
> >> >> sample. And since that sample did not have the Greeter interface, I
> >> >> simply
> >> >> created my own Greeter interface which looks as follows:
> >> >>
> >> >> @WebService(targetNamespace =
> >>
> >> "http://apache.org/hello_world_soap_http",
> >>
> >> >> name = "SOAPService", portName = "SOAPService")
> >> >> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> >> >> public interface Greeter
> >> >> {
> >> >>     @Oneway
> >> >>     @WebMethod
> >> >>     public abstract void greetMeOneWay(@WebParam(name = "param")
> >>
> >> String
> >>
> >> >> param);
> >> >> }
> >> >
> >> > I started with a java class which looks like yours (well... not
> >> > abtract and @WebMethod comes first), generated the WSDL from it, and
> >> > then
> >>
> >> pulled
> >>
> >> > it into a client and it works fine. Can you test Java first?
> >> >
> >> > -- bk
> >>
> >> So what I did is used the sample in
> >> apache-cxf-2.2/samples/java_first_pojo.
> >> Without doing anything, I started the server and client and just did a
> >> quick call. Of course things worked fine. Then I created a new method
> >> sayHiOneWay, which looks as follows in the interface:
> >>     void sayHiOneWay(String text);
> >> and following in HelloWorldImpl:
> >>     public void sayHiOneWay(String text)
> >>     {
> >>         System.out.println("sayHiOneWay called");
> >>         System.out.println("sleeping for 10 secs");
> >>         try { Thread.sleep(10000); }
> >>         catch (InterruptedException e) { e.printStackTrace(); }
> >> 		System.out.println("woke up after 10 secs");
> >>         System.out.println("accepted: " + text);
> >>     }
> >> I changed my client and added the following right before System.exit(0):
> >>         System.out.println("Invoke sayHiOneWay()....");
> >>         long startTime = System.currentTimeMillis();
> >>         client.sayHiOneWay(System.getProperty("user.name"));
> >>         System.out.println("Time taken to call sayHiOneWay(): " +
> >> (System.currentTimeMillis()-startTime) + " ms");
> >>
> >> Now when I start the server and look at the wsdl, the sayHiOneWay
> >> operation
> >> looks as follows:
> >> <wsdl:operation name="sayHiOneWay">
> >> <wsdl:input message="tns:sayHiOneWay" name="sayHiOneWay">
> >>     </wsdl:input>
> >> <wsdl:output message="tns:sayHiOneWayResponse"
> >> name="sayHiOneWayResponse">
> >>     </wsdl:output>
> >> </wsdl:operation>
> >> From what I've read, a one way method must not contain the output
> >> element.
> >> So quite obviously, just creating a void method does not really make the
> >> method one way. So I added the @Oneway annotation on right before the
> >> method in both the interface and the impl. Then I ran the server and
> >> observed the following two:
> >> 1. The wsdl still contains the output tag.
> >> 2. The client DOES wait for 10 secs for the method to finish.
> >>
> >> It seems like creating oneway methods is not simple. There seems to be
> >> more
> >> to it than simply making a method return void and adding a @Oneway
> >> annotation.
> >
> > --
> > Daniel Kulp
> > dkulp@apache.org
> > http://www.dankulp.com/blog

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: CXF @Oneway annotation

Posted by goelshek <go...@yahoo.com>.
So, another colleague confirmed that using a parameter style of BARE doesn't
work with Oneway. The elements seem to need to be of complex type. I haven't
been able to find any theory behind why this must be so. Is it possible that
this is a CXF bug?


dkulp wrote:
> 
> 
> The "java_first_pojo" sample uses the "simple" frontend and Aegis.    It
> would 
> have no idea  how to process the @Oneway annotation.   That's a jaxws
> frontend 
> annotation.  
> 
> Try playing with the java_first_jaxws sample.  That's jaxws and thus
> should 
> honor it.
> 
> Dan
> 
> 
> On Mon March 23 2009 11:20:21 am goelshek wrote:
>> Bryan Kearney wrote:
>> > goelshek wrote:
>> >> Bryan Kearney wrote:
>> >>> goelshek wrote:
>> >>>> I need to implement a web service with a method that allows one way
>> >>>> transport
>> >>>> only. I started by implementing a CXF web service with a two way
>> >>>> method and
>> >>>> tested it using a CXF client. Then I created a .NET web service with
>> a
>> >>>> two
>> >>>> way method and tested it using the same CXF client. Everything went
>> >>>> smoothly.
>> >>>>
>> >>>> Then I changed my .NET web service to not return anything and added
>> an
>> >>>> annotation of OneWay=true. Now the .NET web service has a one way
>> >>>> method
>> >>>> that works as it is supposed to. I figured changing CXF would be
>> >>>> similarly
>> >>>> easy. However, even after I have removed the return type for my
>> method
>> >>>> and
>> >>>> added a @Oneway annotation right before the @WebMethod annotation,
>> my
>> >>>> client
>> >>>> still waits for the CXF server to finish execution.
>> >>>>
>> >>>> The @Oneway annotation was added to the SEI and a new WSDL was
>> >>>> generated
>> >>>> using that SEI. As a result, my operation in the WSDL now only has
>> an
>> >>>> input
>> >>>> element and no output element. So clearly CXF is aware of the
>> @Oneway
>> >>>> annotation since the WSDL is correct.
>> >>>>
>> >>>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF
>> >>>> 2.1.5 and
>> >>>> 2.2 to no avail.
>> >>>>
>> >>>> I tested wsdl_first and in CXF samples and everything there works
>> >>>> fine. The
>> >>>> server relinquishes control as soon as it is invoked. So I tried to
>> >>>> copy
>> >>>> the
>> >>>> sample's working, but the SEI there is Greeter which seems to be in
>> a
>> >>>> jar.
>> >>>> To find the Greeter SEI, I downloaded CXF source. I found the
>> >>>> interface,
>> >>>> but
>> >>>> it did not have the greetMeOneWay method in it. That method was
>> found
>> >>>> in
>> >>>> binding2.xml and binding3.xml. It seems to me that the greetMeOneWay
>> >>>> method
>> >>>> is defined dynamically by spring somehow. I am confused as to why
>> >>>> things
>> >>>> are
>> >>>> getting this complicated. To change a two way method into a one way
>> >>>> method,
>> >>>> shouldn't I simply be able to change the method signature in SEI and
>> >>>> its
>> >>>> Impl, add an @Oneway annotation, change my WSDL, and everything
>> should
>> >>>> work.
>> >>>>
>> >>>> Either I am doing something ridiculously stupid or I just don't
>> >>>> understand
>> >>>> how to implement oneway methods in CXF.
>> >>>>
>> >>>> Can someone please guide me in the right direction? Any help is much
>> >>>> appreciated.
>> >>>>
>> >>>> Thanks.
>> >>>
>> >>> Are you using WS-Addressing or WSRM?
>> >>>
>> >>> -- bk
>> >>
>> >> AFAIK, neither. I guess whatever CXF sets up as the default. I don't
>> >> even have a configuration file. All I have are the source files from
>> >> wsdl_first
>> >> sample. And since that sample did not have the Greeter interface, I
>> >> simply
>> >> created my own Greeter interface which looks as follows:
>> >>
>> >> @WebService(targetNamespace =
>> "http://apache.org/hello_world_soap_http",
>> >> name = "SOAPService", portName = "SOAPService")
>> >> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>> >> public interface Greeter
>> >> {
>> >>     @Oneway
>> >>     @WebMethod
>> >>     public abstract void greetMeOneWay(@WebParam(name = "param")
>> String
>> >> param);
>> >> }
>> >
>> > I started with a java class which looks like yours (well... not abtract
>> > and @WebMethod comes first), generated the WSDL from it, and then
>> pulled
>> > it into a client and it works fine. Can you test Java first?
>> >
>> > -- bk
>>
>> So what I did is used the sample in
>> apache-cxf-2.2/samples/java_first_pojo.
>> Without doing anything, I started the server and client and just did a
>> quick call. Of course things worked fine. Then I created a new method
>> sayHiOneWay, which looks as follows in the interface:
>>     void sayHiOneWay(String text);
>> and following in HelloWorldImpl:
>>     public void sayHiOneWay(String text)
>>     {
>>         System.out.println("sayHiOneWay called");
>>         System.out.println("sleeping for 10 secs");
>>         try { Thread.sleep(10000); }
>>         catch (InterruptedException e) { e.printStackTrace(); }
>> 		System.out.println("woke up after 10 secs");
>>         System.out.println("accepted: " + text);
>>     }
>> I changed my client and added the following right before System.exit(0):
>>         System.out.println("Invoke sayHiOneWay()....");
>>         long startTime = System.currentTimeMillis();
>>         client.sayHiOneWay(System.getProperty("user.name"));
>>         System.out.println("Time taken to call sayHiOneWay(): " +
>> (System.currentTimeMillis()-startTime) + " ms");
>>
>> Now when I start the server and look at the wsdl, the sayHiOneWay
>> operation
>> looks as follows:
>> <wsdl:operation name="sayHiOneWay">
>> <wsdl:input message="tns:sayHiOneWay" name="sayHiOneWay">
>>     </wsdl:input>
>> <wsdl:output message="tns:sayHiOneWayResponse"
>> name="sayHiOneWayResponse">
>>     </wsdl:output>
>> </wsdl:operation>
>> From what I've read, a one way method must not contain the output
>> element.
>> So quite obviously, just creating a void method does not really make the
>> method one way. So I added the @Oneway annotation on right before the
>> method in both the interface and the impl. Then I ran the server and
>> observed the following two:
>> 1. The wsdl still contains the output tag.
>> 2. The client DOES wait for 10 secs for the method to finish.
>>
>> It seems like creating oneway methods is not simple. There seems to be
>> more
>> to it than simply making a method return void and adding a @Oneway
>> annotation.
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-%40Oneway-annotation-tp22629459p22680169.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF @Oneway annotation

Posted by Daniel Kulp <dk...@apache.org>.
The "java_first_pojo" sample uses the "simple" frontend and Aegis.    It would 
have no idea  how to process the @Oneway annotation.   That's a jaxws frontend 
annotation.  

Try playing with the java_first_jaxws sample.  That's jaxws and thus should 
honor it.

Dan


On Mon March 23 2009 11:20:21 am goelshek wrote:
> Bryan Kearney wrote:
> > goelshek wrote:
> >> Bryan Kearney wrote:
> >>> goelshek wrote:
> >>>> I need to implement a web service with a method that allows one way
> >>>> transport
> >>>> only. I started by implementing a CXF web service with a two way
> >>>> method and
> >>>> tested it using a CXF client. Then I created a .NET web service with a
> >>>> two
> >>>> way method and tested it using the same CXF client. Everything went
> >>>> smoothly.
> >>>>
> >>>> Then I changed my .NET web service to not return anything and added an
> >>>> annotation of OneWay=true. Now the .NET web service has a one way
> >>>> method
> >>>> that works as it is supposed to. I figured changing CXF would be
> >>>> similarly
> >>>> easy. However, even after I have removed the return type for my method
> >>>> and
> >>>> added a @Oneway annotation right before the @WebMethod annotation, my
> >>>> client
> >>>> still waits for the CXF server to finish execution.
> >>>>
> >>>> The @Oneway annotation was added to the SEI and a new WSDL was
> >>>> generated
> >>>> using that SEI. As a result, my operation in the WSDL now only has an
> >>>> input
> >>>> element and no output element. So clearly CXF is aware of the @Oneway
> >>>> annotation since the WSDL is correct.
> >>>>
> >>>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF
> >>>> 2.1.5 and
> >>>> 2.2 to no avail.
> >>>>
> >>>> I tested wsdl_first and in CXF samples and everything there works
> >>>> fine. The
> >>>> server relinquishes control as soon as it is invoked. So I tried to
> >>>> copy
> >>>> the
> >>>> sample's working, but the SEI there is Greeter which seems to be in a
> >>>> jar.
> >>>> To find the Greeter SEI, I downloaded CXF source. I found the
> >>>> interface,
> >>>> but
> >>>> it did not have the greetMeOneWay method in it. That method was found
> >>>> in
> >>>> binding2.xml and binding3.xml. It seems to me that the greetMeOneWay
> >>>> method
> >>>> is defined dynamically by spring somehow. I am confused as to why
> >>>> things
> >>>> are
> >>>> getting this complicated. To change a two way method into a one way
> >>>> method,
> >>>> shouldn't I simply be able to change the method signature in SEI and
> >>>> its
> >>>> Impl, add an @Oneway annotation, change my WSDL, and everything should
> >>>> work.
> >>>>
> >>>> Either I am doing something ridiculously stupid or I just don't
> >>>> understand
> >>>> how to implement oneway methods in CXF.
> >>>>
> >>>> Can someone please guide me in the right direction? Any help is much
> >>>> appreciated.
> >>>>
> >>>> Thanks.
> >>>
> >>> Are you using WS-Addressing or WSRM?
> >>>
> >>> -- bk
> >>
> >> AFAIK, neither. I guess whatever CXF sets up as the default. I don't
> >> even have a configuration file. All I have are the source files from
> >> wsdl_first
> >> sample. And since that sample did not have the Greeter interface, I
> >> simply
> >> created my own Greeter interface which looks as follows:
> >>
> >> @WebService(targetNamespace = "http://apache.org/hello_world_soap_http",
> >> name = "SOAPService", portName = "SOAPService")
> >> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> >> public interface Greeter
> >> {
> >>     @Oneway
> >>     @WebMethod
> >>     public abstract void greetMeOneWay(@WebParam(name = "param") String
> >> param);
> >> }
> >
> > I started with a java class which looks like yours (well... not abtract
> > and @WebMethod comes first), generated the WSDL from it, and then pulled
> > it into a client and it works fine. Can you test Java first?
> >
> > -- bk
>
> So what I did is used the sample in apache-cxf-2.2/samples/java_first_pojo.
> Without doing anything, I started the server and client and just did a
> quick call. Of course things worked fine. Then I created a new method
> sayHiOneWay, which looks as follows in the interface:
>     void sayHiOneWay(String text);
> and following in HelloWorldImpl:
>     public void sayHiOneWay(String text)
>     {
>         System.out.println("sayHiOneWay called");
>         System.out.println("sleeping for 10 secs");
>         try { Thread.sleep(10000); }
>         catch (InterruptedException e) { e.printStackTrace(); }
> 		System.out.println("woke up after 10 secs");
>         System.out.println("accepted: " + text);
>     }
> I changed my client and added the following right before System.exit(0):
>         System.out.println("Invoke sayHiOneWay()....");
>         long startTime = System.currentTimeMillis();
>         client.sayHiOneWay(System.getProperty("user.name"));
>         System.out.println("Time taken to call sayHiOneWay(): " +
> (System.currentTimeMillis()-startTime) + " ms");
>
> Now when I start the server and look at the wsdl, the sayHiOneWay operation
> looks as follows:
> <wsdl:operation name="sayHiOneWay">
> <wsdl:input message="tns:sayHiOneWay" name="sayHiOneWay">
>     </wsdl:input>
> <wsdl:output message="tns:sayHiOneWayResponse" name="sayHiOneWayResponse">
>     </wsdl:output>
> </wsdl:operation>
> From what I've read, a one way method must not contain the output element.
> So quite obviously, just creating a void method does not really make the
> method one way. So I added the @Oneway annotation on right before the
> method in both the interface and the impl. Then I ran the server and
> observed the following two:
> 1. The wsdl still contains the output tag.
> 2. The client DOES wait for 10 secs for the method to finish.
>
> It seems like creating oneway methods is not simple. There seems to be more
> to it than simply making a method return void and adding a @Oneway
> annotation.

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: CXF @Oneway annotation

Posted by goelshek <go...@yahoo.com>.

Bryan Kearney wrote:
> 
> goelshek wrote:
>> 
>> 
>> Bryan Kearney wrote:
>>> goelshek wrote:
>>>> I need to implement a web service with a method that allows one way
>>>> transport
>>>> only. I started by implementing a CXF web service with a two way method
>>>> and
>>>> tested it using a CXF client. Then I created a .NET web service with a
>>>> two
>>>> way method and tested it using the same CXF client. Everything went
>>>> smoothly.
>>>>
>>>> Then I changed my .NET web service to not return anything and added an
>>>> annotation of OneWay=true. Now the .NET web service has a one way
>>>> method
>>>> that works as it is supposed to. I figured changing CXF would be
>>>> similarly
>>>> easy. However, even after I have removed the return type for my method
>>>> and
>>>> added a @Oneway annotation right before the @WebMethod annotation, my
>>>> client
>>>> still waits for the CXF server to finish execution.
>>>>
>>>> The @Oneway annotation was added to the SEI and a new WSDL was
>>>> generated
>>>> using that SEI. As a result, my operation in the WSDL now only has an
>>>> input
>>>> element and no output element. So clearly CXF is aware of the @Oneway
>>>> annotation since the WSDL is correct.
>>>>
>>>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF 2.1.5
>>>> and
>>>> 2.2 to no avail.
>>>>
>>>> I tested wsdl_first and in CXF samples and everything there works fine.
>>>> The
>>>> server relinquishes control as soon as it is invoked. So I tried to
>>>> copy
>>>> the
>>>> sample's working, but the SEI there is Greeter which seems to be in a
>>>> jar.
>>>> To find the Greeter SEI, I downloaded CXF source. I found the
>>>> interface,
>>>> but
>>>> it did not have the greetMeOneWay method in it. That method was found
>>>> in
>>>> binding2.xml and binding3.xml. It seems to me that the greetMeOneWay
>>>> method
>>>> is defined dynamically by spring somehow. I am confused as to why
>>>> things
>>>> are
>>>> getting this complicated. To change a two way method into a one way
>>>> method,
>>>> shouldn't I simply be able to change the method signature in SEI and
>>>> its
>>>> Impl, add an @Oneway annotation, change my WSDL, and everything should
>>>> work.
>>>>
>>>> Either I am doing something ridiculously stupid or I just don't
>>>> understand
>>>> how to implement oneway methods in CXF.
>>>>
>>>> Can someone please guide me in the right direction? Any help is much
>>>> appreciated.
>>>>
>>>> Thanks.
>>> Are you using WS-Addressing or WSRM?
>>>
>>> -- bk
>>>
>>>
>>>
>> AFAIK, neither. I guess whatever CXF sets up as the default. I don't even
>> have a configuration file. All I have are the source files from
>> wsdl_first
>> sample. And since that sample did not have the Greeter interface, I
>> simply
>> created my own Greeter interface which looks as follows:
>> 
>> @WebService(targetNamespace = "http://apache.org/hello_world_soap_http",
>> name = "SOAPService", portName = "SOAPService")
>> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
>> public interface Greeter
>> {
>>     @Oneway
>>     @WebMethod
>>     public abstract void greetMeOneWay(@WebParam(name = "param") String
>> param);
>> }
> 
> 
> I started with a java class which looks like yours (well... not abtract 
> and @WebMethod comes first), generated the WSDL from it, and then pulled 
> it into a client and it works fine. Can you test Java first?
> 
> -- bk
> 
> 
> 
So what I did is used the sample in apache-cxf-2.2/samples/java_first_pojo.
Without doing anything, I started the server and client and just did a quick
call. Of course things worked fine. Then I created a new method sayHiOneWay,
which looks as follows in the interface:
    void sayHiOneWay(String text);
and following in HelloWorldImpl:
    public void sayHiOneWay(String text) 
    {
        System.out.println("sayHiOneWay called");
        System.out.println("sleeping for 10 secs");
        try { Thread.sleep(10000); } 
        catch (InterruptedException e) { e.printStackTrace(); }
		System.out.println("woke up after 10 secs");
        System.out.println("accepted: " + text);
    }
I changed my client and added the following right before System.exit(0):
        System.out.println("Invoke sayHiOneWay()....");
        long startTime = System.currentTimeMillis();
        client.sayHiOneWay(System.getProperty("user.name"));
        System.out.println("Time taken to call sayHiOneWay(): " +
(System.currentTimeMillis()-startTime) + " ms");

Now when I start the server and look at the wsdl, the sayHiOneWay operation
looks as follows:
<wsdl:operation name="sayHiOneWay">
<wsdl:input message="tns:sayHiOneWay" name="sayHiOneWay">
    </wsdl:input>
<wsdl:output message="tns:sayHiOneWayResponse" name="sayHiOneWayResponse">
    </wsdl:output>
</wsdl:operation>
>From what I've read, a one way method must not contain the output element.
So quite obviously, just creating a void method does not really make the
method one way. So I added the @Oneway annotation on right before the method
in both the interface and the impl. Then I ran the server and observed the
following two:
1. The wsdl still contains the output tag.
2. The client DOES wait for 10 secs for the method to finish.

It seems like creating oneway methods is not simple. There seems to be more
to it than simply making a method return void and adding a @Oneway
annotation.
-- 
View this message in context: http://www.nabble.com/CXF-%40Oneway-annotation-tp22629459p22662288.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF @Oneway annotation

Posted by Bryan Kearney <bk...@redhat.com>.
goelshek wrote:
> 
> 
> Bryan Kearney wrote:
>> goelshek wrote:
>>> I need to implement a web service with a method that allows one way
>>> transport
>>> only. I started by implementing a CXF web service with a two way method
>>> and
>>> tested it using a CXF client. Then I created a .NET web service with a
>>> two
>>> way method and tested it using the same CXF client. Everything went
>>> smoothly.
>>>
>>> Then I changed my .NET web service to not return anything and added an
>>> annotation of OneWay=true. Now the .NET web service has a one way method
>>> that works as it is supposed to. I figured changing CXF would be
>>> similarly
>>> easy. However, even after I have removed the return type for my method
>>> and
>>> added a @Oneway annotation right before the @WebMethod annotation, my
>>> client
>>> still waits for the CXF server to finish execution.
>>>
>>> The @Oneway annotation was added to the SEI and a new WSDL was generated
>>> using that SEI. As a result, my operation in the WSDL now only has an
>>> input
>>> element and no output element. So clearly CXF is aware of the @Oneway
>>> annotation since the WSDL is correct.
>>>
>>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF 2.1.5
>>> and
>>> 2.2 to no avail.
>>>
>>> I tested wsdl_first and in CXF samples and everything there works fine.
>>> The
>>> server relinquishes control as soon as it is invoked. So I tried to copy
>>> the
>>> sample's working, but the SEI there is Greeter which seems to be in a
>>> jar.
>>> To find the Greeter SEI, I downloaded CXF source. I found the interface,
>>> but
>>> it did not have the greetMeOneWay method in it. That method was found in
>>> binding2.xml and binding3.xml. It seems to me that the greetMeOneWay
>>> method
>>> is defined dynamically by spring somehow. I am confused as to why things
>>> are
>>> getting this complicated. To change a two way method into a one way
>>> method,
>>> shouldn't I simply be able to change the method signature in SEI and its
>>> Impl, add an @Oneway annotation, change my WSDL, and everything should
>>> work.
>>>
>>> Either I am doing something ridiculously stupid or I just don't
>>> understand
>>> how to implement oneway methods in CXF.
>>>
>>> Can someone please guide me in the right direction? Any help is much
>>> appreciated.
>>>
>>> Thanks.
>> Are you using WS-Addressing or WSRM?
>>
>> -- bk
>>
>>
>>
> AFAIK, neither. I guess whatever CXF sets up as the default. I don't even
> have a configuration file. All I have are the source files from wsdl_first
> sample. And since that sample did not have the Greeter interface, I simply
> created my own Greeter interface which looks as follows:
> 
> @WebService(targetNamespace = "http://apache.org/hello_world_soap_http",
> name = "SOAPService", portName = "SOAPService")
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface Greeter
> {
>     @Oneway
>     @WebMethod
>     public abstract void greetMeOneWay(@WebParam(name = "param") String
> param);
> }


I started with a java class which looks like yours (well... not abtract 
and @WebMethod comes first), generated the WSDL from it, and then pulled 
it into a client and it works fine. Can you test Java first?

-- bk


Re: CXF @Oneway annotation

Posted by goelshek <go...@yahoo.com>.


Bryan Kearney wrote:
> 
> goelshek wrote:
>> I need to implement a web service with a method that allows one way
>> transport
>> only. I started by implementing a CXF web service with a two way method
>> and
>> tested it using a CXF client. Then I created a .NET web service with a
>> two
>> way method and tested it using the same CXF client. Everything went
>> smoothly.
>> 
>> Then I changed my .NET web service to not return anything and added an
>> annotation of OneWay=true. Now the .NET web service has a one way method
>> that works as it is supposed to. I figured changing CXF would be
>> similarly
>> easy. However, even after I have removed the return type for my method
>> and
>> added a @Oneway annotation right before the @WebMethod annotation, my
>> client
>> still waits for the CXF server to finish execution.
>> 
>> The @Oneway annotation was added to the SEI and a new WSDL was generated
>> using that SEI. As a result, my operation in the WSDL now only has an
>> input
>> element and no output element. So clearly CXF is aware of the @Oneway
>> annotation since the WSDL is correct.
>> 
>> I realize this was a bug prior to CXF 2.1.4. I have used both CXF 2.1.5
>> and
>> 2.2 to no avail.
>> 
>> I tested wsdl_first and in CXF samples and everything there works fine.
>> The
>> server relinquishes control as soon as it is invoked. So I tried to copy
>> the
>> sample's working, but the SEI there is Greeter which seems to be in a
>> jar.
>> To find the Greeter SEI, I downloaded CXF source. I found the interface,
>> but
>> it did not have the greetMeOneWay method in it. That method was found in
>> binding2.xml and binding3.xml. It seems to me that the greetMeOneWay
>> method
>> is defined dynamically by spring somehow. I am confused as to why things
>> are
>> getting this complicated. To change a two way method into a one way
>> method,
>> shouldn't I simply be able to change the method signature in SEI and its
>> Impl, add an @Oneway annotation, change my WSDL, and everything should
>> work.
>> 
>> Either I am doing something ridiculously stupid or I just don't
>> understand
>> how to implement oneway methods in CXF.
>> 
>> Can someone please guide me in the right direction? Any help is much
>> appreciated.
>> 
>> Thanks.
> Are you using WS-Addressing or WSRM?
> 
> -- bk
> 
> 
> 
AFAIK, neither. I guess whatever CXF sets up as the default. I don't even
have a configuration file. All I have are the source files from wsdl_first
sample. And since that sample did not have the Greeter interface, I simply
created my own Greeter interface which looks as follows:

@WebService(targetNamespace = "http://apache.org/hello_world_soap_http",
name = "SOAPService", portName = "SOAPService")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface Greeter
{
    @Oneway
    @WebMethod
    public abstract void greetMeOneWay(@WebParam(name = "param") String
param);
}
-- 
View this message in context: http://www.nabble.com/CXF-%40Oneway-annotation-tp22629459p22660787.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF @Oneway annotation

Posted by Bryan Kearney <bk...@redhat.com>.
goelshek wrote:
> I need to implement a web service with a method that allows one way transport
> only. I started by implementing a CXF web service with a two way method and
> tested it using a CXF client. Then I created a .NET web service with a two
> way method and tested it using the same CXF client. Everything went
> smoothly.
> 
> Then I changed my .NET web service to not return anything and added an
> annotation of OneWay=true. Now the .NET web service has a one way method
> that works as it is supposed to. I figured changing CXF would be similarly
> easy. However, even after I have removed the return type for my method and
> added a @Oneway annotation right before the @WebMethod annotation, my client
> still waits for the CXF server to finish execution.
> 
> The @Oneway annotation was added to the SEI and a new WSDL was generated
> using that SEI. As a result, my operation in the WSDL now only has an input
> element and no output element. So clearly CXF is aware of the @Oneway
> annotation since the WSDL is correct.
> 
> I realize this was a bug prior to CXF 2.1.4. I have used both CXF 2.1.5 and
> 2.2 to no avail.
> 
> I tested wsdl_first and in CXF samples and everything there works fine. The
> server relinquishes control as soon as it is invoked. So I tried to copy the
> sample's working, but the SEI there is Greeter which seems to be in a jar.
> To find the Greeter SEI, I downloaded CXF source. I found the interface, but
> it did not have the greetMeOneWay method in it. That method was found in
> binding2.xml and binding3.xml. It seems to me that the greetMeOneWay method
> is defined dynamically by spring somehow. I am confused as to why things are
> getting this complicated. To change a two way method into a one way method,
> shouldn't I simply be able to change the method signature in SEI and its
> Impl, add an @Oneway annotation, change my WSDL, and everything should work.
> 
> Either I am doing something ridiculously stupid or I just don't understand
> how to implement oneway methods in CXF.
> 
> Can someone please guide me in the right direction? Any help is much
> appreciated.
> 
> Thanks.
Are you using WS-Addressing or WSRM?

-- bk