RE: Can't use JAX-WS + SOAP 1.2 ?

Martin Gainty <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <[email protected]>
MG2>quick comments

From: [email protected]
Date: Fri, 17 Jun 2016 05:45:21 +0000
Subject: Re: Can't use JAX-WS + SOAP 1.2 ?
To: [email protected]

Martin, thanks a lot!

You mean I must use pojo + services.xml for Web seivices like a quickstart[1]?MG2>for reliable HTTPBinding to SOAP1.2 use the programmatic approach below to bind HTTP to SOAP1.2
In my example[2], my service classes use only JAX-WS annotations like java_first_jaxws example[3].

And in my understanding, it seems this issue is caused from hard-corded with SOAP 1.1 binding.
MG2>with some of the providers unfortunately yes
In my example case, you should get a wsdl generated by axis2 runtime if you access 'http://localhost:8080/axis2-jaxws-soap12-demo-server/services/HelloWorldSoap12?wsdl'.

Axis2 uses wsgen(included JDK) to generate the requested wsdl.
https://github.com/apache/axis2-java/blob/v1.7.3/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java#L183-L184
and, however, initialize() set binding as SOAP 1.1 regardless of the service classess binding annotation.
https://github.com/apache/axis2-java/blob/v1.7.3/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java#L389
so, wsgen arguments will set for SOAP 1.1.
https://github.com/apache/axis2-java/blob/v1.7.3/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java#L208-L215

You must set extra arguments like extension, wsdl:Xsoap1.2 If you want to use wsgen for SOAP 1.2. so, wsgen will complain about it.
https://github.com/emag/axis2-jaxws-soap12-demo#error-log

MG2>annotations can tweak targetNamespace,serviceName,wsdlLocation and PortName from SOAP12EchoImpl.java:

@javax.xml.ws.WebServiceProvider(targetNamespace="http://jaxws.axis2.apache.org/proxy/soap12",					             serviceName="SOAP12EchoService",					             wsdlLocation="META-INF/SOAP12Echo.wsdl",					             portName="EchoPort")@javax.xml.ws.BindingType(SOAPBinding.SOAP12HTTP_BINDING)@javax.xml.ws.ServiceMode(Mode.MESSAGE)public class SOAP12EchoImpl implements javax.xml.ws.Provider<String> {
MG2>Note: you must implement javax.xml.ws.Provider
Can I change this behavior? Thanks.
MG2>all Axis2 functionality routes to axis2  Impl class that *must* implement ProviderMG2>*some* of the providers do have hardcoded SOAP11HTTP_BINDING e.g.
>grep -S "HTTP11_BINDING" *Provider.java.\addressing\AddressingProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)

.\jaxb\JAXBProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
.\soapmsg\SoapMessageProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)

.\soapmsgcheckmtom\SoapMessageCheckMTOMProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)

.\soapmsgmu\SoapMessageMUProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
.\soapmsgreturnnull\SoapMessageNullProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
.\sourcemsg\SourceMessageProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
.\string\StringProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)

.\stringmsg\StringMessageProvider.java:@BindingType(SOAPBinding.SOAP11HTTP_BINDING)
MG2>file a jira bug to replace hardcoded SOAP11HTTP_BINDING in the Providers and with parameterised Binding
https://issues.apache.org/jira/browse/axis2/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel

[1] https://github.com/apache/axis2-java/tree/v1.7.3/modules/samples/quickstart
[2] https://github.com/emag/axis2-jaxws-soap12-demo
[3] https://github.com/apache/axis2-java/tree/v1.7.3/modules/samples/java_first_jaxws

MG2>Many Thanks Ianabe for catching this

Date: Thu, 16 Jun 2016 10:09:07 +0000
Subject: Can't use JAX-WS + SOAP 1.2 ?
To: [email protected]


Hi, I'm new to here.

I think Axis2 supports JAX-WS + SOAP 1.2, but apparently the generated wsdl accessing 'http://some-domain/path/to/<servicename>?wsdl' is always treated as  SOAP 1.1 though the service  class added @BindingType(SOAPBinding.SOAP12HTTP_BINDING).

the related code is here:
https://github.com/apache/axis2-java/blob/v1.7.3/modules/metadata/src/org/apache/axis2/jaxws/description/builder/JAXWSRIWSDLGenerator.java#L389

And I've created a simple reproducer. Am I missing something?
https://github.com/emag/axis2-jaxws-soap12-demo

MG>your client code:
public class Client {
    public String invokeSayHello(String text) {        HelloWorld_Service service = new HelloWorld_Service();
MG>create a valid JAX-WS service using YOUR parameters populated into QName
MG>javax.xml.ws.Service service  = Service.create(new QName(
            "http://org/apache/axis2/jaxws/test/OMELEMENT", "OMElementService"));
MG>programatically add SOAP1.2 port using SOAP12HTTP_BINDING parms to your JAXWS service:

MG>service.addPort( new QName(
            "http://org/apache/axis2/jaxws/test/OMELEMENT", "OMElementPort"), javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING,"http://localhost:6060/axis2/services/OMElementProviderService.OMElementProviderPort");//tweak above port parameter to YOUR PORT
//grab all the configured ports and print them out  MG>java.util.Iterator<javax.xml.namespace.QName> ports = service.getPorts();  MG>while(ports.hasNext()) {   MG>   javax.xml.namespace.QName QNamePort port=(javax.xml.namespace.QName)ports.next();   MG>     log.debug("port namespaceURI="+port.getNamespaceURI());   MG>     log.debug("port localPart="+port.getLocalPart());   MG>     log.debug(" port prefix="+port.getPrefix());   MG>   }
 HelloWorld stub = service.getHelloWorldPort(); //service was not respecting SOAP12HTTP_BINDING        return stub.sayHello(text);    }
}
MG>reference org.apache.axis2.jaxws.dispatch.OMElementDispatchTest
MG>do you see SOAP12_HTTP_BINDING Port?
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.