CXF Set SOAP Version to 1.2

I'm getting the following error:
<soap:Fault xmlns:env="http://www.w3.org/2003/05/soap-envelope">
      <faultcode>env:Sender</faultcode>
      <faultstring>Invalid version of SOAP in the request. SOAP 1.2 must be used. </faultstring>
    </soap:Fault>

Open in new window


How do I pro grammatically or using a config file change the SOAP to 1.2?

I have tried putting this line on the interface file but does not seem to be working. @BindingType(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)

I'm currently call the service like this:
LoggingInInterceptor loggingInInterceptor = new LoggingInInterceptor();
            loggingInInterceptor.setPrettyLogging(true);
            LoggingOutInterceptor loggingOutInterceptor = new LoggingOutInterceptor();
loggingOutInterceptor.setPrettyLogging(true);

CORETransactionService service = new CORETransactionService();
CORETransaction port = service.getCoreSoapPort();

Client client = ClientProxy.getClient(port);
Endpoint endpoint = client.getEndpoint();

endpoint.getInInterceptors().add(loggingInInterceptor);
endpoint.getOutInterceptors().add(loggingOutInterceptor);

Map<String, Object> ctx = ((javax.xml.ws.BindingProvider)port).getRequestContext();

Open in new window

LVL 1
HItesh RanaAsked:
Who is Participating?
 
pcelbaCommented:
This is about namespace. Look here for more details.
0
 
HItesh RanaAuthor Commented:
I see a post on this website about it
https://stackoverflow.com/questions/4248098/cxf-how-to-set-soapversion-on-cxf-port-without-spring

But I get stuck on aspects of it

Code from the link above
// 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);

Open in new window


Questions:
1) What is the portTypeClass
2) why am I returning the type?  
3) How is the return value used?
0
 
mccarlIT Business Systems Analyst / Software DeveloperCommented:
While, I don't really have an answer to your original question, I am pretty sure that the post that you found is referring to setting 1.2 on the "server" side, not the client side.

Is 1.2 correctly specified in the WSDL that you use to generate your Java code? And is WSDL2Java applying the correct annotations to the generated code to specify 1.2?
0
Cloud Class® Course: SQL Server Core 2016

This course will introduce you to SQL Server Core 2016, as well as teach you about SSMS, data tools, installation, server configuration, using Management Studio, and writing and executing queries.

 
HItesh RanaAuthor Commented:
I believe its on the client side.  

Is 1.2 correctly specified in the WSDL that you use to generate your Java code? And is WSDL2Java applying the correct annotations to the generated code to specify 1.2?  

I'm not sure about these questions.  I'm fairly new to Java.  I can certainly look into it.  Thanks you for the suggestion.
0
 
HItesh RanaAuthor Commented:
Oh I see.  So I need to change the WSDL file namespace to http://schemas.xmlsoap.org/wsdl/soap12/.  I would that cause any issues down the line? The WSDL file was given to me by the client.
0
 
pcelbaCommented:
I don't expect any issues.
0
 
HItesh RanaAuthor Commented:
So then when Apache CXF creates the stubs it will be for 1.2 then?
0
 
pcelbaCommented:
The best you can do here is to trace SOAP request and responses. Then you'll see everything. You may look here how to do it.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.