You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Владимир Коньков <vl...@yandex.ru> on 2010/11/18 19:30:03 UTC

Getting raw XML parameter in JAX-WS webservice method

Hi there!
How to achieve something like that: 
@WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
public class HelloWorldImpl implements HelloWorld {

    public String sayHi(DOMSource xml) {
        return "Hello " + xml;
    }
}

My project is wsdl first and I've strict schemas for my messages. But I'nt need any Java proxy, because all my processing is XML based (I need a raw XML for processing SAX or DOM). In same time I want to leverage existing method routing of JAX-WS or Simple frontends. Please, suggest how.
Thanx in any advice
--
Vladimir

Re: Getting raw XML parameter in JAX-WS webservice method

Posted by Владимир Коньков <vl...@yandex.ru>.
Previously I'm tried to use SourceDataBinding, but it always put "null" in parameter.
With @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)  annotaction it's works! Moreover, the rage of supported parameter tipes is wide.

Daniel, if you have accont on Stackoverflow you cat respond on my question. I'm marked it as answeded and vote on your answer.
http://stackoverflow.com/questions/4212608/getting-raw-xml-parameter-in-jax-ws-webservice-method

Thanx very mutch!

В сообщении от 18 ноября 2010 23:48:22 автор Daniel Kulp написал:
> On Thursday 18 November 2010 1:30:03 pm Владимир Коньков wrote:
> > Hi there!
> > How to achieve something like that:
> > @WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
> > public class HelloWorldImpl implements HelloWorld {
> > 
> >     public String sayHi(DOMSource xml) {
> >         return "Hello " + xml;
> >     }
> > }
> > 
> > My project is wsdl first and I've strict schemas for my messages. But I'nt
> > need any Java proxy, because all my processing is XML based (I need a raw
> > XML for processing SAX or DOM). In same time I want to leverage existing
> > method routing of JAX-WS or Simple frontends. Please, suggest how. Thanx
> > in any advice
> 
> In general, this SOUNDS like you want a JAX-WS Provider based endpoint and not 
> a generated one.   You would have something like:
> 
> @WebServiceProvider(wsdlLocation = ".....")
> @ServiceMode(value = Service.Mode.PAYLOAD)            
> public class MyService implements Provider<Source> {
>           public Source invoke(Source request) {
> 		...process xml....
>                 return someSource;
>           }
> }
> 
> 
> By default, you'll get a StaxSource in there (but can return any Source), but 
> you can also make it Provider(DOMSource) if you was a DOM. (but then you'll 
> need to return a DOMSource.   Unfortunately, this won't do any method routing.
> 
> An option you can TRY (I really don't know if this will work) is:
> 
> @WebService(wsdlLocation = "....")
> @DataBinding(org.apache.cxf.databinding.source.SourceDataBinding.class)
> public class HelloWorldImpl implements HelloWorld {
>      public Source sayHi(Source xml) {
>         return xml;
>      }
> }
> 
> 
> You may need a @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) 
> annotation on there as well.
> 
> 
> 

Re: Getting raw XML parameter in JAX-WS webservice method

Posted by Daniel Kulp <dk...@apache.org>.
On Thursday 18 November 2010 1:30:03 pm Владимир Коньков wrote:
> Hi there!
> How to achieve something like that:
> @WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
> 
>     public String sayHi(DOMSource xml) {
>         return "Hello " + xml;
>     }
> }
> 
> My project is wsdl first and I've strict schemas for my messages. But I'nt
> need any Java proxy, because all my processing is XML based (I need a raw
> XML for processing SAX or DOM). In same time I want to leverage existing
> method routing of JAX-WS or Simple frontends. Please, suggest how. Thanx
> in any advice

In general, this SOUNDS like you want a JAX-WS Provider based endpoint and not 
a generated one.   You would have something like:

@WebServiceProvider(wsdlLocation = ".....")
@ServiceMode(value = Service.Mode.PAYLOAD)            
public class MyService implements Provider<Source> {
          public Source invoke(Source request) {
		...process xml....
                return someSource;
          }
}


By default, you'll get a StaxSource in there (but can return any Source), but 
you can also make it Provider(DOMSource) if you was a DOM. (but then you'll 
need to return a DOMSource.   Unfortunately, this won't do any method routing.

An option you can TRY (I really don't know if this will work) is:

@WebService(wsdlLocation = "....")
@DataBinding(org.apache.cxf.databinding.source.SourceDataBinding.class)
public class HelloWorldImpl implements HelloWorld {
     public Source sayHi(Source xml) {
        return xml;
     }
}


You may need a @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) 
annotation on there as well.


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

Re: Getting raw XML parameter in JAX-WS webservice method

Posted by Владимир Коньков <vl...@yandex.ru>.
Thanx, but can you provide a few lines example?

If just change the parameter type to Node and change databinding to Aegis then Aegis just bind Node as java bean and on invocation create proxy object for interface Node (also generate schema for that in WSDL). 

Maybe there is way  to get XML as InputStream or Reader?

В сообщении от 18 ноября 2010 21:41:12 автор Benson Margulies написал:
> The Aegis data binding supports  this by making a parameter of type
> org.w3c.dom.Node. I don't know the JAXB incantation.
> 
> On Thu, Nov 18, 2010 at 1:30 PM, Владимир Коньков <vl...@yandex.ru> wrote:
> > Hi there!
> > How to achieve something like that:
> > @WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
> > public class HelloWorldImpl implements HelloWorld {
> >
> >    public String sayHi(DOMSource xml) {
> >        return "Hello " + xml;
> >    }
> > }
> >
> > My project is wsdl first and I've strict schemas for my messages. But I'nt need any Java proxy, because all my processing is XML based (I need a raw XML for processing SAX or DOM). In same time I want to leverage existing method routing of JAX-WS or Simple frontends. Please, suggest how.
> > Thanx in any advice
> > --
> > Vladimir
> >
> 

Re: Getting raw XML parameter in JAX-WS webservice method

Posted by Benson Margulies <bi...@gmail.com>.
The Aegis data binding supports  this by making a parameter of type
org.w3c.dom.Node. I don't know the JAXB incantation.

On Thu, Nov 18, 2010 at 1:30 PM, Владимир Коньков <vl...@yandex.ru> wrote:
> Hi there!
> How to achieve something like that:
> @WebService(endpointInterface = "ru.citc.techtest.cxfconcepts.HelloWorld")
> public class HelloWorldImpl implements HelloWorld {
>
>    public String sayHi(DOMSource xml) {
>        return "Hello " + xml;
>    }
> }
>
> My project is wsdl first and I've strict schemas for my messages. But I'nt need any Java proxy, because all my processing is XML based (I need a raw XML for processing SAX or DOM). In same time I want to leverage existing method routing of JAX-WS or Simple frontends. Please, suggest how.
> Thanx in any advice
> --
> Vladimir
>