Hi,

I am not sure that I understand your use case.
If you would like just to send arbitrary xml to the web service, Dispatch 
interface is exactly what you need.

The code will look like:
        Service service = Service.create(SERVICE_NAME);
        service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING, ADDRESS);
        
        Dispatch<Source> dispatch = service.createDispatch(PORT_NAME, 
Source.class, Service.Mode.PAYLOAD);
        
        System.out.println("Invoking sayHi...");
        dispatch.getRequestContext().put(MessageContext.WSDL_OPERATION, 
operationName);
        Source response = dispatch.invoke(new StreamSource(new 
ByteArrayInputStream(payload.getBytes("utf-8"))));

Take a look into jaxws_dispatch_provider delivered with CXF for details.

Regards,
Andrei.

> -----Original Message-----
> From: bimjoeipa [mailto:[email protected]]
> Sent: Donnerstag, 24. April 2014 09:53
> To: [email protected]
> Subject: Possible to use arbitrary xml with a JAX-WS client and JAXB?
> 
> Hi,
> 
> I'm trying to figure out if a workaround is feasible.
> 
> I want to have the ability to have have arbitrary xml and map that to some
> generated JAX-WS Client classes and then invoke it as a regular service.
> 
> I've been able to use JAXB to map the xml string into Request Wrapper objects
> generated by XJC (using the maven cxf plugin), however I don't know what to
> do with the request wrapper object, because normally you'd invoke the
> WebMethod from the Service Interface.  But in my case I want to invoke the
> service using the request wrapper. Is this possible?
> 
> I had a look at what methods were available on the Service, and I found you 
> can
> create a Dispatch Object from a JAXBContext, but I couldn't figure out how 
> that
> is supposed to be used.
> 
> I realise what I'm doing is probably a non-standard usage of the JAX-WS api, 
> but
> it is it possible with CXF somehow?
> 
> Thanks,
> 
> Joel
> 
> 
> 
> --
> View this message in context: http://cxf.547215.n5.nabble.com/Possible-to-use-
> arbitrary-xml-with-a-JAX-WS-client-and-JAXB-tp5743219.html
> Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to