String address = endpoint.getEndpointAddress();
wsdlEndpoint.setAddress(address == null ? "REPLACE_WITH_ACTUAL_URL" : address);
service.addEndpoint(wsdlEndpoint);
QName interfaceQName = endpoint.getPortTypeName();
WSDLInterface wsdlInterface = new WSDLInterface(wsdl, interfaceQName);
wsdl.addInterface(wsdlInterface);
// Add imports
if (!interfaceQName.getNamespaceURI().equals(endpoint.getServiceMetaData().getServiceName().getNamespaceURI()))
{
WSDLImport wsdlImport = new WSDLImport(wsdl);
wsdlImport.setLocation(interfaceQName.getLocalPart() + "_PortType");
wsdlImport.setNamespace(interfaceQName.getNamespaceURI());
wsdl.addImport(wsdlImport);
wsdl.registerNamespaceURI(interfaceQName.getNamespaceURI(), null);
}
QName bindingQName = new QName(interfaceQName.getNamespaceURI(), interfaceQName.getLocalPart() + "Binding");
WSDLBinding wsdlBinding = new WSDLBinding(wsdl, bindingQName);
wsdlBinding.setInterfaceName(interfaceQName);
if (extension)
endpoint.setBindingId(SOAPBinding.SOAP12HTTP_BINDING);
wsdlBinding.setType(endpoint.getBindingId());
wsdl.addBinding(wsdlBinding);
wsdlEndpoint.setBinding(bindingQName);
if (endpoint.getDocumentation() != null)
{
String prefix = wsdl.getPrefix(Constants.URI_JAXWS_WSDL_CUSTOMIZATIONS);
if (prefix == null)
{
prefix = "jaxws";
wsdl.registerNamespaceURI(Constants.URI_JAXWS_WSDL_CUSTOMIZATIONS, prefix);
}
Element javadocElement = DOMUtils.createElement(Constants.WSDL_ELEMENT_JAXWS_JAVADOC.getLocalPart(), prefix);
javadocElement.setTextContent(endpoint.getDocumentation());
Element classElement = DOMUtils.createElement(Constants.WSDL_ELEMENT_JAXWS_CLASS.getLocalPart(), prefix);
classElement.setAttribute("name", interfaceQName.getLocalPart());
classElement.appendChild(javadocElement);
Element bindingsElement = DOMUtils.createElement(Constants.WSDL_ELEMENT_JAXWS_BINDINGS.getLocalPart(), prefix);
bindingsElement.appendChild(classElement);
WSDLExtensibilityElement ext = new WSDLExtensibilityElement(Constants.URI_JAXWS_WSDL_CUSTOMIZATIONS, bindingsElement);
wsdlInterface.addExtensibilityElement(ext);
wsdlInterface.setDocumentationElement(new WSDLDocumentation(endpoint.getDocumentation()));
}
for (OperationMetaData operation : endpoint.getOperations())
{
processOperation(wsdlInterface, wsdlBinding, operation);