You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2006/01/04 19:55:28 UTC
svn commit: r365967 - in
/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2:
deployment/AxisServiceBuilder.java
deployment/repository/util/ArchiveReader.java description/AxisService.java
Author: dims
Date: Wed Jan 4 10:55:22 2006
New Revision: 365967
URL: http://svn.apache.org/viewcvs?rev=365967&view=rev
Log:
Fix for AXIS2-350, if i drop a wsdl in META-INF inside the aar, make sure it shows up during "?wsdl"
Modified:
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java?rev=365967&r1=365966&r2=365967&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/AxisServiceBuilder.java Wed Jan 4 10:55:22 2006
@@ -140,11 +140,12 @@
return getAxisService(wsdlDefinition);
}
- public AxisService getAxisService(Definition wsdl4jDefinitions)
+ public AxisService getAxisService(Definition wsdlDefinition)
throws WSDLProcessingException {
AxisService axisService = new AxisService();
- Map services = wsdl4jDefinitions.getServices();
+ axisService.setWSDLDefinition(wsdlDefinition);
+ Map services = wsdlDefinition.getServices();
if (services.isEmpty()) {
throw new WSDLProcessingException("no Service element is found");
@@ -160,7 +161,7 @@
PolicyInclude policyInclude = new PolicyInclude();
- List wsdlPolicies = getPoliciesAsExtElements(wsdl4jDefinitions
+ List wsdlPolicies = getPoliciesAsExtElements(wsdlDefinition
.getExtensibilityElements());
Iterator wsdlPolicyIterator = wsdlPolicies.iterator();
@@ -177,7 +178,7 @@
//////////////////////////////////////////////////////////////////
// setting the schema
- Types types = wsdl4jDefinitions.getTypes();
+ Types types = wsdlDefinition.getTypes();
if (types != null) {
Iterator extElements = types.getExtensibilityElements().iterator();
@@ -195,7 +196,7 @@
HashMap resolvedRPCWrapperElements = new HashMap();
XmlSchema xmlSchemaForWrappedElements = generateWrapperSchema(
- wsdl4jDefinitions, resolvedRPCWrapperElements);
+ wsdlDefinition, resolvedRPCWrapperElements);
if (xmlSchemaForWrappedElements != null) {
axisService.setSchema(xmlSchemaForWrappedElements);
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java?rev=365967&r1=365966&r2=365967&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/repository/util/ArchiveReader.java Wed Jan 4 10:55:22 2006
@@ -25,6 +25,7 @@
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.om.OMElement;
+import org.apache.axis2.om.OMAttribute;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,19 +46,23 @@
AxisServiceGroup axisServiceGroup, HashMap wsdlServices,
AxisConfiguration axisConfig)
throws XMLStreamException, DeploymentException {
- DescriptionBuilder builder;
- String rootelementName;
- builder = new DescriptionBuilder(zin, axisConfig);
-
- OMElement services = builder.buildOM();
-
- rootelementName = services.getLocalName();
-
- if (TAG_SERVICE.equals(rootelementName)) {
- AxisService axisService = (AxisService) wsdlServices.get(
- DescriptionBuilder.getShortFileName(
- engine.getCurrentFileItem().getName()));
+ DescriptionBuilder builder = new DescriptionBuilder(zin, axisConfig);
+ OMElement rootElement = builder.buildOM();
+ String elementName = rootElement.getLocalName();
+
+ if (TAG_SERVICE.equals(elementName)) {
+ AxisService axisService = null;
+ OMAttribute serviceNameatt = rootElement.getAttribute(new QName(ATTRIBUTE_NAME));
+ String serviceName = serviceNameatt.getAttributeValue();
+ if(serviceName != null) {
+ axisService = (AxisService) wsdlServices.get(serviceName);
+ }
+ if (axisService == null) {
+ axisService = (AxisService) wsdlServices.get(
+ DescriptionBuilder.getShortFileName(
+ engine.getCurrentFileItem().getName()));
+ }
if (axisService == null) {
axisService = new AxisService(
DescriptionBuilder.getShortFileName(engine.getCurrentFileItem().getName()));
@@ -69,7 +74,7 @@
axisService.setClassLoader(engine.getCurrentFileItem().getClassLoader());
ServiceBuilder serviceBuilder = new ServiceBuilder(axisConfig, axisService);
- AxisService service = serviceBuilder.populateService(services);
+ AxisService service = serviceBuilder.populateService(rootElement);
ArrayList serviceList = new ArrayList();
@@ -83,8 +88,8 @@
}
serviceList.add(service);
return serviceList;
- } else if (TAG_SERVICE_GROUP.equals(rootelementName)) {
- ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(services, wsdlServices,
+ } else if (TAG_SERVICE_GROUP.equals(elementName)) {
+ ServiceGroupBuilder groupBuilder = new ServiceGroupBuilder(rootElement, wsdlServices,
axisConfig);
return groupBuilder.populateServiceGroup(axisServiceGroup);
}
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java?rev=365967&r1=365966&r2=365967&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService.java Wed Jan 4 10:55:22 2006
@@ -42,7 +42,6 @@
import javax.xml.namespace.QName;
import java.io.IOException;
import java.io.OutputStream;
-import java.io.Writer;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Date;
@@ -308,40 +307,39 @@
operationsAliasesMap.put(action, axisOperation);
}
- public void printWSDL(Writer out, String PortURL) throws AxisFault {
+ public void printWSDL(OutputStream out, String serviceURL) throws AxisFault {
+ if(getWSDLDefinition() != null) {
+ printUsingWSDLDefinition(out, serviceURL);
+ } else {
+ printUsingWOM(out, serviceURL);
+ }
+ }
+
+ public void printUsingWSDLDefinition(OutputStream out, String serviceURL) throws AxisFault {
try {
- Definition wsdlDefinition = this.getWSDLDefinition();
-
- if (wsdlDefinition != null) {
- Collection services = wsdlDefinition.getServices().values();
+ Definition wsdlDefinition = getWSDLDefinition();
+ Collection services = wsdlDefinition.getServices().values();
- for (Iterator iterator = services.iterator(); iterator.hasNext();) {
- Service service = (Service) iterator.next();
- Collection ports = service.getPorts().values();
+ for (Iterator iterator = services.iterator(); iterator.hasNext();) {
+ Service service = (Service) iterator.next();
+ Collection ports = service.getPorts().values();
- for (Iterator iterator1 = ports.iterator(); iterator1.hasNext();) {
- Port port = (Port) iterator1.next();
+ for (Iterator iterator1 = ports.iterator(); iterator1.hasNext();) {
+ Port port = (Port) iterator1.next();
- service.setQName(new QName(this.getName()));
+ service.setQName(new QName(this.getName()));
- SOAPAddress soapAddress = new SOAPAddressImpl();
+ SOAPAddress soapAddress = new SOAPAddressImpl();
- soapAddress.setElementType(SOAPConstants.Q_ELEM_SOAP_ADDRESS);
- soapAddress.setLocationURI(PortURL);
- port.getExtensibilityElements().clear();
- port.addExtensibilityElement(soapAddress);
- }
+ soapAddress.setElementType(SOAPConstants.Q_ELEM_SOAP_ADDRESS);
+ soapAddress.setLocationURI(serviceURL);
+ port.getExtensibilityElements().clear();
+ port.addExtensibilityElement(soapAddress);
}
-
- WSDLFactory.newInstance().newWSDLWriter().writeWSDL(wsdlDefinition, out);
- out.flush();
-
-
- } else {
- WSDLFactory.newInstance().newWSDLWriter().writeWSDL(wsdlDefinition, out);
- out.write("<wsdl>This service does not have a WSDL</wsdl>");
- out.flush();
}
+
+ WSDLFactory.newInstance().newWSDLWriter().writeWSDL(wsdlDefinition, out);
+ out.flush();
} catch (WSDLException e) {
throw new AxisFault(e);
} catch (IOException e) {
@@ -349,7 +347,7 @@
}
}
- public void printWSDL(OutputStream out, String serviceURL) throws AxisFault {
+ public void printUsingWOM(OutputStream out, String serviceURL) throws AxisFault {
//todo : This is a tempory hack pls imporve me : Deepal
AxisService2WOM axisService2WOM = new AxisService2WOM(getSchema(), this, null, null, serviceURL);
try {