Ahh good, I was hoping using the WSDL with WS-Policy would still work.

On Thursday, May 1, 2014, Daniel Kulp [via CXF] <
[email protected]> wrote:

>
> On Apr 29, 2014, at 2:23 AM, Andrei Shakirin <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=5743518&i=0>>
> wrote:
>
> > Hi,
> >
> > Yes, one option is using with Dispatch interface and don't touch JAXB at
> all.
> > You will need two things:
> >
> > a) set the required parameters (keystores, callbacks) on the request
> context;
> > b) parse your policy with Neethi and set it using POLICY_OVERRIDE
> property in request context (see my blog [1] for details)
>
> Actually, you shouldn’t need (b) at all.   If you create the Dispatch
> using the wsdl that has the policies and then set the WSDL_OPERATION (it’s
> a QName) to the appropriate Operation defined in the WSDL, then the
> policies and such found in the WSDL should take effect.
>
> Dan
>
>
> >
> > The second option is use DynamicClientFactory, the code will look like:
> >
> > DynamicClientFactory dcf = DynamicClientFactory.newInstance();
> > Client client = dcf.createClient(wsdlLocation);
> > SourceDataBinding sdb = new SourceDataBinding(StreamSource.class);
> > client.getEndpoint().getService().setDataBinding(sdb);
> > StreamSource request = new
> StreamSource(ServiceUtils.class.getResourceAsStream("/seekBookResponse.xml"));
>
> > Object[] response = client.invoke(operationName, request);
> >
> > The first option is more flexible and generic, the second one is easy to
> implement.
> >
> > Regards,
> > Andrei.
> >
> > [1]
> http://ashakirin.blogspot.de/2012/02/using-ws-policy-in-cxf-projects.html
>
> >
> >> -----Original Message-----
> >> From: Joel Pearson [mailto:[hidden 
> >> email]<http://user/SendEmail.jtp?type=node&node=5743518&i=1>]
>
> >> Sent: Freitag, 25. April 2014 07:05
> >> To: [hidden email]<http://user/SendEmail.jtp?type=node&node=5743518&i=2>
> >> Subject: Re: Possible to use arbitrary xml with a JAX-WS client and
> JAXB?
> >>
> >> 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] <
> >> [hidden email] <http://user/SendEmail.jtp?type=node&node=5743518&i=3>>
> 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
> --
> Daniel Kulp
> [hidden email] <http://user/SendEmail.jtp?type=node&node=5743518&i=4> -
> http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.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-tp5743219p5743518.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-tp5743219p5743520.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to