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 2007/06/05 22:22:40 UTC
svn commit: r544617 - in /geronimo/server/trunk/modules/geronimo-axis2/src:
main/java/org/apache/geronimo/axis2/
test/java/org/apache/geronimo/axis2/testdata/doclitbare/
Author: gawor
Date: Tue Jun 5 13:22:39 2007
New Revision: 544617
URL: http://svn.apache.org/viewvc?view=rev&rev=544617
Log:
initialize AxisService with the right wsdl service and port
Modified:
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/doclitbare/BareDocLitService.java
Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java?view=diff&rev=544617&r1=544616&r2=544617
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/Axis2WebServiceContainer.java Tue Jun 5 13:22:39 2007
@@ -110,7 +110,7 @@
if(portInfo.getWsdlFile() != null && !portInfo.getWsdlFile().equals("")){ //WSDL file Has been provided
AxisServiceGenerator serviceGen = createServiceGenerator();
- service = serviceGen.getServiceFromWSDL(portInfo, endpointClassName, configurationBaseUrl, classLoader);
+ service = serviceGen.getServiceFromWSDL(portInfo, endpointClass, configurationBaseUrl);
}else { //No WSDL, Axis2 will handle it. Is it ?
service = AxisService.createService(endpointClassName, configurationContext.getAxisConfiguration(), JAXWSMessageReceiver.class);
Modified: geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java?view=diff&rev=544617&r1=544616&r2=544617
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/main/java/org/apache/geronimo/axis2/AxisServiceGenerator.java Tue Jun 5 13:22:39 2007
@@ -63,6 +63,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.geronimo.axis2.util.SimpleWSDLLocator;
+import org.apache.geronimo.jaxws.JAXWSUtils;
import org.apache.geronimo.jaxws.PortInfo;
//TODO: Handle RPC Style Messaging
@@ -85,18 +86,37 @@
this.messageReceiver = messageReceiver;
}
- public AxisService getServiceFromWSDL(PortInfo portInfo, String endpointClassName, URL configurationBaseUrl, ClassLoader classLoader) throws Exception {
+ public AxisService getServiceFromWSDL(PortInfo portInfo, Class endpointClass, URL configurationBaseUrl) throws Exception {
String wsdlFile = portInfo.getWsdlFile();
if (wsdlFile == null || wsdlFile.equals("")) {
throw new Exception("WSDL file is required.");
}
+
+ String endpointClassName = endpointClass.getName();
+ ClassLoader classLoader = endpointClass.getClassLoader();
+
+ QName serviceQName = portInfo.getWsdlService();
+ if (serviceQName == null) {
+ serviceQName = JAXWSUtils.getServiceQName(endpointClass);
+ }
+
+ QName portQName = portInfo.getWsdlPort();
+ if (portQName == null) {
+ portQName = JAXWSUtils.getPortQName(endpointClass);
+ }
+
Definition wsdlDefinition = readWSDL(wsdlFile, configurationBaseUrl, classLoader);
-
- Map<QName, Service> serviceMap = wsdlDefinition.getServices();
- Service wsdlService = serviceMap.values().iterator().next();
-
- Map<String, Port> portMap = wsdlService.getPorts();
- Port port = portMap.values().iterator().next();
+
+ Service wsdlService = wsdlDefinition.getService(serviceQName);
+ if (wsdlService == null) {
+ throw new Exception("Service '" + serviceQName + "' not found in WSDL");
+ }
+
+ Port port = wsdlService.getPort(portQName.getLocalPart());
+ if (port == null) {
+ throw new Exception("Port '" + portQName.getLocalPart() + "' not found in WSDL");
+ }
+
Binding binding = port.getBinding();
List extElements = binding.getExtensibilityElements();
Iterator extElementsIterator =extElements.iterator();
@@ -122,11 +142,8 @@
}
}
}
-
- String portName = portInfo.getWsdlPort() == null ? port.getName() : portInfo.getWsdlPort().getLocalPart();
- QName serviceQName = portInfo.getWsdlService() == null ? wsdlService.getQName() : portInfo.getWsdlService();
-
- WSDLToAxisServiceBuilder wsdlBuilder = new WSDL11ToAxisServiceBuilder(wsdlDefinition, serviceQName , portName);
+
+ WSDLToAxisServiceBuilder wsdlBuilder = new WSDL11ToAxisServiceBuilder(wsdlDefinition, serviceQName , portQName.getLocalPart());
wsdlBuilder.setCustomResolver(new URIResolverImpl(classLoader));
//populate with axis2 objects
@@ -147,7 +164,7 @@
if (dbc.getWebServiceAnnot() != null) { //information specified in .wsdl should overwrite annotation.
WebServiceAnnot serviceAnnot = dbc.getWebServiceAnnot();
- serviceAnnot.setPortName(portName);
+ serviceAnnot.setPortName(portQName.getLocalPart());
serviceAnnot.setServiceName(service.getName());
serviceAnnot.setTargetNamespace(service.getTargetNamespace());
if (dbc.getBindingTypeAnnot() !=null && bindingS != null && !bindingS.equals("")) {
@@ -156,7 +173,7 @@
}
} else if (dbc.getWebServiceProviderAnnot() != null) {
WebServiceProviderAnnot serviceProviderAnnot = dbc.getWebServiceProviderAnnot();
- serviceProviderAnnot.setPortName(portName);
+ serviceProviderAnnot.setPortName(portQName.getLocalPart());
serviceProviderAnnot.setServiceName(service.getName());
serviceProviderAnnot.setTargetNamespace(service.getTargetNamespace());
if (dbc.getBindingTypeAnnot() !=null && bindingS != null && !bindingS.equals("")) {
Modified: geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/doclitbare/BareDocLitService.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/doclitbare/BareDocLitService.java?view=diff&rev=544617&r1=544616&r2=544617
==============================================================================
--- geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/doclitbare/BareDocLitService.java (original)
+++ geronimo/server/trunk/modules/geronimo-axis2/src/test/java/org/apache/geronimo/axis2/testdata/doclitbare/BareDocLitService.java Tue Jun 5 13:22:39 2007
@@ -19,7 +19,9 @@
import javax.jws.WebMethod;
import javax.jws.WebService;
-@WebService(name="BareDocLitService", targetNamespace = "http://example.org")
+@WebService(serviceName="BareDocLitService",
+ portName="BareDocLitPort",
+ targetNamespace = "http://doclitbare.axis2.geronimo.apache.org")
public class BareDocLitService {
@WebMethod