/**
* Create a WSDLInterfaceContract from a JavaInterfaceContract
*/
public static WSDLInterfaceContract createWSDLInterfaceContract(JavaInterfaceContract contract,
boolean requiresSOAP12) {
JavaInterface iface = (JavaInterface)contract.getInterface();
// Create a package2ns map
Map<String, String> pkg2nsMap = new HashMap<String, String>();
for (Operation op : iface.getOperations()) {
DataType<List<DataType>> inputType = op.getInputType();
for (DataType t : inputType.getLogical()) {
register(pkg2nsMap, t);
}
DataType outputType = op.getOutputType();
register(pkg2nsMap, outputType);
}
Definition def = createDefinition(pkg2nsMap, iface.getJavaClass(), requiresSOAP12);
DefaultWSDLFactory wsdlFactory = new DefaultWSDLFactory();
WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract();
WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
wsdlContract.setInterface(wsdlInterface);
WSDLDefinition wsdlDefinition = new DefaultWSDLFactory().createWSDLDefinition();
wsdlDefinition.setDefinition(def);
wsdlInterface.setWsdlDefinition(wsdlDefinition);
wsdlInterface.setRemotable(true);
wsdlInterface.setConversational(contract.getInterface().isConversational());
wsdlInterface.setUnresolved(false);
wsdlInterface.setRemotable(true);
PortType portType = (PortType)def.getAllPortTypes().values().iterator().next();
wsdlInterface.setPortType(portType);
readInlineSchemas(wsdlFactory, wsdlDefinition, def, new XmlSchemaCollection());
try {
for (Operation op : iface.getOperations()) {
javax.wsdl.Operation wsdlOp = portType.getOperation(op.getName(), null, null);
WSDLOperationIntrospectorImpl opx =
new WSDLOperationIntrospectorImpl(wsdlFactory, wsdlOp, wsdlDefinition, null, null);
wsdlInterface.getOperations().add(opx.getOperation());