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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
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
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

pcelbaCommented:
This is about namespace. Look here for more details.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
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
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java

From novice to tech pro — start learning today.