String name = (String) it.next();
newMap.put(name.trim(), serviceRefMap.get(name));
}
serviceRefMap = newMap;
RefContext refContext = earContext.getRefContext();
for (int i = 0; i < serviceRefs.length; i++) {
ServiceRefType serviceRef = serviceRefs[i];
String name = getStringValue(serviceRef.getServiceRefName());
GerServiceRefType serviceRefType = (GerServiceRefType) serviceRefMap.get(name);
// Map credentialsNameMap = (Map) serviceRefCredentialsNameMap.get(name);
String serviceInterfaceName = getStringValue(serviceRef.getServiceInterface());
assureInterface(serviceInterfaceName, "javax.xml.rpc.Service", "[Web]Service", cl);
Class serviceInterface;
try {
serviceInterface = cl.loadClass(serviceInterfaceName);
} catch (ClassNotFoundException e) {
throw new DeploymentException("Could not load service interface class: " + serviceInterfaceName, e);
}
URI wsdlURI = null;
if (serviceRef.isSetWsdlFile()) {
try {
wsdlURI = new URI(getStringValue(serviceRef.getWsdlFile().getStringValue()));
} catch (URISyntaxException e) {
throw new DeploymentException("could not construct wsdl uri from " + serviceRef.getWsdlFile().getStringValue(), e);
}
}
URI jaxrpcMappingURI = null;
if (serviceRef.isSetJaxrpcMappingFile()) {
try {
jaxrpcMappingURI = new URI(getStringValue(serviceRef.getJaxrpcMappingFile()));
} catch (URISyntaxException e) {
throw new DeploymentException("Could not construct jaxrpc mapping uri from " + serviceRef.getJaxrpcMappingFile(), e);
}
}
QName serviceQName = null;
if (serviceRef.isSetServiceQname()) {
serviceQName = serviceRef.getServiceQname().getQNameValue();
}
Map portComponentRefMap = new HashMap();
PortComponentRefType[] portComponentRefs = serviceRef.getPortComponentRefArray();
if (portComponentRefs != null) {
for (int j = 0; j < portComponentRefs.length; j++) {
PortComponentRefType portComponentRef = portComponentRefs[j];
String portComponentLink = getStringValue(portComponentRef.getPortComponentLink());
String serviceEndpointInterfaceType = getStringValue(portComponentRef.getServiceEndpointInterface());
assureInterface(serviceEndpointInterfaceType, "java.rmi.Remote", "ServiceEndpoint", cl);
Class serviceEndpointClass;
try {
serviceEndpointClass = cl.loadClass(serviceEndpointInterfaceType);
} catch (ClassNotFoundException e) {
throw new DeploymentException("could not load service endpoint class " + serviceEndpointInterfaceType, e);
}
portComponentRefMap.put(serviceEndpointClass, portComponentLink);
}
}
ServiceRefHandlerType[] handlers = serviceRef.getHandlerArray();
List handlerInfos = buildHandlerInfoList(handlers, cl);
//we could get a Reference or the actual serializable Service back.
Object ref = refContext.getServiceReference(serviceInterface, wsdlURI, jaxrpcMappingURI, serviceQName, portComponentRefMap, handlerInfos, serviceRefType, earContext, module, cl);
builder.bind(name, ref);
}
}