I'm building client proxies with WSDL2Java. The web service I'm querying needs WSA policy enforced as stated in the WSDL.
Here is how I generate the code (Ant task)
<java classname="org.apache.cxf.tools.wsdlto.WSDLToJava">
<arg value="-p" />
<arg value="@{package}" />
<arg value="-client" />
<arg value="-exsh" />
<arg value="true" />
<arg value="-verbose" />
<arg value="-mark-generated" />
<arg value="-b" />
<arg value="dev/jaxb-bindings.xml" />
<arg value="-d" />
<arg value="gen" />
<arg value="@{wsdl}" />
<classpath>
<path refid="cxf.classpath" />
</classpath>
</java>
Target WSDLs are:
- https://edwin.eurodw.eu/edservices/2.3/DealService.svc?wsdl
- https://edwin.eurodw.eu/edservices/2.3/UserService.svc?wsdl
- https://edwin.eurodw.eu/edservices/2.3/PerformanceDataUploadService.svc?wsdl
- https://edwin.eurodw.eu/edservices/2.3/PerformanceDataDownloadService.svc?wsdl
(Only the first two enforce WSA)
Fragment from DealService
:
<wsdl:service name="DealService">
<wsdl:port name="wsHttp_DealServiceEndPoint" binding="tns:wsHttp_DealServiceEndPoint">
<soap12:address location="https://edwin.eurodw.eu/edservices/2.3/DealService.svc" />
<wsa10:EndpointReference>
<wsa10:Address>https://edwin.eurodw.eu/edservices/2.3/DealService.svc</wsa10:Address>
</wsa10:EndpointReference>
</wsdl:port>
</wsdl:service>
Resulting annotated interface (IDealService
) is missing the @Addressing
annotation, which I must add manually
@WebService(targetNamespace = "http://edwin.eurodw.eu/EDServices/2.2", name = "IDealService")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@Generated(value = "org.apache.cxf.tools.wsdlto.WSDLToJava", date = "2014-10-20T11:24:25.099+02:00", comments = "Apache CXF 2.7.12")
public interface IDealService {
The question is
Since building annotated interfaces is part of an automated build process, how do I tell wsdl2java to use Addressing feature? I have the entire CXF runtime in my classpath
WSDLs are public so you can test yourself the generation (but not actual calls, since you need User Testing credentials)