Map exceptionMap = WSDescriptorParser.getExceptionMap(portInfo.getJavaWsdlMapping());
SchemaInfoBuilder schemaInfoBuilder = portInfo.getSchemaInfoBuilder();
Map schemaTypeKeyToSchemaTypeMap = schemaInfoBuilder.getSchemaTypeKeyToSchemaTypeMap();
JavaServiceDesc serviceDesc = new JavaServiceDesc();
String serviceName = portInfo.getPortQName().toString();
String location = getAddressLocation(port);
serviceDesc.setName(serviceName);
serviceDesc.setEndpointURL(location);
serviceDesc.setWSDLFile(portInfo.getWsdlLocation());
Binding binding = port.getBinding();
serviceDesc.setStyle(getStyle(binding));
BindingInput bindingInput = ((BindingOperation) binding.getBindingOperations().get(0)).getBindingInput();
SOAPBody soapBody = (SOAPBody) SchemaInfoBuilder.getExtensibilityElement(SOAPBody.class, bindingInput.getExtensibilityElements());
if (soapBody.getUse() != null) {
Use use = Use.getUse(soapBody.getUse());
serviceDesc.setUse(use);
} else {
serviceDesc.setUse(Use.ENCODED);
}
boolean hasEncoded = serviceDesc.getUse() == Use.ENCODED;
boolean isLightweight = portInfo.getServiceEndpointInterfaceMapping() == null;
// if (isLightweight) {
// validateLightweightMapping(portInfo.getDefinition());
// }
Collection operations = new ArrayList();
Set wrapperElementQNames = buildOperations(binding, serviceEndpointInterface, isLightweight, portInfo, exceptionMap, classLoader, operations);
for (Iterator iter = operations.iterator(); iter.hasNext();) {
OperationDesc operation = (OperationDesc) iter.next();
serviceDesc.addOperationDesc(operation);
}
TypeMappingRegistryImpl tmr = new TypeMappingRegistryImpl();
tmr.doRegisterFromVersion("1.3");
TypeMapping typeMapping = tmr.getOrMakeTypeMapping(serviceDesc.getUse().getEncoding());
serviceDesc.setTypeMappingRegistry(tmr);
serviceDesc.setTypeMapping(typeMapping);
List typeInfo;
if (isLightweight) {
LightweightTypeInfoBuilder builder = new LightweightTypeInfoBuilder(classLoader, schemaTypeKeyToSchemaTypeMap, wrapperElementQNames);
typeInfo = builder.buildTypeInfo(portInfo.getJavaWsdlMapping());
} else {
HeavyweightTypeInfoBuilder builder = new HeavyweightTypeInfoBuilder(classLoader, schemaTypeKeyToSchemaTypeMap, wrapperElementQNames, operations, hasEncoded);
typeInfo = builder.buildTypeInfo(portInfo.getJavaWsdlMapping());
}
// We register type mappings and invoke serviceDesc.getOperations to trigger an introspection of the
// operations. By doing these operations during deployment, no introspection is required during runtime.
TypeInfo.register(typeInfo, typeMapping);
serviceDesc.getOperations();
return new ReadOnlyServiceDesc(serviceDesc, typeInfo);
}