I am currently working on a Web Service client using CXF without Spring configuration files.
It works pretty well but I cannot figure out how to set the binding SoapVersion using the Java Api. Using a Spring file this is done as the following:
<jaxws:binding>
<soap:soapBinding version="1.2"/>
</jaxws:binding>
Do you guys know how to do this in the Java code (on the Port, on the SOAPBinding...)?
Thanks in advance for your help!
EDIT----------------------
I'm still stuck with this problem... I tried to add the SOAPBinding annotation on the interface as suggested in one of the response below but it didn't work... I'm still searching for a way to manually configure my PortType / Binding / Bus to use Soap 1.2...
Any ideas?
EDIT----------------------
Problem solved! Actually I answered my own question: see below...
Thanks!
Easiest is probably to just stick an annotation on the interface of:
@BindingType(SOAPBinding.SOAP12HTTP_BINDING)
Ok I answer again to my own question to share the solution. With the help of the guys from the CXF mailing list I found a solution that works for me. There is actually 2 ways to solve the problem. Here is the explanation:
The problem came from the way I was building my CXF Service.
The first solution is to specify the WSDL location at Service creation time:
// Create the service
Service service = Service.create(urlToWsdl, serviceQName);
// Access the port
return service.getPort(serviceQName, portTypeClass);
This solved the problem but I didn't want to have that link to the WSDL, so here is the second solution that gets rid of this link:
// Create the service
Service service = Service.create(serviceQName);
// Add a Port to the service and specify the SOAP 1.2 binding
service.addPort(serviceQName, javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING, wsUrl);
// Access the port
return service.getPort(serviceQName, portTypeClass);
In my project we decided to choose the second solution.
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With