WSDLFactory wsdlFactory,
XSDFactory xsdFactory,
Monitor monitor) {
WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract();
WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
wsdlContract.setInterface(wsdlInterface);
WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
JavaInterface iface = (JavaInterface)contract.getInterface();
Definition def = null;
try {
Interface2WSDLGenerator wsdlGenerator =
new Interface2WSDLGenerator(requiresSOAP12, resolver, dataBindings, xsdFactory, monitor);
def = wsdlGenerator.generate(iface, wsdlDefinition);
} catch (WSDLException e) {
throw new WSDLGenerationException(e);
}
// for debugging
if (printWSDL) {
try {
System.out.println("Generated WSDL for Java interface " + iface.getName() + " class " + iface.getJavaClass().getName());
WSDLWriter writer = javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
writer.writeWSDL(def, System.out);
} catch (WSDLException e) {
throw new WSDLGenerationException(e);
}
}
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);
try {
for (Operation op : iface.getOperations()) {
javax.wsdl.Operation wsdlOp = portType.getOperation(op.getName(), null, null);
wsdlInterface.getOperations().add(WSDLInterfaceIntrospectorImpl.getOperation(
wsdlOp, wsdlDefinition, resolver, xsdFactory));
}
} catch (InvalidWSDLException e) {
throw new WSDLGenerationException(e);
}