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 gd...@apache.org on 2007/07/16 02:33:12 UTC
svn commit: r556481 - in /webservices/axis2/trunk/java/modules:
kernel/src/org/apache/axis2/deployment/
kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/util/
xmlbeans/src/org/apache/axis2/xmlbeans/
Author: gdaniels
Date: Sun Jul 15 17:33:10 2007
New Revision: 556481
URL: http://svn.apache.org/viewvc?view=rev&rev=556481
Log:
Some cleanup, JavaDoc, remove unused code/arguments
No major functional changes.
Modified:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/deployment/ServiceBuilder.java Sun Jul 15 17:33:10 2007
@@ -79,6 +79,10 @@
/**
* Populates service from corresponding OM.
+ *
+ * @param service_element an OMElement for the <service> tag
+ * @return a filled-in AxisService, configured from the passed XML
+ * @throws DeploymentException if there is a problem
*/
public AxisService populateService(OMElement service_element) throws DeploymentException {
try {
@@ -420,14 +424,15 @@
}
/**
- * To process the packe name to Qname mapping
- * <packageMapping>
- * <mapping packageName="foo.bar" qname="http://foo/bar/xsd">
+ * Process the package name to QName mapping:
+ *
+ * <packageMapping>
+ * <mapping packageName="foo.bar" qname="http://foo/bar/xsd"%gt;
* ......
* ......
- * </packageMapping>
+ * </packageMapping>
*
- * @param packageMappingElement
+ * @param packageMappingElement OMElement for the packageMappingElement
*/
private void processTypeMappings(OMElement packageMappingElement) {
Iterator elementItr = packageMappingElement.getChildrenWithName(new QName(TAG_MAPPING));
@@ -442,10 +447,10 @@
if (packageName == null || qName == null) {
continue;
}
- Iterator keys = service.getNameSpacesMap().keySet().iterator();
+ Iterator keys = service.getNamespaceMap().keySet().iterator();
while (keys.hasNext()) {
String key = (String) keys.next();
- if (qName.equals(service.getNameSpacesMap().get(key))) {
+ if (qName.equals(service.getNamespaceMap().get(key))) {
typeTable.addComplexSchema(packageName,
new QName(qName, packageName, key));
}
@@ -503,9 +508,11 @@
}
/**
- * To get the methods which dose not use RPC* Message Recievers
+ * To get the methods which do not use RPC* MessageReceivers
*
- * @return ArrayList
+ * @param axisService the AxisService to search
+ * @return an ArrayList of the LOCAL PARTS of the QNames of any non-RPC operations
+ * TODO: Why not just return the AxisOperations themselves??
*/
private ArrayList getNonRPCMethods(AxisService axisService) {
ArrayList excludeOperations = new ArrayList();
@@ -535,22 +542,18 @@
}
/**
- * If there is <excludeOperations>
- * <operation>foo</operation>
- * </excludeOperations>
- * <p/>
- * Then the operation object will be removed from the AxisService , so that
- * the operation wont be exposed
+ * Process <excludeOperation> element in services.xml. Each operation referenced
+ * will be removed from the AxisService.
*
- * @param exculeOperations
+ * @param excludeOperations the <excludeOperations> element from services.xml
+ * @return an ArrayList of the String contents of the <operation> elements
*/
- private ArrayList processExcludeOperations(OMElement exculeOperations) {
+ private ArrayList processExcludeOperations(OMElement excludeOperations) {
ArrayList exOps = new ArrayList();
- Iterator excludeOp_itr = exculeOperations.getChildrenWithName(new QName(TAG_OPERATION));
+ Iterator excludeOp_itr = excludeOperations.getChildrenWithName(new QName(TAG_OPERATION));
while (excludeOp_itr.hasNext()) {
OMElement opName = (OMElement) excludeOp_itr.next();
exOps.add(opName.getText().trim());
- // service.removeOperation(new QName(opName.getText().trim()));
}
return exOps;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBinding.java Sun Jul 15 17:33:10 2007
@@ -35,6 +35,9 @@
import java.util.ArrayList;
import java.util.Iterator;
+/**
+ * An AxisBinding represents a WSDL binding, and contains AxisBindingOperations.
+ */
public class AxisBinding extends AxisDescription {
private QName name;
@@ -108,31 +111,38 @@
}
/**
- * Generates the binding element
- * @param tns - The targetnamespace
- * @param wsoap - The SOAP namespace (WSDL 2.0)
- * @param whttp - The HTTP namespace (WSDL 2.0)
- * @param interfaceName - The name of the interface
- * @param nameSpaceMap - The namespacemap of the service
- * @return The generated binding element
+ * Generate the <binding> element
+ *
+ * @param wsdl the WSDL namespace
+ * @param tns the target namespace
+ * @param wsoap the SOAP namespace
+ * @param whttp the HTTP namespace
+ * @param interfaceName the name of the interface
+ * @param nameSpaceMap the namespaceMap (prefix -> namespaceURI) of the service
+ * @param addressingFlag addressing usage flag (see AddressingConstants)
+ * @param serviceName the name of the service
+ * @return the generated binding element
*/
-public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap, OMNamespace whttp,
- String interfaceName, Map nameSpaceMap, String addressingFlag, String serviceName) {
+ public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap,
+ OMNamespace whttp, String interfaceName, Map nameSpaceMap,
+ String addressingFlag, String serviceName) {
String property;
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement bindingElement;
bindingElement = omFactory.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl);
bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null,
this.name.getLocalPart()));
- bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME, null,
- tns.getPrefix() + ":" + interfaceName));
+ bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.INTERFACE_LOCAL_NAME,
+ null, tns.getPrefix() + ":" +
+ interfaceName));
if (WSDL2Constants.URI_WSDL2_SOAP.equals(type) || Constants.URI_SOAP11_HTTP.equals(type) ||
Constants.URI_SOAP12_HTTP.equals(type)) {
// SOAP Binding specific properties
- bindingElement.addAttribute(
- omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_SOAP));
- property = (String) options.get(WSDL2Constants.ATTR_WSOAP_VERSION);
+ bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE,
+ null,
+ WSDL2Constants.URI_WSDL2_SOAP));
+ property = (String)options.get(WSDL2Constants.ATTR_WSOAP_VERSION);
if (property != null) {
if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(property)) {
bindingElement.addAttribute(omFactory.createOMAttribute(
@@ -144,41 +154,44 @@
WSDL2Constants.SOAP_VERSION_1_2));
}
}
- property = (String) options.get(WSDL2Constants.ATTR_WSOAP_PROTOCOL);
+ property = (String)options.get(WSDL2Constants.ATTR_WSOAP_PROTOCOL);
if (property != null) {
bindingElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_PROTOCOL, wsoap, property));
}
- property = (String) options.get(WSDL2Constants.ATTR_WSOAP_MEP);
+ property = (String)options.get(WSDL2Constants.ATTR_WSOAP_MEP);
if (property != null) {
bindingElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_MEP_DEFAULT, wsoap, property));
}
- ArrayList soapModules = (ArrayList) options.get(WSDL2Constants.ATTR_WSOAP_MODULE);
+ ArrayList soapModules = (ArrayList)options.get(WSDL2Constants.ATTR_WSOAP_MODULE);
if (soapModules != null && soapModules.size() > 0) {
- WSDLSerializationUtil.addSOAPModuleElements(omFactory, soapModules, wsoap, bindingElement);
+ WSDLSerializationUtil
+ .addSOAPModuleElements(omFactory, soapModules, wsoap, bindingElement);
}
- WSDLSerializationUtil.addWSAddressingToBinding(addressingFlag, omFactory, bindingElement);
+ WSDLSerializationUtil
+ .addWSAddressingToBinding(addressingFlag, omFactory, bindingElement);
} else if (WSDL2Constants.URI_WSDL2_HTTP.equals(type)) {
// HTTP Binding specific properties
- property = (String) options.get(WSDL2Constants.ATTR_WHTTP_METHOD);
+ property = (String)options.get(WSDL2Constants.ATTR_WHTTP_METHOD);
if (property != null) {
bindingElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_METHOD_DEFAULT, whttp, property));
}
- bindingElement.addAttribute(
- omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE, null, WSDL2Constants.URI_WSDL2_HTTP));
+ bindingElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_TYPE,
+ null,
+ WSDL2Constants.URI_WSDL2_HTTP));
}
// Common Properties
- property = (String) options.get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING);
+ property = (String)options.get(WSDL2Constants.ATTR_WHTTP_CONTENT_ENCODING);
if (property != null) {
bindingElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_CONTENT_ENCODING_DEFAULT, whttp, property));
}
- property = (String) options.get(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR);
+ property = (String)options.get(WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR);
if (property != null) {
bindingElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_QUERY_PARAMETER_SEPERATOR_DEFAULT, whttp, property));
@@ -188,16 +201,18 @@
if (faults != null) {
Iterator iterator = faults.values().iterator();
while (iterator.hasNext()) {
- AxisBindingMessage axisBindingFault = (AxisBindingMessage) iterator.next();
- bindingElement.addChild(axisBindingFault.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap));
+ AxisBindingMessage axisBindingFault = (AxisBindingMessage)iterator.next();
+ bindingElement
+ .addChild(axisBindingFault.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap));
}
}
// Populate Binding Operations
Iterator iterator = this.getChildren();
while (iterator.hasNext()) {
- AxisBindingOperation axisBindingOperation = (AxisBindingOperation) iterator.next();
- bindingElement.addChild(axisBindingOperation.toWSDL20(wsdl, tns, wsoap, whttp, type, nameSpaceMap, serviceName));
+ AxisBindingOperation axisBindingOperation = (AxisBindingOperation)iterator.next();
+ bindingElement.addChild(axisBindingOperation.toWSDL20(wsdl, tns, wsoap, whttp, type,
+ nameSpaceMap, serviceName));
}
WSDLSerializationUtil.addWSDLDocumentationElement(this, bindingElement, omFactory, wsdl);
return bindingElement;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisBindingOperation.java Sun Jul 15 17:33:10 2007
@@ -36,6 +36,9 @@
import java.util.Collection;
import java.util.Iterator;
+/**
+ * An AxisBindingOperation represents a WSDL <bindingOperation>
+ */
public class AxisBindingOperation extends AxisDescription {
private AxisOperation axisOperation;
@@ -109,15 +112,18 @@
/**
* Generates the bindingOperation element
- * @param tns - The targetnamespace
- * @param wsoap - The SOAP namespace (WSDL 2.0)
- * @param whttp - The HTTP namespace (WSDL 2.0)
- * @param type - Indicates whether the binding is SOAP or HTTP
- * @param nameSpaceMap - The namespacemap of the service
+ * @param wsdl The WSDL namespace
+ * @param tns The targetnamespace
+ * @param wsoap The SOAP namespace (WSDL 2.0)
+ * @param whttp The HTTP namespace (WSDL 2.0)
+ * @param type Indicates whether the binding is SOAP or HTTP
+ * @param namespaceMap the service's namespace map (prefix -> namespace)
+ * @param serviceName the name of the service
* @return The generated binding element
*/
- public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap, OMNamespace whttp,
- String type, Map nameSpaceMap, String serviceName) {
+ public OMElement toWSDL20(OMNamespace wsdl, OMNamespace tns, OMNamespace wsoap,
+ OMNamespace whttp, String type, Map namespaceMap,
+ String serviceName) {
String property;
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement bindingOpElement =
@@ -195,14 +201,14 @@
AxisBindingMessage inMessage =
(AxisBindingMessage) this.getChild(WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
if (inMessage != null) {
- bindingOpElement.addChild(inMessage.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap));
+ bindingOpElement.addChild(inMessage.toWSDL20(wsdl, tns, wsoap, whttp, namespaceMap));
}
// Add the output element
AxisBindingMessage outMessage =
(AxisBindingMessage) this.getChild(WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
if (outMessage != null) {
- bindingOpElement.addChild(outMessage.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap));
+ bindingOpElement.addChild(outMessage.toWSDL20(wsdl, tns, wsoap, whttp, namespaceMap));
}
// Add any fault elements
@@ -211,7 +217,7 @@
Iterator iterator = faultValues.iterator();
while (iterator.hasNext()) {
AxisBindingMessage faultMessage = (AxisBindingMessage) iterator.next();
- bindingOpElement.addChild(faultMessage.toWSDL20(wsdl, tns, wsoap, whttp, nameSpaceMap));
+ bindingOpElement.addChild(faultMessage.toWSDL20(wsdl, tns, wsoap, whttp, namespaceMap));
}
}
WSDLSerializationUtil.addWSDLDocumentationElement(this, bindingOpElement, omFactory, wsdl);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Sun Jul 15 17:33:10 2007
@@ -196,9 +196,12 @@
* A good place to add a file extension if needed
*/
private String customSchemaNameSuffix = null;
+
/////////////////////////////////////////
// WSDL related stuff ////////////////////
////////////////////////////////////////
+
+ /** Map of prefix -> namespaceURI */
private NamespaceMap namespaceMap;
private String soapNsUri;
@@ -1826,10 +1829,21 @@
}
}
+ /**
+ * Get the namespace map for this service.
+ *
+ * @return a Map of prefix (String) to namespace URI (String)
+ * @deprecated please use getNamespaceMap()
+ */
public Map getNameSpacesMap() {
return namespaceMap;
}
+ /**
+ * Get the namespace map for this service.
+ *
+ * @return a Map of prefix (String) to namespace URI (String)
+ */
public Map getNamespaceMap() {
return namespaceMap;
}
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL11.java Sun Jul 15 17:33:10 2007
@@ -94,10 +94,9 @@
Map endpointMap = service.getEndpoints();
if (endpointMap.size() > 0) {
Iterator endpointItr = endpointMap.values().iterator();
- while (endpointItr.hasNext()) {
+ if (endpointItr.hasNext()) {
AxisEndpoint endpoint = (AxisEndpoint) endpointItr.next();
serviceEndpointURLs = new String[]{endpoint.getEndpointURL()};
- break;
}
} else {
@@ -283,7 +282,7 @@
+ " is null for " + header.getMessage());
}
messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, WSDLSerializationUtil.getPrefix(header
- .getElement().getNamespaceURI(), axisService.getNameSpacesMap())
+ .getElement().getNamespaceURI(), axisService.getNamespaceMap())
+ ":" + header.getElement().getLocalPart(), null);
}
}
@@ -307,16 +306,21 @@
} else {
messagePart.addAttribute(ATTRIBUTE_NAME, axismessage.getPartName(), null);
}
- messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME,
- WSDLSerializationUtil.getPrefix(schemaElementName.getNamespaceURI(), axisService.getNameSpacesMap()) + ":"
- + schemaElementName.getLocalPart(), null);
+ messagePart.addAttribute(ELEMENT_ATTRIBUTE_NAME, WSDLSerializationUtil.getPrefix(
+ schemaElementName.getNamespaceURI(), axisService.getNamespaceMap()) + ":" +
+ schemaElementName.getLocalPart(), null);
}
}
}
/**
- * Generate the porttypes
+ * Builds the <portType> element in the passed WSDL definition. When this returns
+ * successfully, there will be a new child element under definitons for the portType.
+ *
+ * @param fac the active OMFactory
+ * @param defintions the WSDL <definitions> element
+ * @throws Exception if there's a problem
*/
private void generatePortType(OMFactory fac, OMElement defintions)
throws Exception {
@@ -340,7 +344,7 @@
portType.addChild(operation);
operation.addAttribute(ATTRIBUTE_NAME, operationName, null);
addPolicyAsExtElement(PolicyInclude.OPERATION_POLICY, axisOperation
- .getPolicyInclude(), operation, fac);
+ .getPolicyInclude(), operation);
String MEP = axisOperation.getMessageExchangePattern();
if (WSDL2Constants.MEP_URI_IN_ONLY.equals(MEP)
@@ -363,7 +367,7 @@
input.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
+ ":" + inaxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
- inaxisMessage.getPolicyInclude(), input, fac);
+ inaxisMessage.getPolicyInclude(), input);
WSDLSerializationUtil.addWSAWActionAttribute(input, axisOperation
.getInputAction());
operation.addChild(input);
@@ -390,7 +394,7 @@
output.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
+ ":" + outAxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
- outAxisMessage.getPolicyInclude(), output, fac);
+ outAxisMessage.getPolicyInclude(), output);
WSDLSerializationUtil.addWSAWActionAttribute(output, axisOperation
.getOutputAction());
operation.addChild(output);
@@ -398,18 +402,17 @@
}
// generate fault Messages
- ArrayList faultyMessages = axisOperation.getFaultMessages();
- if (faultyMessages != null) {
- for (int i = 0; i < faultyMessages.size(); i++) {
- AxisMessage faultyMessage = (AxisMessage) faultyMessages
+ ArrayList faultMessages = axisOperation.getFaultMessages();
+ if (faultMessages != null) {
+ for (int i = 0; i < faultMessages.size(); i++) {
+ AxisMessage faultyMessage = (AxisMessage) faultMessages
.get(i);
- OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME,
- wsdl);
- WSDLSerializationUtil.addWSDLDocumentationElement(faultyMessage, fault, fac, wsdl);
+ OMElement fault = fac.createOMElement(FAULT_LOCAL_NAME, wsdl);
+ WSDLSerializationUtil.addWSDLDocumentationElement(faultyMessage,
+ fault, fac, wsdl);
fault.addAttribute(MESSAGE_LOCAL_NAME, tns.getPrefix()
+ ":" + faultyMessage.getName(), null);
- fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(),
- null);
+ fault.addAttribute(ATTRIBUTE_NAME, faultyMessage.getName(), null);
WSDLSerializationUtil.addWSAWActionAttribute(fault, axisOperation
.getFaultAction(faultyMessage.getName()));
// TODO add policies for fault messages
@@ -421,7 +424,12 @@
}
/**
- * Generate the service
+ * Generate the WSDL <service> element
+ *
+ * @param fac the active OMFactory
+ * @param defintions the WSDL <definitions> element under which to put the service
+ * @param disableREST if false, generate REST binding, if true, don't
+ * @throws Exception if there's a problem
*/
public void generateService(OMFactory fac, OMElement defintions, boolean disableREST)
throws Exception {
@@ -432,7 +440,7 @@
generateSOAP12Ports(fac, service);
addPolicyAsExtElement(PolicyInclude.SERVICE_POLICY, axisService
- .getPolicyInclude(), service, fac);
+ .getPolicyInclude(), service);
if (!disableREST) {
generateHTTPPorts(fac, service);
}
@@ -443,11 +451,7 @@
for (int i = 0; i < serviceEndpointURLs.length; i++) {
String urlString = serviceEndpointURLs[i];
if (urlString != null) {
- String protocol = urlString == null ? null : new URI(urlString)
- .getScheme();
- if (urlString == null) {
- urlString = "REPLACE_WITH_ACTUAL_URL";
- }
+ String protocol = new URI(urlString).getScheme();
OMElement port = fac.createOMElement(PORT, wsdl);
service.addChild(port);
String name = axisService.getName() + SOAP11PORT
@@ -462,7 +466,7 @@
soap);
addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
- .getPolicyInclude(), port, fac);
+ .getPolicyInclude(), port);
}
}
@@ -495,11 +499,7 @@
for (int i = 0; i < serviceEndpointURLs.length; i++) {
String urlString = serviceEndpointURLs[i];
if (urlString != null) {
- String protocol = urlString == null ? null : new URI(urlString)
- .getScheme();
- if (urlString == null) {
- urlString = "REPLACE_WITH_ACTUAL_URL";
- }
+ String protocol = new URI(urlString).getScheme();
OMElement port = fac.createOMElement(PORT, wsdl);
service.addChild(port);
String name = axisService.getName() + SOAP12PORT
@@ -514,13 +514,17 @@
soap12);
addPolicyAsExtElement(PolicyInclude.PORT_POLICY, axisService
- .getPolicyInclude(), port, fac);
+ .getPolicyInclude(), port);
}
}
}
/**
- * Generate the bindings
+ * Generate the <binding> for SOAP 1.1 underneath the passed definitions
+ *
+ * @param fac the active OMFactory
+ * @param defintions the WSDL <definitions> element under which to put the binding
+ * @throws Exception if there's a problem
*/
private void generateSOAP11Binding(OMFactory fac, OMElement defintions)
throws Exception {
@@ -532,9 +536,9 @@
+ axisService.getName() + PORT_TYPE_SUFFIX, null);
addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService
- .getPolicyInclude(), binding, fac);
+ .getPolicyInclude(), binding);
addPolicyAsExtElement(PolicyInclude.BINDING_POLICY, axisService
- .getPolicyInclude(), binding, fac);
+ .getPolicyInclude(), binding);
// Adding ext elements
addExtensionElement(fac, binding, BINDING_LOCAL_NAME, TRANSPORT,
@@ -577,9 +581,9 @@
SOAP_ACTION, soapAction, STYLE, style, soap);
addPolicyAsExtElement(PolicyInclude.BINDING_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation);
addPolicyAsExtElement(PolicyInclude.AXIS_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation);
String MEP = axisOperation.getMessageExchangePattern();
@@ -603,7 +607,7 @@
addExtensionElement(fac, input, SOAP_BODY, SOAP_USE, use,
null, targetNamespace, soap);
addPolicyAsExtElement(PolicyInclude.BINDING_INPUT_POLICY,
- inaxisMessage.getPolicyInclude(), input, fac);
+ inaxisMessage.getPolicyInclude(), input);
operation.addChild(input);
writeSoapHeaders(inaxisMessage, fac, input, soap);
}
@@ -628,7 +632,7 @@
addExtensionElement(fac, output, SOAP_BODY, SOAP_USE, use,
null, targetNamespace, soap);
addPolicyAsExtElement(PolicyInclude.BINDING_OUTPUT_POLICY,
- outAxisMessage.getPolicyInclude(), output, fac);
+ outAxisMessage.getPolicyInclude(), output);
operation.addChild(output);
writeSoapHeaders(outAxisMessage, fac, output, soap);
}
@@ -656,7 +660,11 @@
}
/**
- * Generate the bindings
+ * Generate the <binding> for SOAP 1.2 underneath the passed definitions
+ *
+ * @param fac the active OMFactory
+ * @param defintions the WSDL <definitions> element under which to put the binding
+ * @throws Exception if there's a problem
*/
private void generateSOAP12Binding(OMFactory fac, OMElement defintions)
throws Exception {
@@ -668,9 +676,9 @@
+ axisService.getName() + PORT_TYPE_SUFFIX, null);
addPolicyAsExtElement(PolicyInclude.AXIS_SERVICE_POLICY, axisService
- .getPolicyInclude(), binding, fac);
+ .getPolicyInclude(), binding);
addPolicyAsExtElement(PolicyInclude.BINDING_POLICY, axisService
- .getPolicyInclude(), binding, fac);
+ .getPolicyInclude(), binding);
// Adding ext elements
addExtensionElement(fac, binding, BINDING_LOCAL_NAME, TRANSPORT,
@@ -713,9 +721,9 @@
SOAP_ACTION, soapAction, STYLE, style, soap12);
addPolicyAsExtElement(PolicyInclude.BINDING_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation);
addPolicyAsExtElement(PolicyInclude.AXIS_OPERATION_POLICY,
- axisOperation.getPolicyInclude(), operation, fac);
+ axisOperation.getPolicyInclude(), operation);
String MEP = axisOperation.getMessageExchangePattern();
@@ -739,7 +747,7 @@
addExtensionElement(fac, input, SOAP_BODY, SOAP_USE, use,
null, targetNamespace, soap12);
addPolicyAsExtElement(PolicyInclude.BINDING_INPUT_POLICY,
- inaxisMessage.getPolicyInclude(), input, fac);
+ inaxisMessage.getPolicyInclude(), input);
operation.addChild(input);
writeSoapHeaders(inaxisMessage, fac, input, soap12);
}
@@ -764,7 +772,7 @@
addExtensionElement(fac, output, SOAP_BODY, SOAP_USE, use,
null, targetNamespace, soap12);
addPolicyAsExtElement(PolicyInclude.BINDING_OUTPUT_POLICY,
- outAxisMessage.getPolicyInclude(), output, fac);
+ outAxisMessage.getPolicyInclude(), output);
operation.addChild(output);
writeSoapHeaders(outAxisMessage, fac, output, soap12);
}
@@ -917,13 +925,14 @@
extElement.addAttribute("part", header.part(), null);
}
if (header.getMessage() != null) {
- extElement.addAttribute("message", WSDLSerializationUtil.getPrefix(targetNamespace, axisService.getNameSpacesMap()) + ":"
- + header.getMessage().getLocalPart(), null);
+ extElement.addAttribute("message", WSDLSerializationUtil
+ .getPrefix(targetNamespace, axisService.getNamespaceMap()) + ":" +
+ header.getMessage().getLocalPart(), null);
}
}
- private void addPolicyAsExtElement(int type, PolicyInclude policyInclude,
- OMElement element, OMFactory factory) throws Exception {
+ private void addPolicyAsExtElement(int type, PolicyInclude policyInclude, OMElement element)
+ throws Exception {
ArrayList elementList = policyInclude.getPolicyElements(type);
for (Iterator iterator = elementList.iterator(); iterator.hasNext();) {
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService2WSDL20.java Sun Jul 15 17:33:10 2007
@@ -60,7 +60,7 @@
*/
public OMElement generateOM() throws Exception {
- Map nameSpacesMap = axisService.getNameSpacesMap();
+ Map nameSpacesMap = axisService.getNamespaceMap();
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMNamespace wsdl;
@@ -245,7 +245,7 @@
descriptionElement
.addChild(binding.toWSDL20(wsdl, tns, wsoap, whttp,
interfaceName,
- axisService.getNameSpacesMap(),
+ axisService.getNamespaceMap(),
axisService.getWSAddressingFlag(),
axisService.getName()));
}
@@ -277,11 +277,12 @@
/**
* Generates the interface element for the service
*
- * @param tns - The target namespace
- * @param wsdlx - wsdl extentions namespace
- * @param fac - OMFactory
- * @param interfaceName - The name of the interface
- * @return - The generated interface element
+ * @param wsdl The WSDL namespace
+ * @param tns The target namespace
+ * @param wsdlx The WSDL extensions namespace
+ * @param fac The active OMFactory
+ * @param interfaceName The name of the interface
+ * @return The generated interface element
*/
private OMElement getInterfaceElement(OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx,
OMFactory fac, String interfaceName) {
@@ -311,7 +312,7 @@
fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, name));
faultElement.addAttribute(fac.createOMAttribute(
WSDL2Constants.ATTRIBUTE_ELEMENT, null, WSDLSerializationUtil
- .getElementName(faultMessage, axisService.getNameSpacesMap())));
+ .getElementName(faultMessage, axisService.getNamespaceMap())));
interfaceFaults.add(name);
interfaceElement.addChild(faultElement);
}
@@ -327,10 +328,11 @@
/**
* Generates the service element for the service
*
- * @param tns - The target namespace
- * @param omFactory - OMFactory
- * @param interfaceName - The name of the interface
- * @return - The generated service element
+ * @param wsdl the WSDL namespace
+ * @param tns the target namespace
+ * @param omFactory the active OMFactory
+ * @param interfaceName the name of the interface
+ * @return the generated service element
*/
private OMElement getServiceElement(OMNamespace wsdl, OMNamespace tns, OMFactory omFactory,
String interfaceName) {
@@ -349,11 +351,17 @@
* Generates the interface Operation element. As with the binding operations we dont need to
* ask AxisMessage to serialize its message cause AxisMessage does not have specific properties
* as bindings.
- * @param tns - The targetnamespace
- * @param wsdlx - The WSDL extentions namespace (WSDL 2.0)
- * @return The generated binding element
+ *
+ * @param axisOperation the operation to write
+ * @param wsdl the WSDL namespace
+ * @param tns the target namespace
+ * @param wsdlx the WSDL extentions namespace (WSDL 2.0)
+ * @return the generated <operation> element
*/
- public OMElement generateInterfaceOperationElement(AxisOperation axisOperation, OMNamespace wsdl, OMNamespace tns, OMNamespace wsdlx) {
+ public OMElement generateInterfaceOperationElement(AxisOperation axisOperation,
+ OMNamespace wsdl,
+ OMNamespace tns,
+ OMNamespace wsdlx) {
OMFactory omFactory = OMAbstractFactory.getOMFactory();
OMElement axisOperationElement =
omFactory.createOMElement(WSDL2Constants.OPERATION_LOCAL_NAME, wsdl);
@@ -379,7 +387,7 @@
WSDL2Constants.ATTRIBUTE_SAFE, wsdlx, (param.getValue()).toString()));
}
AxisService axisService = axisOperation.getAxisService();
- Map nameSpaceMap = axisService.getNameSpacesMap();
+ Map nameSpaceMap = axisService.getNamespaceMap();
// Add the input element
AxisMessage inMessage = (AxisMessage) axisOperation.getChild(WSDLConstants.WSDL_MESSAGE_IN_MESSAGE);
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Sun Jul 15 17:33:10 2007
@@ -221,7 +221,6 @@
*/
public AxisService populateService() throws AxisFault {
try {
-
setup();
// Setting wsdl4jdefintion to axisService , so if some one want
// to play with it he can do that by getting the parameter
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDLToAxisServiceBuilder.java Sun Jul 15 17:33:10 2007
@@ -105,9 +105,9 @@
}
/**
- * Sets a custom xmlschema resolver
+ * Sets a custom xmlschema URI resolver
*
- * @param customResolver
+ * @param customResolver a URIResolver to use when working with schemas
*/
public void setCustomResolver(URIResolver customResolver) {
this.customResolver = customResolver;
@@ -142,10 +142,12 @@
/**
* Find the XML schema prefix
+ *
+ * @return the active schema prefix, or the default schema prefix if not declared
*/
protected String findSchemaPrefix() {
String xsdPrefix = null;
- Map declaredNameSpaces = axisService.getNameSpacesMap();
+ Map declaredNameSpaces = axisService.getNamespaceMap();
if (declaredNameSpaces.containsValue(XMLSCHEMA_NAMESPACE_URI)) {
//loop and find the prefix
Iterator it = declaredNameSpaces.keySet().iterator();
@@ -167,6 +169,8 @@
/**
* Utility method that returns a DOM Builder
+ *
+ * @return a namespace-aware DOM DocumentBuilder
*/
protected DocumentBuilder getDOMDocumentBuilder() {
DocumentBuilder documentBuilder;
@@ -182,6 +186,9 @@
}
/**
+ * Get a temporary namespace prefix. NOT threadsafe.
+ *
+ * @return a new namespace prefix of the form "nsX"
*/
protected String getTemporaryNamespacePrefix() {
return "ns" + nsCount++;
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/util/WSDLSerializationUtil.java Sun Jul 15 17:33:10 2007
@@ -24,7 +24,6 @@
import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.java2wsdl.Java2WSDLConstants;
-import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.wsdl.SOAPHeaderMessage;
import org.apache.axis2.wsdl.SOAPModuleMessage;
import org.apache.axis2.wsdl.HTTPHeaderMessage;
@@ -112,10 +111,10 @@
getPrefix(qName.getNamespaceURI(), nameSpaceMap) + ":" + qName.getLocalPart()));
soapHeaderElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_MUST_UNDERSTAND, null,
- new Boolean(soapHeaderMessage.isMustUnderstand()).toString()));
+ Boolean.toString(soapHeaderMessage.isMustUnderstand())));
soapHeaderElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_REQUIRED, null,
- new Boolean(soapHeaderMessage.isRequired()).toString()));
+ Boolean.toString(soapHeaderMessage.isRequired())));
element.addChild(soapHeaderElement);
}
}
@@ -161,7 +160,7 @@
getPrefix(qName.getNamespaceURI(), nameSpaceMap) + ":" + qName.getLocalPart()));
httpHeaderElement.addAttribute(omFactory.createOMAttribute(
WSDL2Constants.ATTRIBUTE_REQUIRED, null,
- new Boolean(httpHeaderMessage.isRequired()).toString()));
+ Boolean.valueOf(httpHeaderMessage.isRequired()).toString()));
element.addChild(httpHeaderElement);
}
}
@@ -170,12 +169,14 @@
* Generates a default SOAP 11 Binding for a given AxisService
* @param fac - The OMFactory
* @param axisService - The AxisService
+ * @param wsdl the WSDL namespace
* @param wsoap - The WSDL 2.0 SOAP namespace
* @param tns - The target namespace
* @return - The generated SOAP11Binding element
*/
public static OMElement generateSOAP11Binding(OMFactory fac, AxisService axisService,
- OMNamespace wsdl, OMNamespace wsoap, OMNamespace tns) {
+ OMNamespace wsdl, OMNamespace wsoap,
+ OMNamespace tns) {
OMElement binding = fac.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl);
binding.addAttribute(
fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, axisService.getName() +
@@ -195,12 +196,14 @@
* Generates a default SOAP 12 Binding for a given AxisService
* @param fac - The OMFactory
* @param axisService - The AxisService
+ * @param wsdl the WSDL namespace
* @param wsoap - The WSDL 2.0 SOAP namespace
* @param tns - The target namespace
* @return - The generated SOAP12Binding element
*/
public static OMElement generateSOAP12Binding(OMFactory fac, AxisService axisService,
- OMNamespace wsdl, OMNamespace wsoap, OMNamespace tns) {
+ OMNamespace wsdl, OMNamespace wsoap,
+ OMNamespace tns) {
OMElement binding = fac.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl);
binding.addAttribute(
fac.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME, null, axisService.getName() +
@@ -220,12 +223,14 @@
* Generates a default HTTP Binding for a given AxisService
* @param fac - The OMFactory
* @param axisService - The AxisService
+ * @param wsdl the WSDL namespace
* @param whttp - The WSDL 2.0 HTTP namespace
* @param tns - The target namespace
* @return - The generated HTTPBinding element
*/
public static OMElement generateHTTPBinding(OMFactory fac, AxisService axisService,
- OMNamespace wsdl, OMNamespace whttp, OMNamespace tns) {
+ OMNamespace wsdl, OMNamespace whttp,
+ OMNamespace tns) {
OMElement binding = fac.createOMElement(WSDL2Constants.BINDING_LOCAL_NAME, wsdl);
String serviceName = axisService.getName();
binding.addAttribute(
@@ -266,19 +271,22 @@
/**
* Generates a default service element
* @param omFactory - The OMFactory
+ * @param wsdl the WSDL namespace
* @param tns - The targetnamespace
* @param axisService - The AxisService
+ * @param disableREST only generate REST endpoint if this is false
* @return - The generated service element
* @throws AxisFault - Thrown in case an exception occurs
*/
- public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl, OMNamespace tns,
- AxisService axisService, boolean disableREST)
+ public static OMElement generateServiceElement(OMFactory omFactory, OMNamespace wsdl,
+ OMNamespace tns, AxisService axisService,
+ boolean disableREST)
throws AxisFault {
String[] eprs = axisService.getEPRs();
if (eprs == null) {
eprs = new String[]{axisService.getName()};
}
- OMElement serviceElement = null;
+ OMElement serviceElement;
serviceElement = omFactory.createOMElement(WSDL2Constants.SERVICE_LOCAL_NAME, wsdl);
serviceElement.addAttribute(omFactory.createOMAttribute(WSDL2Constants.ATTRIBUTE_NAME,
null, axisService.getName()));
@@ -398,19 +406,19 @@
extElement.addAttribute(att1Name, att1Value, null);
}
- public static void addWSAddressingToBinding(String addressingFlag, OMFactory omFactory, OMElement bindingElement) {
+ public static void addWSAddressingToBinding(String addressingFlag,
+ OMFactory omFactory,
+ OMElement bindingElement) {
// Add WS-Addressing UsingAddressing element if appropriate
// SHOULD be on the binding element per the specification
- if (addressingFlag.equals(
- AddressingConstants.ADDRESSING_OPTIONAL)) {
+ if (addressingFlag.equals(AddressingConstants.ADDRESSING_OPTIONAL)) {
OMNamespace wsawNamespace = omFactory.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
WSDLSerializationUtil.addExtensionElement(omFactory, bindingElement,
AddressingConstants.USING_ADDRESSING,
"required", "true",
wsawNamespace);
- } else if (addressingFlag.equals(
- AddressingConstants.ADDRESSING_REQUIRED)) {
+ } else if (addressingFlag.equals(AddressingConstants.ADDRESSING_REQUIRED)) {
OMNamespace wsawNamespace = omFactory.createOMNamespace(
AddressingConstants.Final.WSAW_NAMESPACE, "wsaw");
WSDLSerializationUtil.addExtensionElement(omFactory, bindingElement,
Modified: webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java?view=diff&rev=556481&r1=556480&r2=556481
==============================================================================
--- webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java (original)
+++ webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java Sun Jul 15 17:33:10 2007
@@ -125,10 +125,10 @@
Map nameSpacesMap = new HashMap();
List axisServices = cgconfig.getAxisServices();
- AxisService axisService = null;
+ AxisService axisService;
for (Iterator iter = axisServices.iterator(); iter.hasNext();) {
axisService = (AxisService)iter.next();
- nameSpacesMap.putAll(axisService.getNameSpacesMap());
+ nameSpacesMap.putAll(axisService.getNamespaceMap());
}
// process all the schemas and make a list of all of them for
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org