You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Jan Martiška <jm...@redhat.com> on 2013/02/04 09:10:08 UTC

programatically adding JAXWS request wrappers

Hi,
once again I stumbled upon an issue when trying to implement WS-Eventing for CXF. I would like to know if there is any easy way how to make a JAXWS client use a request wrapper. I have this scenario - there is an interface from which I create a JAXWS client (using JaxWsProxyFactoryBean):

@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface CatastrophicEventSink {
    void earthquake(EarthquakeEvent ev);
}

and I need to "magically" change it into this:

@WebService
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
public interface CatastrophicEventSink {
    @RequestWrapper(localName = "NotifyEvent", targetNamespace = "http://some-namespace.com")
    void earthquake(EarthquakeEvent ev);
}

.. without having to write the other interface, that should be made somehow automatically.
We can suppose that the server on the other side will understand it and know that a request wrapper is used.
I tried some experiments and only found that wrappers are generated some insane way using ASM library and I wasn't able to understand how exactly it works.
Is there any (not very ugly) way to accomplish this?

Thanks!!
Jan

Re: programatically adding JAXWS request wrappers

Posted by Glen Mazza <gm...@talend.com>.
Are you working from a WSDL?  Then you can use a binding file as 
explained here: 
http://cxf.apache.org/docs/wsdl-to-java.html#WSDLtoJava-wrapperstyle. 
Note that the meaning of BARE and WRAPPED can be counterintuitive (as 
mentioned at that link), BARE may actually be what you want.

Glen

On 02/04/2013 03:10 AM, Jan Martiška wrote:
> Hi,
> once again I stumbled upon an issue when trying to implement WS-Eventing for CXF. I would like to know if there is any easy way how to make a JAXWS client use a request wrapper. I have this scenario - there is an interface from which I create a JAXWS client (using JaxWsProxyFactoryBean):
>
> @WebService
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface CatastrophicEventSink {
>      void earthquake(EarthquakeEvent ev);
> }
>
> and I need to "magically" change it into this:
>
> @WebService
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
> public interface CatastrophicEventSink {
>      @RequestWrapper(localName = "NotifyEvent", targetNamespace = "http://some-namespace.com")
>      void earthquake(EarthquakeEvent ev);
> }
>
> .. without having to write the other interface, that should be made somehow automatically.
> We can suppose that the server on the other side will understand it and know that a request wrapper is used.
> I tried some experiments and only found that wrappers are generated some insane way using ASM library and I wasn't able to understand how exactly it works.
> Is there any (not very ugly) way to accomplish this?
>
> Thanks!!
> Jan


-- 
Glen Mazza
Talend Community Coders - coders.talend.com
blog: www.jroller.com/gmazza


Re: programatically adding JAXWS request wrappers

Posted by Daniel Kulp <dk...@apache.org>.
On Feb 4, 2013, at 3:10 AM, Jan Martiška <jm...@redhat.com> wrote:

> Hi,
> once again I stumbled upon an issue when trying to implement WS-Eventing for CXF. I would like to know if there is any easy way how to make a JAXWS client use a request wrapper. I have this scenario - there is an interface from which I create a JAXWS client (using JaxWsProxyFactoryBean):
> 
> @WebService
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
> public interface CatastrophicEventSink {
>    void earthquake(EarthquakeEvent ev);
> }
> 
> and I need to "magically" change it into this:
> 
> @WebService
> @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.WRAPPED)
> public interface CatastrophicEventSink {
>    @RequestWrapper(localName = "NotifyEvent", targetNamespace = "http://some-namespace.com")
>    void earthquake(EarthquakeEvent ev);
> }
> .. without having to write the other interface, that should be made somehow automatically.
> We can suppose that the server on the other side will understand it and know that a request wrapper is used.
> I tried some experiments and only found that wrappers are generated some insane way using ASM library and I wasn't able to understand how exactly it works.
> Is there any (not very ugly) way to accomplish this?

Not really, no.  Mostly because you end up with either a "mixed" method (request is wrapped, response unwrapped) which isn't supported, or a new method that doesn't match the original WSDL.   (unless this is also an @OneWay)


-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com