Description
In the current Axis2 JAXWS implementation, WSDL is generated through a separate WSDLSupplier. It doesn't use the AxisService object at all. If someone programatically adds a policy into a JAXWS service, this policy is not shown in the WSDL when ?wsdl is called. Therefore a client won't be able to invoke this service.
In JAXWS service deployment, there are 2 cases
1. buildAxisServiceFromWSDL
2. buildAxisServiceFromAnnotations
In case 1, AxisService is built using WSDL11ToAxisServiceBuilder. Therefore in this case, WSDL can be generated in the normal way without using this WSDLSupplier. But in case 2, AxisService object doesn't contain a schema in it and the WSDL can't be generated in the normal way. I think that's why this WSDLSupplier is used.
In order to fix this issue, I've generated the WSDL from this WSDLSupplier in the deployment time and then used the WSDL11ToAxisServiceBuilder to build the AxisService. Now we don't want this WSDLSupplier (when ?wsdl is called) in both the above cases and policies are shown in the WSDL properly.
I've added a parameter into axis2.xml as "useGeneratedWSDLinJAXWS". By default it is false and the behavior is exactly as it was before this fix. If it is set to true, this new behavior is turned on and the WSDLSupplier is not registered.
I'm attaching the patch to this JIRA