I don't think it's QUITE as simple with JAX-WS.   The code would look similar 
to:

        Service service = Service.create(serviceName);
        service.addPort(portName, "http://schemas.xmlsoap.org/soap/";, 
                        
"http://localhost:9006/SOAPDispatchService/SoapDispatchPort";);
(serviceName and portName could be fairly random QNames)
        Dispatch<DOMSource> disp = service.createDispatch(portName, 
                             DOMSource.class, Service.Mode.PAYLOAD);
(You can use DOMSource, StreamSource, SAXSource)


        DOMSource domResMsg = disp.invoke(domReqMsg);



Dan






On Sun June 21 2009 9:35:17 am John Baker wrote:
> Hi,
>
> Thanks for your response.  I've written an interceptor to do it, but was
> just looking at the Dispatch API.  I've got some old Axis code that I'm
> replacing - it does this:
>
>          Service service = new Service();
>          Call call = (Call)service.createCall();
>          call.setTargetEndpointAddress(new URL(endPoint));
>          call.setOperationName(new QName("http://www.xyz.com";, method) );
>          if (username != null) call.setUsername(username);
>          if (password != null) call.setPassword(password);
>          String ret = (String)call.invoke(new Object[] { message });
>
> Is that easy to replace with the jaxws (dispatch?) api?  It did nothing
> more than call a WS method, passing one parameter and assuming a String
> response. No WSDL involved...
>
>
> John
>
> P.S.  If anyone needs the interceptor then I'm happy to post it.
>
> On Sunday 21 June 2009 13:19:37 you wrote:
> > John Baker wrote:
> > > Hello,
> > >
> > > How does one obtain the raw SOAP message returned from a client
> > > webservice call?  Ideally, as String or a Document would be nice.
> > >
> > >
> > > John
> >
> > You can achieve the same in either of two ways:
> >
> > A. You can use Dispatch API [1] to write your client where you can get
> > either Message (Body element) or Payload (entire SOAP Envelope).
> > or
> > B. You can write and plugin your own interceptor [2] in the interceptor
> > chain where you can get the hold of soap message.
> >
> > With Regards,
> > Mayank
> >
> > [1]. http://cwiki.apache.org/CXF20DOC/jax-ws-dispatch-api.html
> > [2].  http://cwiki.apache.org/CXF20DOC/interceptors.html

-- 
Daniel Kulp
[email protected]
http://www.dankulp.com/blog

Reply via email to