You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2008/12/05 21:29:26 UTC
svn commit: r723853 -
/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
Author: gawor
Date: Fri Dec 5 12:29:26 2008
New Revision: 723853
URL: http://svn.apache.org/viewvc?rev=723853&view=rev
Log:
1) in case of mtom bindings let the annotation win over wsdl and 2) support for binding protocol override from DD. Based on patch from Ivan (GERONIMO-4440)
Modified:
geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
Modified: geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?rev=723853&r1=723852&r2=723853&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java (original)
+++ geronimo/server/branches/2.1/plugins/axis2/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java Fri Dec 5 12:29:26 2008
@@ -47,7 +47,6 @@
import org.apache.axis2.jaxws.description.DescriptionFactory;
import org.apache.axis2.jaxws.description.EndpointDescription;
import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.description.builder.BindingTypeAnnot;
import org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite;
import org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite;
import org.apache.axis2.jaxws.description.builder.WebServiceAnnot;
@@ -144,30 +143,11 @@
throw new Exception("Port '" + portQName.getLocalPart() + "' not found in WSDL");
}
- Binding binding = port.getBinding();
- List extElements = binding.getExtensibilityElements();
- Iterator extElementsIterator =extElements.iterator();
- String bindingS = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING; //this is the default.
- while (extElementsIterator.hasNext()) {
- Object o = extElementsIterator.next();
- if (o instanceof SOAPBinding) {
- SOAPBinding sp = (SOAPBinding)o;
- if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap/")) {
- //todo: how to we tell if it is MTOM or not.
- bindingS = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
- }
- } else if (o instanceof SOAP12Binding) {
- SOAP12Binding sp = (SOAP12Binding)o;
- if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap12/")) {
- //todo: how to we tell if it is MTOM or not.
- bindingS = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
- }
- } else if (o instanceof HTTPBinding) {
- HTTPBinding sp = (HTTPBinding)o;
- if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/http/")) {
- bindingS = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
- }
- }
+ String protocolBinding = null;
+ if (portInfo.getProtocolBinding() != null) {
+ protocolBinding = JAXWSUtils.getBindingURI(portInfo.getProtocolBinding());
+ } else {
+ protocolBinding = getBindingFromWSDL(port);
}
Class endPointClass = classLoader.loadClass(endpointClassName);
@@ -185,20 +165,20 @@
serviceAnnot.setPortName(portQName.getLocalPart());
serviceAnnot.setServiceName(serviceQName.getLocalPart());
serviceAnnot.setTargetNamespace(serviceQName.getNamespaceURI());
- if (dbc.getBindingTypeAnnot() !=null && bindingS != null && !bindingS.equals("")) {
- BindingTypeAnnot bindingAnnot = dbc.getBindingTypeAnnot();
- bindingAnnot.setValue(bindingS);
- }
+ processServiceBinding(dbc, protocolBinding);
} else if (dbc.getWebServiceProviderAnnot() != null) {
WebServiceProviderAnnot serviceProviderAnnot = dbc.getWebServiceProviderAnnot();
serviceProviderAnnot.setPortName(portQName.getLocalPart());
serviceProviderAnnot.setServiceName(serviceQName.getLocalPart());
serviceProviderAnnot.setTargetNamespace(serviceQName.getNamespaceURI());
- if (dbc.getBindingTypeAnnot() !=null && bindingS != null && !bindingS.equals("")) {
- BindingTypeAnnot bindingAnnot = dbc.getBindingTypeAnnot();
- bindingAnnot.setValue(bindingS);
- }
+ processServiceBinding(dbc, protocolBinding);
+ }
+
+ /*
+ if (portInfo.isMTOMEnabled() != null) {
+ dbc.setIsMTOMEnabled(portInfo.isMTOMEnabled().booleanValue());
}
+ */
AxisService service = getService(dbcMap);
@@ -222,6 +202,54 @@
return service;
}
+ private String getBindingFromWSDL(Port port) {
+ Binding binding = port.getBinding();
+ List extElements = binding.getExtensibilityElements();
+ Iterator extElementsIterator = extElements.iterator();
+ String bindingS = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING; //this is the default.
+ while (extElementsIterator.hasNext()) {
+ Object o = extElementsIterator.next();
+ if (o instanceof SOAPBinding) {
+ SOAPBinding sp = (SOAPBinding)o;
+ if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap/")) {
+ bindingS = javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING;
+ }
+ } else if (o instanceof SOAP12Binding) {
+ SOAP12Binding sp = (SOAP12Binding)o;
+ if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/soap12/")) {
+ bindingS = javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING;
+ }
+ } else if (o instanceof HTTPBinding) {
+ HTTPBinding sp = (HTTPBinding)o;
+ if (sp.getElementType().getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/http/")) {
+ bindingS = javax.xml.ws.http.HTTPBinding.HTTP_BINDING;
+ }
+ }
+ }
+ return bindingS;
+ }
+
+ private void processServiceBinding(DescriptionBuilderComposite dbc, String bindingFromWSDL) {
+ if (dbc.getBindingTypeAnnot() == null || bindingFromWSDL == null || bindingFromWSDL.length() == 0) {
+ return;
+ }
+ String bindingFromAnnotation = dbc.getBindingTypeAnnot().value();
+ if (bindingFromAnnotation.equals(bindingFromWSDL)) {
+ return;
+ }
+ if (bindingFromWSDL.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING)) {
+ if (!bindingFromAnnotation.equals(javax.xml.ws.soap.SOAPBinding.SOAP11HTTP_MTOM_BINDING)) {
+ dbc.getBindingTypeAnnot().setValue(bindingFromWSDL);
+ }
+ } else if (bindingFromWSDL.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_BINDING)) {
+ if (!bindingFromAnnotation.equals(javax.xml.ws.soap.SOAPBinding.SOAP12HTTP_MTOM_BINDING)) {
+ dbc.getBindingTypeAnnot().setValue(bindingFromWSDL);
+ }
+ } else {
+ dbc.getBindingTypeAnnot().setValue(bindingFromWSDL);
+ }
+ }
+
private AxisService getService(HashMap<String, DescriptionBuilderComposite> dbcMap) {
return getEndpointDescription(dbcMap).getAxisService();
}