Hi Andrei,

I did forget to mention that I wanted to send an arbitrary xml as the body,
but I still wanted ws policy to apply to the security header.

So I presume if I create a service the usual way that includes the WSDL
with the WS-Policy, createDispatch like you mentioned then I can just set
all the required variables (keystores and such) on the request context as I
would normally with the port interface with the client classes?

So you're saying that I shouldn't need to deal with JAXB at all?

I can't get to my pc for a few days which is why I haven't tried it yet.

Thanks,

Joel

On Friday, April 25, 2014, Andrei Shakirin [via CXF] <
[email protected]> wrote:

> 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:[hidden 
> > email]<http://user/SendEmail.jtp?type=node&node=5743257&i=0>]
>
> > Sent: Donnerstag, 24. April 2014 09:53
> > To: [hidden email]<http://user/SendEmail.jtp?type=node&node=5743257&i=1>
> > 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.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://cxf.547215.n5.nabble.com/Possible-to-use-arbitrary-xml-with-a-JAX-WS-client-and-JAXB-tp5743219p5743257.html
>  To unsubscribe from Possible to use arbitrary xml with a JAX-WS client
> and JAXB?, click 
> here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5743219&code=am9lbC5wZWFyc29uQGdtYWlsLmNvbXw1NzQzMjE5fDY2MDI1MDExMw==>
> .
> NAML<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://cxf.547215.n5.nabble.com/Possible-to-use-arbitrary-xml-with-a-JAX-WS-client-and-JAXB-tp5743219p5743278.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to