Hmm, I'm still lost. I've done like you said and used an wscompile
client mode task with a config.xml as you said (handlerChains tags
inside wsdl one)
generated the static client code but still:
Service_Impl f = new Service_Impl();
HandlerRegistry r = f.getHandlerRegistry();
Iterator ports = f.getPorts();
while (ports.hasNext()) {
QName e = (QName) ports.next();
System.out.println(e.toString());
List hc = r.getHandlerChain(e);
System.out.println(hc.isEmpty());
}
returns "true". Sigh...
On the other hand,
Service_Impl f = new Service_Impl();
HandlerRegistry registry = fact.getHandlerRegistry();
HandlerInfo hi = new HandlerInfo();
hi.setHandlerClass(foo.bar.Handler.class);
hi.setHandlerConfig(hashtable);
List hc = new ArrayList();
hc.add(hi);
Port_Stub stub = new ServerPort_Stub(new HandlerChainImpl(hc));
TypeMappingRegistry types = fact.getTypeMappingRegistry();
stub._initialize(new InternalTypeMappingRegistryImpl(types));
works quite fine. Can it be that my handcrafted WSDL has wrong
namespaces lying around and this breaks the code in the generated
Service_Impl() factory class that does the same things I stated
explicitly in my snippet?
public foo.bar.ServerPort getPort() {
String[] roles = new String[] {};
HandlerChainImpl handlerChain = new HandlerChainImpl
(getHandlerRegistry().getHandlerChain(ns1_ServerPort_QNAME));
handlerChain.setRoles(roles);
foo.bar..Port_Stub stub = new foo.bar.Port_Stub(handlerChain);
try {
stub._initialize(super.internalTypeRegistry);
} catch (JAXRPCException e) {
throw e;
} catch (Exception e) {
throw new JAXRPCException(e.getMessage(), e);
}
return stub;
}
Il giorno 06/giu/05, alle ore 15:16, zhanglin ha scritto:
> Put your handler class in the server side, and write a config.xml:
>
>
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <configuration xmlns="http://java.sun.com/xml/ns/jax-rpc/ri/config">
>
> <wsdl location="HelloWorld.wsdl" packageName="hello">
>
> <handlerChains>
>
> <chain runAt="client">
>
> <handler
> className="ClientHandler">
>
> <property
> name="ClientHandler" value="hello client handler" />
>
> </handler>
>
> </chain>
>
> </handlerChains>
>
> </wsdl>
>
> </configuration>
>
>
>
> When you generate the stub class with the WSDL file, use wscompile
> with this config.xml.
>
> In the client side, you needn’t write the handler code, just write
> your code as there is no handler, and you should get it working as
> you wish.
>
> Good luck!
>
>
>
> -----------------------------------
>
> Regards!
>
>
>
> ZhangLin
> Institute of Computer Software
> Nanjing University
> 210093