users@jax-ws.java.net

Re: axis to jax-ws: message processing?

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Wed, 08 Nov 2006 08:33:23 -0800

Kristian Rink wrote:
> Hi folks;
>
> hope not to crash in here with a trivial question. In the course of
> migrating an application to glassfish, I am thinking of rebuilding an
> axis-based web service using jax-ws. For what I read so far looking
> through the tutorials, getting started with jax-ws is pretty
> straightforward given you are to expose a WebMethod that takes a bunch
> of parameters and returns a certain value. So far, so good.
>
>
Great!
> However, my very service currently is extracting XML payload from a SOAP
> message and processing right that, sending a message containing an XML
> payload built by a back end system in return. Currently, the
> allowedMethod implementation starts like this:
>
>
> [...]
> org.apache.axis.MessageContext msgContext =
> org.apache.axis.MessageContext.getCurrentContext();
> org.apache.axis.Message soapMessage =
> msgContext.getRequestMessage();
>
> try {
> SOAPPart sp = soapMessage.getSOAPPart();
> SOAPEnvelope se = sp.getEnvelope();
> SOAPBody sb = se.getBody();
> [...]
>
>
> Question, for pointers or hints: What is the best approach of rebuilding
> something like this using JAX-WS? Where to look to get started this way?
>
>
On your endpoint service side you need a Provider based endpoint, which
works off SOAPMessage. Something like:

@WebServiceProvider
@ServiceMode(value=Service.Mode.MESSAGE)
public class ProviderImpl implements

Provider<SOAPMessage> {
   public SOAPMessage invoke(SOAPMessage msg) {
   // do request processing
    SOAPMessage response = ...;
   return response;
   }
}

See the Provider documentation in the latest RI documentation:

https://jax-ws.dev.java.net/nonav/jax-ws-21-ea2/docs/provider.html

On the client side you can use Dispatch to work directly on the SOAPMessage.

For Dispatch, refer :
https://jax-ws.dev.java.net/nonav/jax-ws-21-ea2/docs/dispatch.html

hope it helps,

-vivek.


> Thanks for your patience and bye,
> Kristian
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jax-ws.dev.java.net
> For additional commands, e-mail: users-help_at_jax-ws.dev.java.net
>
>