private void processOrGenerateWSDL(Class wsClass, ServiceMetaData serviceMetaData, URL wsdlLocation, EndpointMetaData epMetaData)
{
PolicyMetaDataBuilder policyBuilder = PolicyMetaDataBuilder.getServerSidePolicyMetaDataBuilder(toolMode);
try
{
WSDLGenerator generator = new JAXBWSDLGenerator(jaxbCtx);
generator.setExtension(extension);
WSDLDefinitionsFactory factory = WSDLDefinitionsFactory.newInstance();
if (wsdlLocation != null)
{
//we can no longer use the user provided wsdl without parsing it right now, since we
//need to look for policies and eventually choose the supported policy alternatives
WSDLDefinitions wsdlDefinitions = factory.parse(wsdlLocation);
policyBuilder.processPolicyExtensions(epMetaData, wsdlDefinitions);
//now we have the UMDM containing policy data; anyway we can't write a new wsdl file with
//the supported alternatives and so on, since we need to publish the file the user provided
serviceMetaData.setWsdlLocation(wsdlLocation);
}
else
{
WSDLDefinitions wsdlDefinitions = generator.generate(serviceMetaData);
writeWsdl(serviceMetaData, wsdlDefinitions, epMetaData);
}
}
catch (RuntimeException rte)
{