Fields Summary |
---|
public static final String | SERVICE_CLASSNAME |
public static final String | WSDL_LOCATION |
public static final String | MAINTAIN_SESSION |
public static final String | SERVICE_NAMESPACE |
public static final String | SERVICE_LOCAL_PART |
public static final String | SERVICE_IMPLEMENTATION_NAME_PROPERTY |
private static final String | SERVICE_IMPLEMENTATION_SUFFIX |
private static org.apache.axis.EngineConfiguration | _defaultEngineConfig |
private static ThreadLocal | threadDefaultConfig |
Methods Summary |
---|
private Service | createService(java.lang.String serviceImplementationName)
if(serviceImplementationName == null) {
throw new IllegalArgumentException(Messages.getMessage("serviceFactoryInvalidServiceName"));
}
try {
Class serviceImplementationClass;
serviceImplementationClass = Thread.currentThread().getContextClassLoader().loadClass(serviceImplementationName);
if (!(org.apache.axis.client.Service.class).isAssignableFrom(serviceImplementationClass)) {
throw new ServiceException(
Messages.getMessage("serviceFactoryServiceImplementationRequirement", serviceImplementationName));
}
Service service = (Service) serviceImplementationClass.newInstance();
if (service.getServiceName() != null) {
return service;
} else {
throw new ServiceException(Messages.getMessage("serviceFactoryInvalidServiceName"));
}
} catch (ServiceException e) {
throw e;
} catch (Exception e){
throw new ServiceException(e);
}
|
public javax.xml.rpc.Service | createService(java.net.URL wsdlDocumentLocation, javax.xml.namespace.QName serviceName)Create a Service instance.
return new Service(wsdlDocumentLocation, serviceName);
|
public javax.xml.rpc.Service | createService(javax.xml.namespace.QName serviceName)Create a Service instance. Since the WSDL file is not provided
here, the Service object returned is quite simpleminded.
Likewise, the Call object that service.createCall will return
will also be simpleminded. The caller must explicitly fill in
all the info on the Call object (ie., endpoint address, etc.).
return new Service(serviceName);
|
private static org.apache.axis.EngineConfiguration | getDefaultEngineConfig()
if (_defaultEngineConfig == null) {
_defaultEngineConfig =
EngineConfigurationFactoryFinder.newFactory().getClientEngineConfig();
}
return _defaultEngineConfig;
|
public java.lang.Object | getObjectInstance(java.lang.Object refObject, javax.naming.Name name, javax.naming.Context nameCtx, java.util.Hashtable environment)
Object instance = null;
if (refObject instanceof Reference) {
Reference ref = (Reference) refObject;
RefAddr addr = ref.get(SERVICE_CLASSNAME);
Object obj = null;
// If an explicit service classname is provided, then this is a
// generated Service class. Just use its default constructor.
if (addr != null && (obj = addr.getContent()) instanceof String) {
instance = ClassUtils.forName((String) obj).newInstance();
}
// else this is an instance of the Service class, so grab the
// reference data...
else {
// Get the WSDL location...
addr = ref.get(WSDL_LOCATION);
if (addr != null && (obj = addr.getContent()) instanceof String) {
URL wsdlLocation = new URL((String) obj);
// Build the service qname...
addr = ref.get(SERVICE_NAMESPACE);
if (addr != null
&& (obj = addr.getContent()) instanceof String) {
String namespace = (String) obj;
addr = ref.get(SERVICE_LOCAL_PART);
if (addr != null
&& (obj = addr.getContent()) instanceof String) {
String localPart = (String) obj;
QName serviceName = new QName(namespace, localPart);
// Construct an instance of the service
Class[] formalArgs = new Class[]
{URL.class, QName.class};
Object[] actualArgs = new Object[]
{wsdlLocation, serviceName};
Constructor ctor =
Service.class.getDeclaredConstructor(
formalArgs);
instance = ctor.newInstance(actualArgs);
}
}
}
}
// If maintainSession should be set to true, there will be an
// addr for it.
addr = ref.get(MAINTAIN_SESSION);
if (addr != null && instance instanceof Service) {
((Service) instance).setMaintainSession(true);
}
}
return instance;
|
public static Service | getService(java.util.Map environment)Obtain an AxisClient reference, using JNDI if possible, otherwise
creating one using the standard Axis configuration pattern. If we
end up creating one and do have JNDI access, bind it to the passed
name so we find it next time.
Service service = null;
InitialContext context = null;
EngineConfiguration configProvider =
(EngineConfiguration)environment.get(EngineConfiguration.PROPERTY_NAME);
if (configProvider == null)
configProvider = (EngineConfiguration)threadDefaultConfig.get();
if (configProvider == null)
configProvider = getDefaultEngineConfig();
// First check to see if JNDI works
// !!! Might we need to set up context parameters here?
try {
context = new InitialContext();
} catch (NamingException e) {
}
if (context != null) {
String name = (String)environment.get("jndiName");
if (name == null) {
name = "axisServiceName";
}
// We've got JNDI, so try to find an AxisClient at the
// specified name.
try {
service = (Service)context.lookup(name);
} catch (NamingException e) {
service = new Service(configProvider);
try {
context.bind(name, service);
} catch (NamingException e1) {
// !!! Couldn't do it, what should we do here?
}
}
} else {
service = new Service(configProvider);
}
return service;
|
public javax.xml.rpc.Service | loadService(java.lang.Class serviceInterface)Create an instance of the generated service implementation class
for a given service interface, if available.
if (serviceInterface == null) {
throw new IllegalArgumentException(
Messages.getMessage("serviceFactoryIllegalServiceInterface"));
}
if (!(javax.xml.rpc.Service.class).isAssignableFrom(serviceInterface))
{
throw new ServiceException(
Messages.getMessage("serviceFactoryServiceInterfaceRequirement", serviceInterface.getName()));
} else {
String serviceImplementationName = serviceInterface.getName() + SERVICE_IMPLEMENTATION_SUFFIX;
Service service = createService(serviceImplementationName);
return service;
}
|
public javax.xml.rpc.Service | loadService(java.net.URL wsdlDocumentLocation, java.lang.Class serviceInterface, java.util.Properties properties)Create an instance of the generated service implementation class
for a given service interface, if available.
An implementation may use the provided wsdlDocumentLocation and properties
to help locate the generated implementation class.
If no such class is present, a ServiceException will be thrown.
if (serviceInterface == null) {
throw new IllegalArgumentException(
Messages.getMessage("serviceFactoryIllegalServiceInterface"));
}
if (!(javax.xml.rpc.Service.class).isAssignableFrom(serviceInterface))
{
throw new ServiceException(
Messages.getMessage("serviceFactoryServiceInterfaceRequirement", serviceInterface.getName()));
} else {
String serviceImplementationName = serviceInterface.getName() + SERVICE_IMPLEMENTATION_SUFFIX;
Service service = createService(serviceImplementationName);
return service;
}
|
public javax.xml.rpc.Service | loadService(java.net.URL wsdlDocumentLocation, javax.xml.namespace.QName serviceName, java.util.Properties properties)Create an instance of the generated service implementation class
for a given service, if available.
The service is uniquely identified by the wsdlDocumentLocation and serviceName arguments.
An implementation may use the provided properties to help locate the generated implementation class.
If no such class is present, a ServiceException will be thrown.
String serviceImplementationName = properties.getProperty(SERVICE_IMPLEMENTATION_NAME_PROPERTY);
javax.xml.rpc.Service service = createService(serviceImplementationName);
if (service.getServiceName().equals(serviceName)) {
return service;
} else {
throw new ServiceException(
Messages.getMessage("serviceFactoryServiceImplementationNotFound", serviceImplementationName));
}
|
public static void | setThreadDefaultConfig(org.apache.axis.EngineConfiguration config)
threadDefaultConfig.set(config);
|