use of javax.xml.rpc.Stub in project OpenAM by OpenRock.
the class JAXRPCUtil method getServiceEndPoint.
protected static Object getServiceEndPoint(String iurl) {
if (debug.messageEnabled()) {
debug.message("JAXRPCUtil Endpoint URL: " + iurl);
}
// Obtaining the stub for JAX-RPC and setting the endpoint URL
Stub s = null;
try {
// Due to compilation errors, this function has been
// made to use reflections
Class imsClass = Class.forName("com.sun.identity.jaxrpc.IdentityManagementServices_Impl");
Object imsImpl = imsClass.newInstance();
Method method = null;
if (iurl.endsWith(SMS_SERVICE)) {
// Obtain the method "getSMSObjectIFPort" and invoke it
method = imsClass.getMethod("getSMSObjectIFPort", (Class[]) null);
}
// %%% Add other service names here
// Obtain the stub to be returned
s = (Stub) method.invoke(imsImpl, (Object[]) null);
} catch (ClassNotFoundException cnfe) {
if (debug.warningEnabled()) {
debug.warning("JAXRPCUtil: unable to find class " + "IdentityManagementServices_Impl", cnfe);
}
} catch (InstantiationException ne) {
if (debug.warningEnabled()) {
debug.warning("JAXRPCUtil: unable to instantiate class " + "IdentityManagementServices_Impl", ne);
}
} catch (IllegalAccessException iae) {
if (debug.warningEnabled()) {
debug.warning("JAXRPCUtil: Illegal access to class " + "IdentityManagementServices_Impl", iae);
}
} catch (Throwable t) {
if (debug.warningEnabled()) {
debug.warning("JAXRPCUtil:getServiceEndPoint exception", t);
}
}
// Set the remote URL for the service
if (s != null) {
s._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, iurl);
}
return (s);
}
use of javax.xml.rpc.Stub in project Payara by payara.
the class ServiceInvocationHandler method invoke.
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
if (method.getDeclaringClass() == java.lang.Object.class) {
return invokeJavaObjectMethod(this, method, args);
}
int methodType = getMethodType(method);
checkUnsupportedMethods(methodType);
Object returnValue = null;
try {
// Initialize method info for invocation based on arguments.
// Some/All of this might be overridden below.
Object serviceToInvoke = serviceDelegate;
Method methodToInvoke = method;
int methodTypeToInvoke = methodType;
Object[] argsForInvoke = args;
switch(methodType) {
case GET_PORT_CONTAINER_MANAGED:
Class serviceEndpointInterfaceClass = (Class) args[0];
String serviceEndpointInterface = serviceEndpointInterfaceClass.getName();
ServiceRefPortInfo portInfo = serviceRef.getPortInfo(serviceEndpointInterface);
// If we have a port, use it to call getPort(QName, SEI) instead
if ((portInfo != null) && portInfo.hasWsdlPort()) {
methodToInvoke = getClientManagedPortMethod;
methodTypeToInvoke = GET_PORT_CLIENT_MANAGED;
argsForInvoke = new Object[] { portInfo.getWsdlPort(), args[0] };
} else {
// This means the deployer did not resolve the port to
// which this SEI is mapped. Just call getPort(SEI)
// method on delegate. This is not guaranteed to work.
}
break;
case GET_WSDL_LOCATION:
return wsdlLocation;
case CREATE_CALL_PORT:
case CREATE_CALL_OPERATION_QNAME:
case CREATE_CALL_OPERATION_STRING:
case GET_CALLS:
case GET_PORTS:
serviceToInvoke = getConfiguredServiceDelegate();
break;
default:
break;
}
// End switch (methodType)
returnValue = methodToInvoke.invoke(serviceToInvoke, argsForInvoke);
if (returnValue instanceof Stub) {
Stub stub = (Stub) returnValue;
setStubProperties(stub, methodTypeToInvoke, methodToInvoke, argsForInvoke);
} else if (returnValue instanceof Call) {
Call[] calls = new Call[1];
calls[0] = (Call) returnValue;
setCallProperties(calls, methodTypeToInvoke, argsForInvoke);
} else if (methodType == GET_CALLS) {
Call[] calls = (Call[]) returnValue;
setCallProperties(calls, methodTypeToInvoke, argsForInvoke);
}
} catch (InvocationTargetException ite) {
throw ite.getCause();
}
return returnValue;
}
Aggregations