|
|||||||||
| Home >> All >> org >> apache >> wsif >> [ base overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.apache.wsif.base
Class WSIFClientProxy

java.lang.Objectorg.apache.wsif.base.WSIFClientProxy
- All Implemented Interfaces:
- java.lang.reflect.InvocationHandler
- public class WSIFClientProxy
- extends java.lang.Object
- implements java.lang.reflect.InvocationHandler
- extends java.lang.Object
WSIFClientProxy is a dynamic proxy (or stub) used by the WSIFServiceImpl when the application is using the stubs to invoke the web service. A WSIFClientProxy is created using the static newInstance method. A WSIFClientProxy dynamically implements exactly one interface passed by the application. This class invokes the web service using the WSIFOperation and WSIFPort interfaces and so is independent of any provider implementation. Operation overloading is supported.
| Field Summary | |
protected Definition |
def
|
protected java.lang.Class |
iface
|
protected PortType |
portType
|
protected java.lang.String |
portTypeName
|
protected java.lang.String |
portTypeNS
|
protected java.lang.Object |
proxy
|
protected java.lang.String |
serviceName
|
protected java.lang.String |
serviceNS
|
protected java.util.Map |
simpleTypeReg
|
protected org.apache.wsif.providers.WSIFDynamicTypeMap |
typeMap
|
private java.util.Map |
wsdlOperationTable
|
protected org.apache.wsif.WSIFPort |
wsifport
|
| Constructor Summary | |
private |
WSIFClientProxy(java.lang.Class iface,
Definition def,
java.lang.String serviceNS,
java.lang.String serviceName,
java.lang.String portTypeNS,
java.lang.String portTypeName,
org.apache.wsif.providers.WSIFDynamicTypeMap typeMap)
Private constructor because newInstance() should be used instead. |
| Method Summary | |
private java.lang.String |
createWSDLOperationKey(java.lang.reflect.Method method,
java.lang.Object[] args)
Create a key consisting of the method name and the types of all the args |
private java.lang.String |
createWSIFOperationKey(java.lang.String operationName,
java.lang.String inputName,
java.lang.String outputName)
Create a key consisting of all names concatenated |
java.lang.String |
deep()
|
private Operation |
findMatchingOperation(java.lang.reflect.Method method,
java.lang.Object[] args)
Find an operation in the list that matches the method and arguments. |
java.lang.Object |
getProxy()
|
java.lang.Object |
invoke(java.lang.Object proxy,
java.lang.reflect.Method method,
java.lang.Object[] args)
Invoke a user method. |
private boolean |
isWrappedInContext()
|
static WSIFClientProxy |
newInstance(java.lang.Class iface,
Definition def,
java.lang.String serviceNS,
java.lang.String serviceName,
java.lang.String portTypeNS,
java.lang.String portTypeName,
org.apache.wsif.providers.WSIFDynamicTypeMap typeMap)
Factory method to create a new dynamic proxy. |
void |
setPort(org.apache.wsif.WSIFPort wsifport)
Select which port to use for this proxy. |
private void |
setProxy(java.lang.Object proxy)
|
private void |
unWrapIfWrappedDocLit(java.util.List parts,
java.lang.String operationName)
Unwraps the top level element if this a wrapped message. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
iface
protected java.lang.Class iface
def
protected Definition def
serviceNS
protected java.lang.String serviceNS
serviceName
protected java.lang.String serviceName
portTypeNS
protected java.lang.String portTypeNS
portTypeName
protected java.lang.String portTypeName
typeMap
protected org.apache.wsif.providers.WSIFDynamicTypeMap typeMap
simpleTypeReg
protected java.util.Map simpleTypeReg
portType
protected PortType portType
wsifport
protected org.apache.wsif.WSIFPort wsifport
proxy
protected java.lang.Object proxy
wsdlOperationTable
private java.util.Map wsdlOperationTable
| Constructor Detail |
WSIFClientProxy
private WSIFClientProxy(java.lang.Class iface, Definition def, java.lang.String serviceNS, java.lang.String serviceName, java.lang.String portTypeNS, java.lang.String portTypeName, org.apache.wsif.providers.WSIFDynamicTypeMap typeMap) throws org.apache.wsif.WSIFException
- Private constructor because newInstance() should be used instead.
| Method Detail |
newInstance
public static WSIFClientProxy newInstance(java.lang.Class iface, Definition def, java.lang.String serviceNS, java.lang.String serviceName, java.lang.String portTypeNS, java.lang.String portTypeName, org.apache.wsif.providers.WSIFDynamicTypeMap typeMap) throws org.apache.wsif.WSIFException
- Factory method to create a new dynamic proxy.
setProxy
private void setProxy(java.lang.Object proxy)
getProxy
public java.lang.Object getProxy()
setPort
public void setPort(org.apache.wsif.WSIFPort wsifport)
- Select which port to use for this proxy.
invoke
public java.lang.Object invoke(java.lang.Object proxy, java.lang.reflect.Method method, java.lang.Object[] args) throws org.apache.wsif.WSIFException
- Invoke a user method. The java proxy support calls this method.
The fault from the fault message is not passed back to caller
(but it should be). However none of the existing providers set
the fault message. I'm not sure what to do with the fault message
anyhow. I guess raise a WSIFException which is what the current
providers do with faults already.
- Specified by:
invokein interfacejava.lang.reflect.InvocationHandler
findMatchingOperation
private Operation findMatchingOperation(java.lang.reflect.Method method, java.lang.Object[] args) throws org.apache.wsif.WSIFException
- Find an operation in the list that matches the method and arguments.
Java only allows one output-only parameter and that is the return
value. Java also does not allow overloading based on the return value.
Consequently we only look at the input parameters when deciding
which overloaded operation to pick.
If the user invoked an overloaded method, MyMethod(null) seems to be
ambiguous. However it is not since java forces the user to cast the
null to one of the types that are valid on the method. So the invoke
method on our client proxy gets passed args[0]==null which is not typed.
However method.getParameterTypes()[0] is the type that java picked to
invoke. So we use getParameterTypes() to choose the operation, as well
as args[i].getClass().
We also use args[i].getClass() to choose the operation in case
getParameterTypes()[i].equals(Object.class) (no match) but
args[i].getClass() is the class specified in the operation.
The typeMap only contains complexTypes, so this class also uses the
simpleTypeReg for simple types (int, string, etc).
We compare the class in the mapping with the one from types using
isAssignableFrom() not equals() because we allow the user to pass
a subclass.
If there are two methods MyMethod(Address) and MyMethod(SubAddress)
then MyMethod(new SubAddress()) would match both methods. So if we
find an operation which exactly matches the method we return it.
But if we find an operation whose types are assignable from the
method's types, we carry on searching for an exact match. If we fail
to find an exact match then we return the "assignable" match. There
is a problem if there are multiple "assignable" matches and no exact
match as would happen if MyMethod(SubSubAddress) where SubSubAddress
extends Address. This code does not cope with that case and it is a
known restriction (bug).
If the WSDL is correct, we do not expect that there will be multiple
exact matches, so we do not test for this.
createWSDLOperationKey
private java.lang.String createWSDLOperationKey(java.lang.reflect.Method method, java.lang.Object[] args)
- Create a key consisting of the method name and the types of all the args
createWSIFOperationKey
private java.lang.String createWSIFOperationKey(java.lang.String operationName, java.lang.String inputName, java.lang.String outputName)
- Create a key consisting of all names concatenated
unWrapIfWrappedDocLit
private void unWrapIfWrappedDocLit(java.util.List parts, java.lang.String operationName) throws org.apache.wsif.WSIFException
- Unwraps the top level element if this a wrapped message.
isWrappedInContext
private boolean isWrappedInContext()
throws org.apache.wsif.WSIFException
deep
public java.lang.String deep()
|
|||||||||
| Home >> All >> org >> apache >> wsif >> [ base overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
JAVADOC
org.apache.wsif.base.WSIFClientProxy