users@jax-rpc.java.net

Re: Personalized Message Handlers

From: Arun Gupta <arun.gupta_at_Sun.COM>
Date: Wed, 03 Apr 2002 09:01:25 -0800

Hi Vito,

Message handlers can be configured in two ways:

1). Via the config.xml file (which is fed to xrpcc tool)
2). Programmatically within the client code

Client-side handlers can be configured in both the ways. However
server-side handlers can be configured only the first way.

To configure a client side handler (ClientHandler) and server side
handler (ServerHandler) via the first way, this is a schema fragment
required in config.xml file:

<handlerChains>
   <chain runAt="client">
      <handler className="ClientHandler">
         <property name="fooClient" value="barClient"/>
     </handler>
   </chain>
   <chain runAt="server">
     <handler className="ServerHandler">
       <property name="fooServer" value="barServer"/>
     </handler>
   </chain>
</handlerChains>

You can register handlers per interface or per service. Thus this
fragment can nested within <interface> element or within <service> element.

Here ClientHandler and ServerHandler are your handler classes
implementing javax.xml.rpc.handler.Handler interface. fooClient is a
property accessible within the handlers whose value is barClient. Ditto
for fooServer and barServer in server side handlers.

For registering handlers programmatically (second bullet above), you can
  do this as following:

ClientService_Impl service = new ClientService_Impl();
HandlerRegistry handlerRegistry = service.getHandlerRegistry();
QName portQname = new QName("http://foo.org/wsdl", "YourPort");
HandlerChain handlerChain = handlerRegistry.getHandlerChain(portQname);
HandlerInfo handlerInfo = new HandlerInfo(ClientHandler.class, null);
Hashtable hashtable = new Hashtable();
hashtable.put("fooClient", "barClient");
handlerInfo.setHandlerConfig(hashtable);
handlerChain.add(handlerInfo);

Here ClientService_Impl is your generated service class on the client side.

Note: Handler programming model is going to change in the next public
release of JAX-RPC.

Thanks for your interest in JAX-RPC.

Regards,
-Arun

Vito Morreale wrote:

> Hi all,
>
>
>
> how can I specify a personalized SOAP Message Handler (i.e.
> MySOAPMessageHandler as shown in chapter 12 of JAX-RPC Specification v0.8)?
>
> In the same chapter I have read as follows:
>
>
>
> <FROM_chapter_12_of_JAXRPC_Specification>
>
>
>
> A JAX-RPC handler may be configured and used on the service client as
> follows:
>
> ? A client-request handler: On the service client side, a request
> handler is invoked before an RPC request is communicated to the target
> service endpoint.
>
> ? A client-response handler: On the service client side, a response
> handler is invoked before an RPC response is returned to the service
> client from the target service endpoint.
>
> A JAX-RPC handler may configured and used on a service endpoint as follows:
>
> ? A server-request handler: On the service endpoint side, a request
> handler is invoked before an RPC request is dispatched to the target
> service endpoint.
>
> ? A server-response handler: On the service endpoint side, a response
> handler is invoked before an RPC response is communicated back to the
> service client from the target service endpoint.
>
> <FROM_chapter_12_of_JAXRPC_Specification>
>
> but I don't understand how to configure those new message handlers.
>
> Any suggestions will be helpful to me ?
>
> Thanks in advance...
>
>
>
> Vito
>


--
=============================================
There is only one me, I must live myself!
There is only one today, I must live itself!
=============================================
http://members.tripod.com/~apgupta/index.html
=============================================