ServiceProxypublic class ServiceProxy extends Object implements InvocationHandlerObject proxy for Web Services. |
Fields Summary |
---|
private javax.xml.rpc.Service | serviceService object.
used for delegation | private static Method | portQNameClasschanging behavior to method : Service.getPort(QName, Class) | private static Method | portClasschanging behavior to method : Service.getPort(Class) | private Hashtable | portComponentRefPortComponentRef list |
Constructors Summary |
---|
public ServiceProxy(javax.xml.rpc.Service service)Constructs a new ServiceProxy wrapping given Service instance.
this.service = service;
try {
portQNameClass = Service.class.getDeclaredMethod("getPort", new Class[]{QName.class, Class.class});
portClass = Service.class.getDeclaredMethod("getPort", new Class[]{Class.class});
} catch (Exception e) {
throw new ServiceException(e);
}
|
Methods Summary |
---|
private java.rmi.Remote | getProxyPortClass(java.lang.Object[] args)
Class serviceendpointClass = (Class) args[0];
if (this.portComponentRef == null)
return service.getPort(serviceendpointClass);
QName portname = (QName) this.portComponentRef.get(serviceendpointClass.getName());
if (portname != null) {
return service.getPort(portname, serviceendpointClass);
} else {
return service.getPort(serviceendpointClass);
}
| private java.lang.Object | getProxyPortQNameClass(java.lang.Object[] args)
QName name = (QName) args[0];
String nameString = name.getLocalPart();
Class serviceendpointClass = (Class) args[1];
for (Iterator ports = service.getPorts(); ports.hasNext();) {
QName portName = (QName) ports.next();
String portnameString = portName.getLocalPart();
if (portnameString.equals(nameString)) {
return service.getPort(name, serviceendpointClass);
}
}
// no ports have been found
throw new ServiceException("Port-component-ref : " + name + " not found");
| public java.lang.Object | invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args)
if (portQNameClass.equals(method)) {
return getProxyPortQNameClass(args);
}
if (portClass.equals(method)) {
return getProxyPortClass(args);
}
try {
return method.invoke(service, args);
} catch (InvocationTargetException ite) {
throw ite.getTargetException();
}
| public void | setPortComponentRef(java.util.Hashtable portComponentRef)
this.portComponentRef = portComponentRef;
|
|