You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-commits@axis.apache.org by ve...@apache.org on 2018/01/08 10:44:26 UTC
svn commit: r1820547 [2/3] - in
/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2:
description/ engine/
Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=1820547&r1=1820546&r2=1820547&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/description/AxisService.java Mon Jan 8 10:44:26 2018
@@ -131,179 +131,179 @@ import java.util.concurrent.CopyOnWriteA
*/
public class AxisService extends AxisDescription {
- // ////////////////////////////////////////////////////////////////
- // Standard Parameter names
+ // ////////////////////////////////////////////////////////////////
+ // Standard Parameter names
- /**
- * If this param is true, and the service has exactly one AxisOperation,
- * normal operation dispatch (via URI/soapAction/etc) will not be necessary,
- * and we'll just default to funneling all messages to that op. This is
- * useful for passthrough/ESB/embedded applications.
- */
- public static final String SUPPORT_SINGLE_OP = "supportSingleOperation";
- // ////////////////////////////////////////////////////////////////
-
- public static final String IMPORT_TAG = "import";
- public static final String INCLUDE_TAG = "include";
- public static final String SCHEMA_LOCATION = "schemaLocation";
-
- private Map<String, AxisEndpoint> endpointMap = new HashMap<String, AxisEndpoint>();
-
- /*
- * This is a map between the QName of the element of a message specified in
- * the WSDL and an Operation. It enables SOAP Body-based dispatching for
- * doc-literal bindings.
- */
- private Map<QName, AxisOperation> messageElementQNameToOperationMap = new HashMap<QName, AxisOperation>();
-
- private int nsCount = 0;
- private static final Log log = LogFactory.getLog(AxisService.class);
- private URL fileName;
-
- // Maps httpLocations to corresponding operations. Used to dispatch rest
- // messages.
- private HashMap<String, AxisOperation> httpLocationDispatcherMap = null;
-
- // A map of (String alias, AxisOperation operation). The aliases might
- // include: SOAPAction,
- // WS-Addressing action, the operation name, the AxisInputMessage name. See:
- // - invalidOperationsAliases
- // - mapActionToOperatoin()
- // - getOperationByAction()
- // REVIEW: This really should be seperate maps for the different types of
- // aliases so they don't
- // conflict with each other. For example, so that an identical operation
- // name and soap action
- // on different operatoins don't cause a collision; the following can't be
- // routed because
- // "foo" is not unique across different operations:
- // operation 1: action = foo, name = bar
- // operation 2: action = bar, name = foo
- private HashMap<String, AxisOperation> operationsAliasesMap = null;
-
- // Collection of aliases that are invalid for this service because they are
- // duplicated across
- // multiple operations under this service.
- private List<String> invalidOperationsAliases = null;
- // private HashMap operations = new HashMap();
-
- // to store module ref at deploy time parsing
- private ArrayList<String> moduleRefs = null;
-
- // to keep the time that last update time of the service
- private long lastupdate;
- private HashMap<String, ModuleConfiguration> moduleConfigmap;
- private String name;
- private ClassLoader serviceClassLoader;
-
- // to keep the XMLScheam getting either from WSDL or java2wsdl
- private ArrayList<XmlSchema> schemaList;
- // private XmlSchema schema;
-
- // wsdl is there for this service or not (in side META-INF)
- private boolean wsdlFound = false;
-
- // to store the scope of the service
- private String scope;
-
- // to store default message receivers
- private HashMap<String, MessageReceiver> messageReceivers;
-
- // to set the handler chain available in phase info
- private boolean useDefaultChains = true;
-
- // to keep the status of the service , since service can stop at the run
- // time
- private boolean active = true;
-
- private boolean elementFormDefault = true;
-
- // to keep the service target name space
- private String targetNamespace = Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE;
- private String targetNamespacePrefix = Java2WSDLConstants.TARGETNAMESPACE_PREFIX;
-
- // to store the target namespace for the schema
- private String schematargetNamespace;// = Java2WSDLConstants.AXIS2_XSD;
- private String schematargetNamespacePrefix = Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX;
-
- private boolean enableAllTransports = true;
- private List<String> exposedTransports = new ArrayList<String>();
-
- // To keep reference to ServiceLifeCycle instance , if the user has
- // specified in services.xml
- private ServiceLifeCycle serviceLifeCycle;
-
- /**
- * Keeps track whether the schema locations are adjusted
- */
- private boolean schemaLocationsAdjusted = false;
-
- private boolean wsdlImportLocationAdjusted = false;
-
- /**
- * A table that keeps a mapping of unique xsd names (Strings) against the
- * schema objects. This is populated in the first instance the schemas are
- * asked for and then used to serve the subsequent requests
- */
- private Map schemaMappingTable = null;
-
- /**
- * counter variable for naming the schemas
- */
- private int count = 0;
- /**
- * A custom schema Name prefix. if set this will be used to modify the
- * schema names
- */
- private String customSchemaNamePrefix = null;
-
- /**
- * A custom schema name suffix. will be attached to the schema file name
- * when the files are uniquely named. 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;
- private String endpointName;
- private String endpointURL;
+ /**
+ * If this param is true, and the service has exactly one AxisOperation,
+ * normal operation dispatch (via URI/soapAction/etc) will not be necessary,
+ * and we'll just default to funneling all messages to that op. This is
+ * useful for passthrough/ESB/embedded applications.
+ */
+ public static final String SUPPORT_SINGLE_OP = "supportSingleOperation";
+ // ////////////////////////////////////////////////////////////////
+
+ public static final String IMPORT_TAG = "import";
+ public static final String INCLUDE_TAG = "include";
+ public static final String SCHEMA_LOCATION = "schemaLocation";
+
+ private Map<String, AxisEndpoint> endpointMap = new HashMap<String, AxisEndpoint>();
+
+ /*
+ * This is a map between the QName of the element of a message specified in
+ * the WSDL and an Operation. It enables SOAP Body-based dispatching for
+ * doc-literal bindings.
+ */
+ private Map<QName, AxisOperation> messageElementQNameToOperationMap = new HashMap<QName, AxisOperation>();
+
+ private int nsCount = 0;
+ private static final Log log = LogFactory.getLog(AxisService.class);
+ private URL fileName;
+
+ // Maps httpLocations to corresponding operations. Used to dispatch rest
+ // messages.
+ private HashMap<String, AxisOperation> httpLocationDispatcherMap = null;
+
+ // A map of (String alias, AxisOperation operation). The aliases might
+ // include: SOAPAction,
+ // WS-Addressing action, the operation name, the AxisInputMessage name. See:
+ // - invalidOperationsAliases
+ // - mapActionToOperatoin()
+ // - getOperationByAction()
+ // REVIEW: This really should be seperate maps for the different types of
+ // aliases so they don't
+ // conflict with each other. For example, so that an identical operation
+ // name and soap action
+ // on different operatoins don't cause a collision; the following can't be
+ // routed because
+ // "foo" is not unique across different operations:
+ // operation 1: action = foo, name = bar
+ // operation 2: action = bar, name = foo
+ private HashMap<String, AxisOperation> operationsAliasesMap = null;
+
+ // Collection of aliases that are invalid for this service because they are
+ // duplicated across
+ // multiple operations under this service.
+ private List<String> invalidOperationsAliases = null;
+ // private HashMap operations = new HashMap();
+
+ // to store module ref at deploy time parsing
+ private ArrayList<String> moduleRefs = null;
+
+ // to keep the time that last update time of the service
+ private long lastupdate;
+ private HashMap<String, ModuleConfiguration> moduleConfigmap;
+ private String name;
+ private ClassLoader serviceClassLoader;
+
+ // to keep the XMLScheam getting either from WSDL or java2wsdl
+ private ArrayList<XmlSchema> schemaList;
+ // private XmlSchema schema;
+
+ // wsdl is there for this service or not (in side META-INF)
+ private boolean wsdlFound = false;
+
+ // to store the scope of the service
+ private String scope;
+
+ // to store default message receivers
+ private HashMap<String, MessageReceiver> messageReceivers;
+
+ // to set the handler chain available in phase info
+ private boolean useDefaultChains = true;
+
+ // to keep the status of the service , since service can stop at the run
+ // time
+ private boolean active = true;
+
+ private boolean elementFormDefault = true;
+
+ // to keep the service target name space
+ private String targetNamespace = Java2WSDLConstants.DEFAULT_TARGET_NAMESPACE;
+ private String targetNamespacePrefix = Java2WSDLConstants.TARGETNAMESPACE_PREFIX;
+
+ // to store the target namespace for the schema
+ private String schematargetNamespace;// = Java2WSDLConstants.AXIS2_XSD;
+ private String schematargetNamespacePrefix = Java2WSDLConstants.SCHEMA_NAMESPACE_PRFIX;
+
+ private boolean enableAllTransports = true;
+ private List<String> exposedTransports = new ArrayList<String>();
+
+ // To keep reference to ServiceLifeCycle instance , if the user has
+ // specified in services.xml
+ private ServiceLifeCycle serviceLifeCycle;
+
+ /**
+ * Keeps track whether the schema locations are adjusted
+ */
+ private boolean schemaLocationsAdjusted = false;
+
+ private boolean wsdlImportLocationAdjusted = false;
+
+ /**
+ * A table that keeps a mapping of unique xsd names (Strings) against the
+ * schema objects. This is populated in the first instance the schemas are
+ * asked for and then used to serve the subsequent requests
+ */
+ private Map schemaMappingTable = null;
+
+ /**
+ * counter variable for naming the schemas
+ */
+ private int count = 0;
+ /**
+ * A custom schema Name prefix. if set this will be used to modify the
+ * schema names
+ */
+ private String customSchemaNamePrefix = null;
+
+ /**
+ * A custom schema name suffix. will be attached to the schema file name
+ * when the files are uniquely named. 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;
+ private String endpointName;
+ private String endpointURL;
private List importedNamespaces;
- private boolean clientSide = false;
+ private boolean clientSide = false;
- // To keep a ref to ObjectSupplier instance
- private ObjectSupplier objectSupplier;
+ // To keep a ref to ObjectSupplier instance
+ private ObjectSupplier objectSupplier;
- // package to namespace mapping
- private Map p2nMap;
+ // package to namespace mapping
+ private Map p2nMap;
- // to keep the exclude property details
- private ExcludeInfo excludeInfo;
-
- private TypeTable typeTable;
-
- // Data Locators for WS-Mex Support
- private HashMap dataLocators;
- private HashMap<String, String> dataLocatorClassNames;
- private AxisDataLocatorImpl defaultDataLocator;
- // Define search sequence for datalocator based on Data Locator types.
- LocatorType[] availableDataLocatorTypes = new LocatorType[] {
- LocatorType.SERVICE_DIALECT, LocatorType.SERVICE_LEVEL,
- LocatorType.GLOBAL_DIALECT, LocatorType.GLOBAL_LEVEL,
- LocatorType.DEFAULT_AXIS };
+ // to keep the exclude property details
+ private ExcludeInfo excludeInfo;
+
+ private TypeTable typeTable;
+
+ // Data Locators for WS-Mex Support
+ private HashMap dataLocators;
+ private HashMap<String, String> dataLocatorClassNames;
+ private AxisDataLocatorImpl defaultDataLocator;
+ // Define search sequence for datalocator based on Data Locator types.
+ LocatorType[] availableDataLocatorTypes = new LocatorType[] {
+ LocatorType.SERVICE_DIALECT, LocatorType.SERVICE_LEVEL,
+ LocatorType.GLOBAL_DIALECT, LocatorType.GLOBAL_LEVEL,
+ LocatorType.DEFAULT_AXIS };
- // name of the binding used : use in codegeneration
- private String bindingName;
+ // name of the binding used : use in codegeneration
+ private String bindingName;
- // List of MessageContextListeners that listen for events on the MessageContext
+ // List of MessageContextListeners that listen for events on the MessageContext
private CopyOnWriteArrayList<MessageContextListener> messageContextListeners =
new CopyOnWriteArrayList<MessageContextListener>();
@@ -313,314 +313,314 @@ public class AxisService extends AxisDes
// Excluded operations name list to know which operations to exclude.
private List excludeOperationsNameList;
- private String[] eprs;
- private boolean customWsdl = false;
+ private String[] eprs;
+ private boolean customWsdl = false;
+
+ private HashMap policyMap = new HashMap();
+
+ public AxisEndpoint getEndpoint(String key) {
+ return (AxisEndpoint) endpointMap.get(key);
+ }
+
+ public void addEndpoint(String key, AxisEndpoint axisEndpoint) {
+ this.endpointMap.put(key, axisEndpoint);
+ }
+
+ public boolean isSchemaLocationsAdjusted() {
+ return schemaLocationsAdjusted;
+ }
+
+ public void setSchemaLocationsAdjusted(boolean schemaLocationsAdjusted) {
+ this.schemaLocationsAdjusted = schemaLocationsAdjusted;
+ }
+
+ public Map getSchemaMappingTable() {
+ return schemaMappingTable;
+ }
+
+ public void setSchemaMappingTable(Map schemaMappingTable) {
+ this.schemaMappingTable = schemaMappingTable;
+ }
+
+ public String getCustomSchemaNamePrefix() {
+ return customSchemaNamePrefix;
+ }
+
+ public void setCustomSchemaNamePrefix(String customSchemaNamePrefix) {
+ this.customSchemaNamePrefix = customSchemaNamePrefix;
+ }
+
+ public String getCustomSchemaNameSuffix() {
+ return customSchemaNameSuffix;
+ }
+
+ public void setCustomSchemaNameSuffix(String customSchemaNameSuffix) {
+ this.customSchemaNameSuffix = customSchemaNameSuffix;
+ }
+
+ /**
+ * Constructor AxisService.
+ */
+ public AxisService() {
+ super();
+ this.operationsAliasesMap = new HashMap();
+ this.invalidOperationsAliases = new ArrayList();
+ this.excludeOperationsNameList = new ArrayList();
+ moduleConfigmap = new HashMap();
+ // by default service scope is for the request
+ scope = Constants.SCOPE_REQUEST;
+ httpLocationDispatcherMap = new HashMap();
+ messageReceivers = new HashMap();
+ moduleRefs = new ArrayList();
+ schemaList = new ArrayList();
+ serviceClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController
+ .doPrivileged(new PrivilegedAction<ClassLoader>() {
+ public ClassLoader run() {
+ return Thread.currentThread().getContextClassLoader();
+ }
+ });
+ objectSupplier = new DefaultObjectSupplier();
+ dataLocators = new HashMap();
+ dataLocatorClassNames = new HashMap();
+ }
+
+ public String getBindingName() {
+ return bindingName;
+ }
+
+ public void setBindingName(String bindingName) {
+ this.bindingName = bindingName;
+ }
- private HashMap policyMap = new HashMap();
+ /**
+ * get the SOAPVersion
+ */
+ public String getSoapNsUri() {
+ return soapNsUri;
+ }
- public AxisEndpoint getEndpoint(String key) {
- return (AxisEndpoint) endpointMap.get(key);
- }
-
- public void addEndpoint(String key, AxisEndpoint axisEndpoint) {
- this.endpointMap.put(key, axisEndpoint);
- }
-
- public boolean isSchemaLocationsAdjusted() {
- return schemaLocationsAdjusted;
- }
-
- public void setSchemaLocationsAdjusted(boolean schemaLocationsAdjusted) {
- this.schemaLocationsAdjusted = schemaLocationsAdjusted;
- }
-
- public Map getSchemaMappingTable() {
- return schemaMappingTable;
- }
-
- public void setSchemaMappingTable(Map schemaMappingTable) {
- this.schemaMappingTable = schemaMappingTable;
- }
-
- public String getCustomSchemaNamePrefix() {
- return customSchemaNamePrefix;
- }
-
- public void setCustomSchemaNamePrefix(String customSchemaNamePrefix) {
- this.customSchemaNamePrefix = customSchemaNamePrefix;
- }
-
- public String getCustomSchemaNameSuffix() {
- return customSchemaNameSuffix;
- }
-
- public void setCustomSchemaNameSuffix(String customSchemaNameSuffix) {
- this.customSchemaNameSuffix = customSchemaNameSuffix;
- }
-
- /**
- * Constructor AxisService.
- */
- public AxisService() {
- super();
- this.operationsAliasesMap = new HashMap();
- this.invalidOperationsAliases = new ArrayList();
- this.excludeOperationsNameList = new ArrayList();
- moduleConfigmap = new HashMap();
- // by default service scope is for the request
- scope = Constants.SCOPE_REQUEST;
- httpLocationDispatcherMap = new HashMap();
- messageReceivers = new HashMap();
- moduleRefs = new ArrayList();
- schemaList = new ArrayList();
- serviceClassLoader = (ClassLoader) org.apache.axis2.java.security.AccessController
- .doPrivileged(new PrivilegedAction<ClassLoader>() {
- public ClassLoader run() {
- return Thread.currentThread().getContextClassLoader();
- }
- });
- objectSupplier = new DefaultObjectSupplier();
- dataLocators = new HashMap();
- dataLocatorClassNames = new HashMap();
- }
-
- public String getBindingName() {
- return bindingName;
- }
-
- public void setBindingName(String bindingName) {
- this.bindingName = bindingName;
- }
-
- /**
- * get the SOAPVersion
- */
- public String getSoapNsUri() {
- return soapNsUri;
- }
-
- public void setSoapNsUri(String soapNsUri) {
- this.soapNsUri = soapNsUri;
- }
-
- /**
- * get the endpointName
- */
- public String getEndpointName() {
- return endpointName;
- }
-
- public void setEndpointName(String endpoint) {
- this.endpointName = endpoint;
- }
-
- /**
- * Constructor AxisService.
- */
- public AxisService(String name) {
- this();
- this.name = name;
- }
+ public void setSoapNsUri(String soapNsUri) {
+ this.soapNsUri = soapNsUri;
+ }
- @SuppressWarnings("deprecation")
+ /**
+ * get the endpointName
+ */
+ public String getEndpointName() {
+ return endpointName;
+ }
+
+ public void setEndpointName(String endpoint) {
+ this.endpointName = endpoint;
+ }
+
+ /**
+ * Constructor AxisService.
+ */
+ public AxisService(String name) {
+ this();
+ this.name = name;
+ }
+
+ @SuppressWarnings("deprecation")
public void addMessageReceiver(String mepURI,
- MessageReceiver messageReceiver) {
- if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mepURI)
- || WSDL2Constants.MEP_URI_IN_ONLY
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_IN_ONLY
- .equals(mepURI)) {
- messageReceivers.put(WSDL2Constants.MEP_URI_IN_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_IN_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_IN_ONLY,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(mepURI)
- || WSDL2Constants.MEP_URI_OUT_ONLY
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_OUT_ONLY
- .equals(mepURI)) {
- messageReceivers.put(WSDL2Constants.MEP_URI_OUT_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_OUT_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_OUT_ONLY,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_IN_OUT.equals(mepURI)
- || WSDL2Constants.MEP_URI_IN_OUT
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_IN_OUT
- .equals(mepURI)) {
- messageReceivers
- .put(WSDL2Constants.MEP_URI_IN_OUT, messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_IN_OUT,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_IN_OUT,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI)
- || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
- .equals(mepURI)) {
- messageReceivers.put(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT,
- messageReceiver);
- messageReceivers
- .put(
- WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI)
- || WSDL2Constants.MEP_URI_OUT_IN
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_OUT_IN
- .equals(mepURI)) {
- messageReceivers
- .put(WSDL2Constants.MEP_URI_OUT_IN, messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_OUT_IN,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_OUT_IN,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI)
- || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
- .equals(mepURI)) {
- messageReceivers.put(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN,
- messageReceiver);
- messageReceivers
- .put(
- WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI)
- || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
- .equals(mepURI)) {
- messageReceivers.put(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY,
- messageReceiver);
- messageReceivers
- .put(
- WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY,
- messageReceiver);
- } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI)
- || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
- .equals(mepURI)
- || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
- .equals(mepURI)) {
- messageReceivers.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
- messageReceiver);
- messageReceivers.put(
- WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
- messageReceiver);
- } else {
- messageReceivers.put(mepURI, messageReceiver);
- }
- }
-
- public MessageReceiver getMessageReceiver(String mepURL) {
- return messageReceivers.get(mepURL);
- }
-
- /**
- * Adds module configuration , if there is moduleConfig tag in service.
- *
- * @param moduleConfiguration
- */
- public void addModuleConfig(ModuleConfiguration moduleConfiguration) {
- moduleConfigmap.put(moduleConfiguration.getModuleName(),
- moduleConfiguration);
- }
-
- /**
- * Add any control operations defined by a Module to this service.
- *
- * @param module
- * the AxisModule which has just been engaged
- * @throws AxisFault
- * if a problem occurs
- */
- void addModuleOperations(AxisModule module) throws AxisFault {
- HashMap<QName, AxisOperation> map = module.getOperations();
- Collection<AxisOperation> col = map.values();
- PhaseResolver phaseResolver = new PhaseResolver(getAxisConfiguration());
- for (Iterator<AxisOperation> iterator = col.iterator(); iterator.hasNext();) {
- AxisOperation axisOperation = copyOperation((AxisOperation) iterator
- .next());
- if (this.getOperation(axisOperation.getName()) == null) {
- ArrayList<String> wsamappings = axisOperation.getWSAMappingList();
- if (wsamappings != null) {
- for (int j = 0, size = wsamappings.size(); j < size; j++) {
- String mapping = (String) wsamappings.get(j);
+ MessageReceiver messageReceiver) {
+ if (WSDL2Constants.MEP_URI_IN_ONLY.equals(mepURI)
+ || WSDL2Constants.MEP_URI_IN_ONLY
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_IN_ONLY
+ .equals(mepURI)) {
+ messageReceivers.put(WSDL2Constants.MEP_URI_IN_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_IN_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_IN_ONLY,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_OUT_ONLY.equals(mepURI)
+ || WSDL2Constants.MEP_URI_OUT_ONLY
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_OUT_ONLY
+ .equals(mepURI)) {
+ messageReceivers.put(WSDL2Constants.MEP_URI_OUT_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_OUT_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_OUT_ONLY,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_IN_OUT.equals(mepURI)
+ || WSDL2Constants.MEP_URI_IN_OUT
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_IN_OUT
+ .equals(mepURI)) {
+ messageReceivers
+ .put(WSDL2Constants.MEP_URI_IN_OUT, messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_IN_OUT,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_IN_OUT,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT.equals(mepURI)
+ || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT
+ .equals(mepURI)) {
+ messageReceivers.put(WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT,
+ messageReceiver);
+ messageReceivers
+ .put(
+ WSDL2Constants.MEP_URI_IN_OPTIONAL_OUT,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_OUT_IN.equals(mepURI)
+ || WSDL2Constants.MEP_URI_OUT_IN
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_OUT_IN
+ .equals(mepURI)) {
+ messageReceivers
+ .put(WSDL2Constants.MEP_URI_OUT_IN, messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_OUT_IN,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_OUT_IN,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN.equals(mepURI)
+ || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN
+ .equals(mepURI)) {
+ messageReceivers.put(WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN,
+ messageReceiver);
+ messageReceivers
+ .put(
+ WSDL2Constants.MEP_URI_OUT_OPTIONAL_IN,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY.equals(mepURI)
+ || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY
+ .equals(mepURI)) {
+ messageReceivers.put(WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY,
+ messageReceiver);
+ messageReceivers
+ .put(
+ WSDL2Constants.MEP_URI_ROBUST_OUT_ONLY,
+ messageReceiver);
+ } else if (WSDL2Constants.MEP_URI_ROBUST_IN_ONLY.equals(mepURI)
+ || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
+ .equals(mepURI)
+ || WSDL2Constants.MEP_URI_ROBUST_IN_ONLY
+ .equals(mepURI)) {
+ messageReceivers.put(WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
+ messageReceiver);
+ messageReceivers.put(
+ WSDL2Constants.MEP_URI_ROBUST_IN_ONLY,
+ messageReceiver);
+ } else {
+ messageReceivers.put(mepURI, messageReceiver);
+ }
+ }
+
+ public MessageReceiver getMessageReceiver(String mepURL) {
+ return messageReceivers.get(mepURL);
+ }
+
+ /**
+ * Adds module configuration , if there is moduleConfig tag in service.
+ *
+ * @param moduleConfiguration
+ */
+ public void addModuleConfig(ModuleConfiguration moduleConfiguration) {
+ moduleConfigmap.put(moduleConfiguration.getModuleName(),
+ moduleConfiguration);
+ }
+
+ /**
+ * Add any control operations defined by a Module to this service.
+ *
+ * @param module
+ * the AxisModule which has just been engaged
+ * @throws AxisFault
+ * if a problem occurs
+ */
+ void addModuleOperations(AxisModule module) throws AxisFault {
+ HashMap<QName, AxisOperation> map = module.getOperations();
+ Collection<AxisOperation> col = map.values();
+ PhaseResolver phaseResolver = new PhaseResolver(getAxisConfiguration());
+ for (Iterator<AxisOperation> iterator = col.iterator(); iterator.hasNext();) {
+ AxisOperation axisOperation = copyOperation((AxisOperation) iterator
+ .next());
+ if (this.getOperation(axisOperation.getName()) == null) {
+ ArrayList<String> wsamappings = axisOperation.getWSAMappingList();
+ if (wsamappings != null) {
+ for (int j = 0, size = wsamappings.size(); j < size; j++) {
+ String mapping = (String) wsamappings.get(j);
//If there is already an operation with this action
- //mapping (e.g. if the service has a matching operation)
- //then we're going to check to see if the module's
- //operation says that it's OK to be overridden and
- //if so, we'll simply ignore the mapping, otherwise
- //we continue as before
- AxisOperation mappedOperation = getOperationByAction(mapping);
- if ((mappedOperation != null)
- && (axisOperation.isParameterTrue(DeploymentConstants.TAG_ALLOWOVERRIDE))) {
- if (log.isDebugEnabled()) {
- log
- .debug("addModuleOperations: Mapping already exists for action: "
- + mapping
- + " to operation: "
- + axisOperation
- + " named: "
- + axisOperation.getName()
- + " and an override is allowed, so the module mapping for module: "
- + module.getName()
- + " is being ignored.");
- log.debug(JavaUtils.callStackToString());
- }
- } else {
- mapActionToOperation(mapping, axisOperation);
- }
- }
- }
- // If we've set the "expose" parameter for this operation, it's
- // normal (non-
- // control) and therefore it will appear in generated WSDL. If
- // we haven't,
- // it's a control operation and will be ignored at WSDL-gen
- // time.
- if (axisOperation
- .isParameterTrue(DeploymentConstants.TAG_EXPOSE)) {
- axisOperation.setControlOperation(false);
- } else {
- axisOperation.setControlOperation(true);
- }
-
- phaseResolver.engageModuleToOperation(axisOperation, module);
-
- this.addOperation(axisOperation);
- }
- }
- }
-
- public void addModuleref(String moduleref) {
- moduleRefs.add(moduleref);
- }
+ //mapping (e.g. if the service has a matching operation)
+ //then we're going to check to see if the module's
+ //operation says that it's OK to be overridden and
+ //if so, we'll simply ignore the mapping, otherwise
+ //we continue as before
+ AxisOperation mappedOperation = getOperationByAction(mapping);
+ if ((mappedOperation != null)
+ && (axisOperation.isParameterTrue(DeploymentConstants.TAG_ALLOWOVERRIDE))) {
+ if (log.isDebugEnabled()) {
+ log
+ .debug("addModuleOperations: Mapping already exists for action: "
+ + mapping
+ + " to operation: "
+ + axisOperation
+ + " named: "
+ + axisOperation.getName()
+ + " and an override is allowed, so the module mapping for module: "
+ + module.getName()
+ + " is being ignored.");
+ log.debug(JavaUtils.callStackToString());
+ }
+ } else {
+ mapActionToOperation(mapping, axisOperation);
+ }
+ }
+ }
+ // If we've set the "expose" parameter for this operation, it's
+ // normal (non-
+ // control) and therefore it will appear in generated WSDL. If
+ // we haven't,
+ // it's a control operation and will be ignored at WSDL-gen
+ // time.
+ if (axisOperation
+ .isParameterTrue(DeploymentConstants.TAG_EXPOSE)) {
+ axisOperation.setControlOperation(false);
+ } else {
+ axisOperation.setControlOperation(true);
+ }
+
+ phaseResolver.engageModuleToOperation(axisOperation, module);
+
+ this.addOperation(axisOperation);
+ }
+ }
+ }
+
+ public void addModuleref(String moduleref) {
+ moduleRefs.add(moduleref);
+ }
/**
* Adds operation name to exclude list.
@@ -651,20 +651,20 @@ public class AxisService extends AxisDes
public boolean isExcludedOperation(String operation){
return excludeOperationsNameList.contains(operation);
}
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.axis2.description.AxisService#addOperation(org.apache.axis2.description.AxisOperation)
- */
-
- /**
- * Method addOperation.
- *
- * @param axisOperation
- */
- public void addOperation(AxisOperation axisOperation) {
- axisOperation.setParent(this);
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.description.AxisService#addOperation(org.apache.axis2.description.AxisOperation)
+ */
+
+ /**
+ * Method addOperation.
+ *
+ * @param axisOperation
+ */
+ public void addOperation(AxisOperation axisOperation) {
+ axisOperation.setParent(this);
if (log.isDebugEnabled()) {
if (axisOperation.getName().equals(ServiceClient.ANON_OUT_ONLY_OP)
@@ -675,320 +675,320 @@ public class AxisService extends AxisDes
}
}
- Iterator<AxisModule> modules = getEngagedModules().iterator();
+ Iterator<AxisModule> modules = getEngagedModules().iterator();
+
+ while (modules.hasNext()) {
+ AxisModule module = (AxisModule) modules.next();
+ try {
+ axisOperation.engageModule(module);
+ } catch (AxisFault axisFault) {
+ log.info(Messages.getMessage("modulealredyengagetoservice",
+ module.getName()));
+ }
+ }
+ if (axisOperation.getMessageReceiver() == null) {
+ axisOperation.setMessageReceiver(loadDefaultMessageReceiver(
+ axisOperation.getMessageExchangePattern(), this));
+ }
+ if (axisOperation.getInputAction() == null) {
+ axisOperation.setSoapAction("urn:"
+ + axisOperation.getName().getLocalPart());
+ }
+
+ if (axisOperation.getOutputAction() == null) {
+ axisOperation.setOutputAction("urn:"
+ + axisOperation.getName().getLocalPart()
+ + Java2WSDLConstants.RESPONSE);
+ }
+ addChild(axisOperation);
+
+ String operationName = axisOperation.getName().getLocalPart();
+
+ /*
+ * Some times name of the operation can be different from the name of
+ * the first child of the SOAPBody. This will put the correct mapping
+ * associating that name with the operation. This will be useful
+ * especially for the SOAPBodyBasedDispatcher
+ */
+
+ Iterator axisMessageIter = axisOperation.getChildren();
+
+ while (axisMessageIter.hasNext()) {
+ AxisMessage axisMessage = (AxisMessage) axisMessageIter.next();
+ String messageName = axisMessage.getName();
+ if (messageName != null && !messageName.equals(operationName)) {
+ mapActionToOperation(messageName, axisOperation);
+ }
+ }
+
+ mapActionToOperation(operationName, axisOperation);
+
+ String action = axisOperation.getInputAction();
+ if (action.length() > 0) {
+ mapActionToOperation(action, axisOperation);
+ }
+
+ ArrayList<String> wsamappings = axisOperation.getWSAMappingList();
+ if (wsamappings != null) {
+ for (int j = 0, size = wsamappings.size(); j < size; j++) {
+ String mapping = (String) wsamappings.get(j);
+ mapActionToOperation(mapping, axisOperation);
+ }
+ }
+
+ if (axisOperation.getMessageReceiver() == null) {
+ axisOperation.setMessageReceiver(loadDefaultMessageReceiver(
+ axisOperation.getMessageExchangePattern(), this));
+ }
+ }
+
+ private MessageReceiver loadDefaultMessageReceiver(String mepURL,
+ AxisService service) {
+ MessageReceiver messageReceiver;
+ if (mepURL == null) {
+ mepURL = WSDL2Constants.MEP_URI_IN_OUT;
+ }
+ if (service != null) {
+ messageReceiver = service.getMessageReceiver(mepURL);
+ if (messageReceiver != null) {
+ return messageReceiver;
+ }
+ }
+ if (getAxisConfiguration() != null) {
+ return getAxisConfiguration().getMessageReceiver(mepURL);
+ }
+ return null;
+ }
+
+ /**
+ * Gets a copy from module operation.
+ *
+ * @param axisOperation
+ * @return Returns AxisOperation.
+ * @throws AxisFault
+ */
+ private AxisOperation copyOperation(AxisOperation axisOperation)
+ throws AxisFault {
+ AxisOperation operation = AxisOperationFactory
+ .getOperationDescription(axisOperation
+ .getMessageExchangePattern());
+
+ operation.setMessageReceiver(axisOperation.getMessageReceiver());
+ operation.setName(axisOperation.getName());
+
+ Iterator<Parameter> parameters = axisOperation.getParameters().iterator();
+
+ while (parameters.hasNext()) {
+ Parameter parameter = (Parameter) parameters.next();
+
+ operation.addParameter(parameter);
+ }
+
+ PolicyInclude policyInclude = new PolicyInclude(operation);
+ PolicyInclude axisOperationPolicyInclude = axisOperation
+ .getPolicyInclude();
+
+ if (axisOperationPolicyInclude != null) {
+ Policy policy = axisOperationPolicyInclude.getPolicy();
+ if (policy != null) {
+ policyInclude.setPolicy(axisOperationPolicyInclude.getPolicy());
+ }
+ }
+ operation.setPolicyInclude(policyInclude);
+
+ operation.setWsamappingList(axisOperation.getWSAMappingList());
+ operation.setRemainingPhasesInFlow(axisOperation
+ .getRemainingPhasesInFlow());
+ operation.setPhasesInFaultFlow(axisOperation.getPhasesInFaultFlow());
+ operation.setPhasesOutFaultFlow(axisOperation.getPhasesOutFaultFlow());
+ operation.setPhasesOutFlow(axisOperation.getPhasesOutFlow());
+
+ operation.setOutputAction(axisOperation.getOutputAction());
+ String[] faultActionNames = axisOperation.getFaultActionNames();
+ for (int i = 0; i < faultActionNames.length; i++) {
+ operation.addFaultAction(faultActionNames[i], axisOperation
+ .getFaultAction(faultActionNames[i]));
+ }
+
+ return operation;
+ }
- while (modules.hasNext()) {
- AxisModule module = (AxisModule) modules.next();
- try {
- axisOperation.engageModule(module);
- } catch (AxisFault axisFault) {
- log.info(Messages.getMessage("modulealredyengagetoservice",
- module.getName()));
- }
- }
- if (axisOperation.getMessageReceiver() == null) {
- axisOperation.setMessageReceiver(loadDefaultMessageReceiver(
- axisOperation.getMessageExchangePattern(), this));
- }
- if (axisOperation.getInputAction() == null) {
- axisOperation.setSoapAction("urn:"
- + axisOperation.getName().getLocalPart());
- }
-
- if (axisOperation.getOutputAction() == null) {
- axisOperation.setOutputAction("urn:"
- + axisOperation.getName().getLocalPart()
- + Java2WSDLConstants.RESPONSE);
- }
- addChild(axisOperation);
-
- String operationName = axisOperation.getName().getLocalPart();
-
- /*
- * Some times name of the operation can be different from the name of
- * the first child of the SOAPBody. This will put the correct mapping
- * associating that name with the operation. This will be useful
- * especially for the SOAPBodyBasedDispatcher
- */
-
- Iterator axisMessageIter = axisOperation.getChildren();
-
- while (axisMessageIter.hasNext()) {
- AxisMessage axisMessage = (AxisMessage) axisMessageIter.next();
- String messageName = axisMessage.getName();
- if (messageName != null && !messageName.equals(operationName)) {
- mapActionToOperation(messageName, axisOperation);
- }
- }
-
- mapActionToOperation(operationName, axisOperation);
-
- String action = axisOperation.getInputAction();
- if (action.length() > 0) {
- mapActionToOperation(action, axisOperation);
- }
-
- ArrayList<String> wsamappings = axisOperation.getWSAMappingList();
- if (wsamappings != null) {
- for (int j = 0, size = wsamappings.size(); j < size; j++) {
- String mapping = (String) wsamappings.get(j);
- mapActionToOperation(mapping, axisOperation);
- }
- }
-
- if (axisOperation.getMessageReceiver() == null) {
- axisOperation.setMessageReceiver(loadDefaultMessageReceiver(
- axisOperation.getMessageExchangePattern(), this));
- }
- }
-
- private MessageReceiver loadDefaultMessageReceiver(String mepURL,
- AxisService service) {
- MessageReceiver messageReceiver;
- if (mepURL == null) {
- mepURL = WSDL2Constants.MEP_URI_IN_OUT;
- }
- if (service != null) {
- messageReceiver = service.getMessageReceiver(mepURL);
- if (messageReceiver != null) {
- return messageReceiver;
- }
- }
- if (getAxisConfiguration() != null) {
- return getAxisConfiguration().getMessageReceiver(mepURL);
- }
- return null;
- }
-
- /**
- * Gets a copy from module operation.
- *
- * @param axisOperation
- * @return Returns AxisOperation.
- * @throws AxisFault
- */
- private AxisOperation copyOperation(AxisOperation axisOperation)
- throws AxisFault {
- AxisOperation operation = AxisOperationFactory
- .getOperationDescription(axisOperation
- .getMessageExchangePattern());
-
- operation.setMessageReceiver(axisOperation.getMessageReceiver());
- operation.setName(axisOperation.getName());
-
- Iterator<Parameter> parameters = axisOperation.getParameters().iterator();
-
- while (parameters.hasNext()) {
- Parameter parameter = (Parameter) parameters.next();
-
- operation.addParameter(parameter);
- }
-
- PolicyInclude policyInclude = new PolicyInclude(operation);
- PolicyInclude axisOperationPolicyInclude = axisOperation
- .getPolicyInclude();
-
- if (axisOperationPolicyInclude != null) {
- Policy policy = axisOperationPolicyInclude.getPolicy();
- if (policy != null) {
- policyInclude.setPolicy(axisOperationPolicyInclude.getPolicy());
- }
- }
- operation.setPolicyInclude(policyInclude);
-
- operation.setWsamappingList(axisOperation.getWSAMappingList());
- operation.setRemainingPhasesInFlow(axisOperation
- .getRemainingPhasesInFlow());
- operation.setPhasesInFaultFlow(axisOperation.getPhasesInFaultFlow());
- operation.setPhasesOutFaultFlow(axisOperation.getPhasesOutFaultFlow());
- operation.setPhasesOutFlow(axisOperation.getPhasesOutFlow());
-
- operation.setOutputAction(axisOperation.getOutputAction());
- String[] faultActionNames = axisOperation.getFaultActionNames();
- for (int i = 0; i < faultActionNames.length; i++) {
- operation.addFaultAction(faultActionNames[i], axisOperation
- .getFaultAction(faultActionNames[i]));
- }
-
- return operation;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.apache.axis2.description.AxisService#addToengagedModules(javax.xml.namespace.QName)
- */
-
- /**
- * Engages a module. It is required to use this method.
- *
- * @param axisModule
- * @param engager
- */
- public void onEngage(AxisModule axisModule, AxisDescription engager)
- throws AxisFault {
- // adding module operations
- addModuleOperations(axisModule);
-
- Iterator<AxisOperation> operations = getOperations();
- while (operations.hasNext()) {
- AxisOperation axisOperation = (AxisOperation) operations.next();
- axisOperation.engageModule(axisModule, engager);
- }
- }
-
- /**
- * Maps an alias (such as a SOAPAction, WSA action, or an operation name) to
- * the given AxisOperation. This is used by dispatching (both SOAPAction-
- * and WSAddressing- based dispatching) to figure out which operation a
- * given message is for. Some notes on restrictions of "action" - A null or
- * empty action will be ignored - An action that is a duplicate and
- * references an idential operation is allowed - An acton that is a
- * duplicate and references a different operation is NOT allowed. In this
- * case, the action for the original operation is removed from the alias
- * table, thus removing the ability to route based on this action. This is
- * necessary to prevent mis-directing incoming message to the wrong
- * operation based on SOAPAction.
- *
- * Note that an alias could be a SOAPAction, WS-Addressing Action, the
- * operation name, or some other alias.
- *
- * @see #getOperationByAction(String)
- *
- * @param action
- * the alias key
- * @param axisOperation
- * the operation to map to
- */
- public void mapActionToOperation(String action, AxisOperation axisOperation) {
- if (action == null || "".equals(action)) {
- if (log.isDebugEnabled()) {
- log
- .debug("mapActionToOperation: A null or empty action cannot be used to map to an operation.");
- }
- return;
- }
- if (log.isDebugEnabled()) {
- log
- .debug("mapActionToOperation: Mapping Action to Operation: action: "
- + action
- + "; operation: "
- + axisOperation
- + "named: " + axisOperation.getName());
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.axis2.description.AxisService#addToengagedModules(javax.xml.namespace.QName)
+ */
+
+ /**
+ * Engages a module. It is required to use this method.
+ *
+ * @param axisModule
+ * @param engager
+ */
+ public void onEngage(AxisModule axisModule, AxisDescription engager)
+ throws AxisFault {
+ // adding module operations
+ addModuleOperations(axisModule);
+
+ Iterator<AxisOperation> operations = getOperations();
+ while (operations.hasNext()) {
+ AxisOperation axisOperation = (AxisOperation) operations.next();
+ axisOperation.engageModule(axisModule, engager);
+ }
+ }
+
+ /**
+ * Maps an alias (such as a SOAPAction, WSA action, or an operation name) to
+ * the given AxisOperation. This is used by dispatching (both SOAPAction-
+ * and WSAddressing- based dispatching) to figure out which operation a
+ * given message is for. Some notes on restrictions of "action" - A null or
+ * empty action will be ignored - An action that is a duplicate and
+ * references an idential operation is allowed - An acton that is a
+ * duplicate and references a different operation is NOT allowed. In this
+ * case, the action for the original operation is removed from the alias
+ * table, thus removing the ability to route based on this action. This is
+ * necessary to prevent mis-directing incoming message to the wrong
+ * operation based on SOAPAction.
+ *
+ * Note that an alias could be a SOAPAction, WS-Addressing Action, the
+ * operation name, or some other alias.
+ *
+ * @see #getOperationByAction(String)
+ *
+ * @param action
+ * the alias key
+ * @param axisOperation
+ * the operation to map to
+ */
+ public void mapActionToOperation(String action, AxisOperation axisOperation) {
+ if (action == null || "".equals(action)) {
+ if (log.isDebugEnabled()) {
+ log
+ .debug("mapActionToOperation: A null or empty action cannot be used to map to an operation.");
+ }
+ return;
+ }
+ if (log.isDebugEnabled()) {
+ log
+ .debug("mapActionToOperation: Mapping Action to Operation: action: "
+ + action
+ + "; operation: "
+ + axisOperation
+ + "named: " + axisOperation.getName());
log.debug(JavaUtils.callStackToString());
- }
+ }
- //If there is already an operation with this action
- //mapping then we're going to check to see if the
- //operation says that it's OK to be overridden and
- //if so, we'll simply ignore the mapping, otherwise
- //we continue as before
- AxisOperation mappedOperation = getOperationByAction(action);
- if ((mappedOperation != null)
- && (axisOperation.isParameterTrue(DeploymentConstants.TAG_ALLOWOVERRIDE))) {
- if (log.isDebugEnabled()) {
- log
- .debug("addModuleOperations: Mapping already exists for action: "
- + action
- + " to operation: "
- + axisOperation
- + " named: "
- + axisOperation.getName()
- + " and an override is allowed, so the mapping is being ignored.");
- log.debug(JavaUtils.callStackToString());
- }
- return;
- }
-
- // First check if this action has already been flagged as invalid
- // because it is a duplicate.
- if (invalidOperationsAliases.contains(action)) {
- // This SOAPAction has already been determined to be invalid; log a
- // message
- // and do not add it to the operation alias map.
- if (log.isDebugEnabled()) {
- log
- .debug("mapActionToOperation: The action: "
- + action
- + " can not be used for operation: "
- + axisOperation
- + " with operation name: "
- + axisOperation.getName()
- + " because that SOAPAction is not unique for this service.");
- }
- return;
- }
-
- // Check if the action is currently mapping to an operation.
- AxisOperation currentlyMappedOperation = getOperationByAction(action);
- if (currentlyMappedOperation != null) {
- if (currentlyMappedOperation == axisOperation) {
- // This maps to the same operation, then it is already in the
- // alias table, so
- // just silently ignore this mapping request.
- if (log.isDebugEnabled()) {
- log
- .debug("mapActionToOperation: This operation is already mapped to this action: "
- + action
- + "; AxisOperation: "
- + currentlyMappedOperation
- + " named: "
- + currentlyMappedOperation.getName());
- }
- } else {
- // This action is already mapped, but it is to a different
- // operation. Remove
- // the action mapping from the alias table and add it to the
- // list of invalid mappings
- operationsAliasesMap.remove(action);
- invalidOperationsAliases.add(action);
- if (log.isDebugEnabled()) {
- log
- .debug("mapActionToOperation: The action is already mapped to a different "
- + "operation. The mapping of the action to any operations will be "
- + "removed. Action: "
- + action
- + "; original operation: "
- + currentlyMappedOperation
- + " named "
- + currentlyMappedOperation.getName()
- + "; new operation: "
- + axisOperation
- + " named " + axisOperation.getName());
- }
- }
- } else {
- operationsAliasesMap.put(action, axisOperation);
- // Adding operation name to the mapping table
- // operationsAliasesMap.put(axisOperation.getName().getLocalPart(),
- // axisOperation);
- }
- }
-
- /**
- * Maps an constant string in the whttp:location to the given operation.
- * This is used by RequestURIOperationDispatcher based dispatching to figure
- * out which operation it is that a given message is for.
- *
- * @param string
- * the constant drawn from whttp:location
- * @param axisOperation
- * the operation to map to
- */
- public void addHttpLocationDispatcherString(String string,
- AxisOperation axisOperation) {
- httpLocationDispatcherMap.put(string, axisOperation);
- }
-
- /**
- * Prints the schema to the given output stream.
- * @param out The output stream for the data to be written. NOTE: the stream is not closed after the operation,
- * it is the responsibility of the caller to close the stream after usage.
- * @throws AxisFault
- */
- public void printSchema(OutputStream out) throws AxisFault {
- for (int i = 0; i < schemaList.size(); i++) {
- XmlSchema schema = addNameSpaces(i);
+ //If there is already an operation with this action
+ //mapping then we're going to check to see if the
+ //operation says that it's OK to be overridden and
+ //if so, we'll simply ignore the mapping, otherwise
+ //we continue as before
+ AxisOperation mappedOperation = getOperationByAction(action);
+ if ((mappedOperation != null)
+ && (axisOperation.isParameterTrue(DeploymentConstants.TAG_ALLOWOVERRIDE))) {
+ if (log.isDebugEnabled()) {
+ log
+ .debug("addModuleOperations: Mapping already exists for action: "
+ + action
+ + " to operation: "
+ + axisOperation
+ + " named: "
+ + axisOperation.getName()
+ + " and an override is allowed, so the mapping is being ignored.");
+ log.debug(JavaUtils.callStackToString());
+ }
+ return;
+ }
+
+ // First check if this action has already been flagged as invalid
+ // because it is a duplicate.
+ if (invalidOperationsAliases.contains(action)) {
+ // This SOAPAction has already been determined to be invalid; log a
+ // message
+ // and do not add it to the operation alias map.
+ if (log.isDebugEnabled()) {
+ log
+ .debug("mapActionToOperation: The action: "
+ + action
+ + " can not be used for operation: "
+ + axisOperation
+ + " with operation name: "
+ + axisOperation.getName()
+ + " because that SOAPAction is not unique for this service.");
+ }
+ return;
+ }
+
+ // Check if the action is currently mapping to an operation.
+ AxisOperation currentlyMappedOperation = getOperationByAction(action);
+ if (currentlyMappedOperation != null) {
+ if (currentlyMappedOperation == axisOperation) {
+ // This maps to the same operation, then it is already in the
+ // alias table, so
+ // just silently ignore this mapping request.
+ if (log.isDebugEnabled()) {
+ log
+ .debug("mapActionToOperation: This operation is already mapped to this action: "
+ + action
+ + "; AxisOperation: "
+ + currentlyMappedOperation
+ + " named: "
+ + currentlyMappedOperation.getName());
+ }
+ } else {
+ // This action is already mapped, but it is to a different
+ // operation. Remove
+ // the action mapping from the alias table and add it to the
+ // list of invalid mappings
+ operationsAliasesMap.remove(action);
+ invalidOperationsAliases.add(action);
+ if (log.isDebugEnabled()) {
+ log
+ .debug("mapActionToOperation: The action is already mapped to a different "
+ + "operation. The mapping of the action to any operations will be "
+ + "removed. Action: "
+ + action
+ + "; original operation: "
+ + currentlyMappedOperation
+ + " named "
+ + currentlyMappedOperation.getName()
+ + "; new operation: "
+ + axisOperation
+ + " named " + axisOperation.getName());
+ }
+ }
+ } else {
+ operationsAliasesMap.put(action, axisOperation);
+ // Adding operation name to the mapping table
+ // operationsAliasesMap.put(axisOperation.getName().getLocalPart(),
+ // axisOperation);
+ }
+ }
+
+ /**
+ * Maps an constant string in the whttp:location to the given operation.
+ * This is used by RequestURIOperationDispatcher based dispatching to figure
+ * out which operation it is that a given message is for.
+ *
+ * @param string
+ * the constant drawn from whttp:location
+ * @param axisOperation
+ * the operation to map to
+ */
+ public void addHttpLocationDispatcherString(String string,
+ AxisOperation axisOperation) {
+ httpLocationDispatcherMap.put(string, axisOperation);
+ }
+
+ /**
+ * Prints the schema to the given output stream.
+ * @param out The output stream for the data to be written. NOTE: the stream is not closed after the operation,
+ * it is the responsibility of the caller to close the stream after usage.
+ * @throws AxisFault
+ */
+ public void printSchema(OutputStream out) throws AxisFault {
+ for (int i = 0; i < schemaList.size(); i++) {
+ XmlSchema schema = addNameSpaces(i);
try {
schema.write(out);
} catch (UnsupportedEncodingException e) {
@@ -996,192 +996,192 @@ public class AxisService extends AxisDes
throw new AxisFault(e.getMessage(), e);
}
}
- }
+ }
+
+ public XmlSchema getSchema(int index) {
+ return addNameSpaces(index);
+ }
+
+ /**
+ * Release the list of schema objects. <p/> In some environments, this can
+ * provide significant relief of memory consumption in the java heap, as
+ * long as the need for the schema list has completed.
+ */
+ public void releaseSchemaList() {
+ if (schemaList != null) {
+ // release the schema list
+ schemaList.clear();
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug("releaseSchemaList: schema list has been released.");
+ }
+ }
+
+ private XmlSchema addNameSpaces(int i) {
+ XmlSchema schema = (XmlSchema) schemaList.get(i);
+ NamespaceMap map = (NamespaceMap) namespaceMap.clone();
+ NamespacePrefixList namespaceContext = schema.getNamespaceContext();
+ String prefixes[] = namespaceContext.getDeclaredPrefixes();
+ for (int j = 0; j < prefixes.length; j++) {
+ String prefix = prefixes[j];
+ map.add(prefix, namespaceContext.getNamespaceURI(prefix));
+ }
+ schema.setNamespaceContext(map);
+ return schema;
+ }
+
+ public void setEPRs(String[] eprs) {
+ this.eprs = eprs;
+ }
+
+ public String[] getEPRs() {
+ if (eprs != null && eprs.length != 0) {
+ return eprs;
+ }
+ eprs = calculateEPRs();
+ return eprs;
+ }
+
+ private String[] calculateEPRs() {
+ try {
+ String requestIP = org.apache.axis2.util.Utils.getIpAddress(getAxisConfiguration());
+ return calculateEPRs(requestIP);
+ } catch (SocketException e) {
+ log.error("Cannot get local IP address", e);
+ }
+ return new String[0];
+ }
+
+ private String[] calculateEPRs(String requestIP) {
+ AxisConfiguration axisConfig = getAxisConfiguration();
+ if (axisConfig == null) {
+ return null;
+ }
+ ArrayList<String> eprList = new ArrayList<String>();
+ if (enableAllTransports) {
+ for (Iterator<TransportInDescription> transports = axisConfig.getTransportsIn().values()
+ .iterator(); transports.hasNext();) {
+ TransportInDescription transportIn = (TransportInDescription) transports
+ .next();
+ TransportListener listener = transportIn.getReceiver();
+ if (listener != null) {
+ try {
+ EndpointReference[] eprsForService = listener
+ .getEPRsForService(this.name, requestIP);
+ if (eprsForService != null) {
+ for (int i = 0; i < eprsForService.length; i++) {
+ EndpointReference endpointReference = eprsForService[i];
+ if (endpointReference != null) {
+ String address = endpointReference
+ .getAddress();
+ if (address != null) {
+ eprList.add(address);
+ }
+ }
+ }
+ }
+ } catch (AxisFault axisFault) {
+ log.warn(axisFault.getMessage());
+ }
+ }
+ }
+ } else {
+ List<String> trs = this.exposedTransports;
+ for (int i = 0; i < trs.size(); i++) {
+ String trsName = (String) trs.get(i);
+ TransportInDescription transportIn = axisConfig
+ .getTransportIn(trsName);
+ if (transportIn != null) {
+ TransportListener listener = transportIn.getReceiver();
+ if (listener != null) {
+ try {
+ EndpointReference[] eprsForService = listener
+ .getEPRsForService(this.name, requestIP);
+ if (eprsForService != null) {
+ for (int j = 0; j < eprsForService.length; j++) {
+ EndpointReference endpointReference = eprsForService[j];
+ if (endpointReference != null) {
+ String address = endpointReference
+ .getAddress();
+ if (address != null) {
+ eprList.add(address);
+ }
+ }
+ }
+ }
+ } catch (AxisFault axisFault) {
+ log.warn(axisFault.getMessage());
+ }
+ }
+ }
+ }
+ }
+ eprs = (String[]) eprList.toArray(new String[eprList.size()]);
+ return eprs;
+ }
- public XmlSchema getSchema(int index) {
- return addNameSpaces(index);
- }
-
- /**
- * Release the list of schema objects. <p/> In some environments, this can
- * provide significant relief of memory consumption in the java heap, as
- * long as the need for the schema list has completed.
- */
- public void releaseSchemaList() {
- if (schemaList != null) {
- // release the schema list
- schemaList.clear();
- }
-
- if (log.isDebugEnabled()) {
- log.debug("releaseSchemaList: schema list has been released.");
- }
- }
-
- private XmlSchema addNameSpaces(int i) {
- XmlSchema schema = (XmlSchema) schemaList.get(i);
- NamespaceMap map = (NamespaceMap) namespaceMap.clone();
- NamespacePrefixList namespaceContext = schema.getNamespaceContext();
- String prefixes[] = namespaceContext.getDeclaredPrefixes();
- for (int j = 0; j < prefixes.length; j++) {
- String prefix = prefixes[j];
- map.add(prefix, namespaceContext.getNamespaceURI(prefix));
- }
- schema.setNamespaceContext(map);
- return schema;
- }
-
- public void setEPRs(String[] eprs) {
- this.eprs = eprs;
- }
-
- public String[] getEPRs() {
- if (eprs != null && eprs.length != 0) {
- return eprs;
- }
- eprs = calculateEPRs();
- return eprs;
- }
-
- private String[] calculateEPRs() {
- try {
- String requestIP = org.apache.axis2.util.Utils.getIpAddress(getAxisConfiguration());
- return calculateEPRs(requestIP);
- } catch (SocketException e) {
- log.error("Cannot get local IP address", e);
- }
- return new String[0];
- }
-
- private String[] calculateEPRs(String requestIP) {
- AxisConfiguration axisConfig = getAxisConfiguration();
- if (axisConfig == null) {
- return null;
- }
- ArrayList<String> eprList = new ArrayList<String>();
- if (enableAllTransports) {
- for (Iterator<TransportInDescription> transports = axisConfig.getTransportsIn().values()
- .iterator(); transports.hasNext();) {
- TransportInDescription transportIn = (TransportInDescription) transports
- .next();
- TransportListener listener = transportIn.getReceiver();
- if (listener != null) {
- try {
- EndpointReference[] eprsForService = listener
- .getEPRsForService(this.name, requestIP);
- if (eprsForService != null) {
- for (int i = 0; i < eprsForService.length; i++) {
- EndpointReference endpointReference = eprsForService[i];
- if (endpointReference != null) {
- String address = endpointReference
- .getAddress();
- if (address != null) {
- eprList.add(address);
- }
- }
- }
- }
- } catch (AxisFault axisFault) {
- log.warn(axisFault.getMessage());
- }
- }
- }
- } else {
- List<String> trs = this.exposedTransports;
- for (int i = 0; i < trs.size(); i++) {
- String trsName = (String) trs.get(i);
- TransportInDescription transportIn = axisConfig
- .getTransportIn(trsName);
- if (transportIn != null) {
- TransportListener listener = transportIn.getReceiver();
- if (listener != null) {
- try {
- EndpointReference[] eprsForService = listener
- .getEPRsForService(this.name, requestIP);
- if (eprsForService != null) {
- for (int j = 0; j < eprsForService.length; j++) {
- EndpointReference endpointReference = eprsForService[j];
- if (endpointReference != null) {
- String address = endpointReference
- .getAddress();
- if (address != null) {
- eprList.add(address);
- }
- }
- }
- }
- } catch (AxisFault axisFault) {
- log.warn(axisFault.getMessage());
- }
- }
- }
- }
- }
- eprs = (String[]) eprList.toArray(new String[eprList.size()]);
- return eprs;
- }
-
- /**
- * Prints the given definition object.
- * @param definition The definition.
- * @param out The output stream the data to be written to. NOTE: the stream is not closed after the operation,
- * it is the responsibility of the caller to close the stream after usage.
- * @param requestIP The host IP address.
- * @throws AxisFault
- * @throws WSDLException
- */
- private synchronized void printDefinitionObject(Definition definition, OutputStream out,
- String requestIP) throws AxisFault, WSDLException {
+ /**
+ * Prints the given definition object.
+ * @param definition The definition.
+ * @param out The output stream the data to be written to. NOTE: the stream is not closed after the operation,
+ * it is the responsibility of the caller to close the stream after usage.
+ * @param requestIP The host IP address.
+ * @throws AxisFault
+ * @throws WSDLException
+ */
+ private synchronized void printDefinitionObject(Definition definition, OutputStream out,
+ String requestIP) throws AxisFault, WSDLException {
// Synchronized this method to fix the NullPointer exception occurred when load is high.
// This error happens because wsdl4j is not thread safe and we are using same WSDL Definition for printing the
// WSDL.
// Please refer AXIS2-4511,AXIS2-4517,AXIS2-3276.
- if (isModifyUserWSDLPortAddress()) {
- setPortAddress(definition, requestIP);
- }
- if (!wsdlImportLocationAdjusted) {
- changeImportAndIncludeLocations(definition);
- wsdlImportLocationAdjusted = true;
- }
- WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
- writer.writeWSDL(definition, out);
- }
-
- public void printUserWSDL(OutputStream out, String wsdlName)
- throws AxisFault {
- printUserWSDL(out, wsdlName, null);
- }
-
- /**
- * Prints the user WSDL.
- * @param out The output stream for the data to be written. NOTE: the stream is not closed after the operation,
- * it is the responsibility of the caller to close the stream after usage.
- * @param wsdlName The name of the WSDL.
- * @param ip The host IP address.
- * @throws AxisFault
- */
- public void printUserWSDL(OutputStream out, String wsdlName, String ip)
- throws AxisFault {
- Definition definition = null;
- // first find the correct wsdl definition
- Parameter wsdlParameter = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
- if (wsdlParameter != null) {
- definition = (Definition) wsdlParameter.getValue();
- }
-
- if (definition != null) {
- try {
- printDefinitionObject(getWSDLDefinition(definition, wsdlName),
- out, ip);
- } catch (WSDLException e) {
- throw AxisFault.makeFault(e);
- }
- } else {
- printWSDLError(out);
- }
+ if (isModifyUserWSDLPortAddress()) {
+ setPortAddress(definition, requestIP);
+ }
+ if (!wsdlImportLocationAdjusted) {
+ changeImportAndIncludeLocations(definition);
+ wsdlImportLocationAdjusted = true;
+ }
+ WSDLWriter writer = WSDLFactory.newInstance().newWSDLWriter();
+ writer.writeWSDL(definition, out);
+ }
+
+ public void printUserWSDL(OutputStream out, String wsdlName)
+ throws AxisFault {
+ printUserWSDL(out, wsdlName, null);
+ }
- }
-
+ /**
+ * Prints the user WSDL.
+ * @param out The output stream for the data to be written. NOTE: the stream is not closed after the operation,
+ * it is the responsibility of the caller to close the stream after usage.
+ * @param wsdlName The name of the WSDL.
+ * @param ip The host IP address.
+ * @throws AxisFault
+ */
+ public void printUserWSDL(OutputStream out, String wsdlName, String ip)
+ throws AxisFault {
+ Definition definition = null;
+ // first find the correct wsdl definition
+ Parameter wsdlParameter = getParameter(WSDLConstants.WSDL_4_J_DEFINITION);
+ if (wsdlParameter != null) {
+ definition = (Definition) wsdlParameter.getValue();
+ }
+
+ if (definition != null) {
+ try {
+ printDefinitionObject(getWSDLDefinition(definition, wsdlName),
+ out, ip);
+ } catch (WSDLException e) {
+ throw AxisFault.makeFault(e);
+ }
+ } else {
+ printWSDLError(out);
+ }
+
+ }
+
public void printUserWSDL2(OutputStream out, String wsdlName, String ip) throws AxisFault {
Description description = null;
// first find the correct wsdl definition
@@ -1199,52 +1199,52 @@ public class AxisService extends AxisDes
}
- /**
- * find the defintion object for given name
- *
- * @param parentDefinition
- * @param name
- * @return wsdl definition
- */
- private Definition getWSDLDefinition(Definition parentDefinition,
- String name) {
-
- if (name == null)
- return parentDefinition;
-
- Definition importedDefinition = null;
- Iterator iter = parentDefinition.getImports().values().iterator();
- Vector values = null;
- Import wsdlImport = null;
- for (; iter.hasNext();) {
- values = (Vector) iter.next();
- for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
- wsdlImport = (Import) valuesIter.next();
- if (wsdlImport.getLocationURI().endsWith(name)) {
- importedDefinition = wsdlImport.getDefinition();
- break;
- } else {
- importedDefinition = getWSDLDefinition(wsdlImport
- .getDefinition(), name);
- }
- if (importedDefinition != null) {
- break;
- }
- }
- if (importedDefinition != null) {
- break;
- }
- }
- return importedDefinition;
- }
-
- /**
- * this procesdue recursively adjust the wsdl imports locations and the
- * schmea import and include locations.
- *
- * @param definition
- */
- private void changeImportAndIncludeLocations(Definition definition) throws AxisFault {
+ /**
+ * find the defintion object for given name
+ *
+ * @param parentDefinition
+ * @param name
+ * @return wsdl definition
+ */
+ private Definition getWSDLDefinition(Definition parentDefinition,
+ String name) {
+
+ if (name == null)
+ return parentDefinition;
+
+ Definition importedDefinition = null;
+ Iterator iter = parentDefinition.getImports().values().iterator();
+ Vector values = null;
+ Import wsdlImport = null;
+ for (; iter.hasNext();) {
+ values = (Vector) iter.next();
+ for (Iterator valuesIter = values.iterator(); valuesIter.hasNext();) {
+ wsdlImport = (Import) valuesIter.next();
+ if (wsdlImport.getLocationURI().endsWith(name)) {
+ importedDefinition = wsdlImport.getDefinition();
+ break;
+ } else {
+ importedDefinition = getWSDLDefinition(wsdlImport
+ .getDefinition(), name);
+ }
+ if (importedDefinition != null) {
+ break;
+ }
+ }
+ if (importedDefinition != null) {
+ break;
+ }
+ }
+ return importedDefinition;
+ }
+
+ /**
+ * this procesdue recursively adjust the wsdl imports locations and the
+ * schmea import and include locations.
+ *
+ * @param definition
+ */
+ private void changeImportAndIncludeLocations(Definition definition) throws AxisFault {
// adjust the schema locations in types section
Types types = definition.getTypes();
@@ -1279,13 +1279,13 @@ public class AxisService extends AxisDes
}
- /**
- * change the schema Location in the elemment
- *
- * @param element
- */
+ /**
+ * change the schema Location in the elemment
+ *
+ * @param element
+ */
- private void changeLocations(Element element) throws AxisFault {
+ private void changeLocations(Element element) throws AxisFault {
NodeList nodeList = element.getChildNodes();
String tagName;
for (int i = 0; i < nodeList.getLength(); i++) {
@@ -1296,14 +1296,14 @@ public class AxisService extends AxisDes
}
}
- private void updateSchemaLocation(XmlSchema schema) throws AxisFault {
+ private void updateSchemaLocation(XmlSchema schema) throws AxisFault {
for (XmlSchemaExternal xmlSchemaExternal : schema.getExternals()) {
XmlSchema s = xmlSchemaExternal.getSchema();
updateSchemaLocation(s, xmlSchemaExternal);
}
}
- private void updateSchemaLocation(XmlSchema s, XmlSchemaExternal xmlSchemaExternal) throws AxisFault {
+ private void updateSchemaLocation(XmlSchema s, XmlSchemaExternal xmlSchemaExternal) throws AxisFault {
if (s != null) {
String schemaLocation = xmlSchemaExternal.getSchemaLocation();
@@ -1313,8 +1313,8 @@ public class AxisService extends AxisDes
}
}
}
-
- private void processImport(Node importNode) throws AxisFault {
+
+ private void processImport(Node importNode) throws AxisFault {
NamedNodeMap nodeMap = importNode.getAttributes();
Node attribute;
String attributeValue;
@@ -1353,38 +1353,38 @@ public class AxisService extends AxisDes
}
/**
- * Produces a XSD for this AxisService and prints it to the specified
- * OutputStream.
- *
- * @param out
- * destination stream, NOTE: the stream is not closed after the operation,
- * it is the responsibility of the caller to close the stream after usage.
- * @param xsd
- * schema name
- * @return -1 implies not found, 0 implies redirect to root, 1 implies
- * found/printed a schema
- * @throws IOException
- */
- public int printXSD(OutputStream out, String xsd) throws IOException {
-
- // If we find a SchemaSupplier, use that
- SchemaSupplier supplier = (SchemaSupplier) getParameterValue("SchemaSupplier");
- if (supplier != null) {
- XmlSchema schema = supplier.getSchema(this, xsd);
- if (schema != null) {
- updateSchemaLocation(schema);
- schema.write(new OutputStreamWriter(out, "UTF8"));
- out.flush();
- return 1;
- }
- }
-
- // call the populator
- populateSchemaMappings();
- Map schemaMappingtable = getSchemaMappingTable();
- ArrayList<XmlSchema> schemas = getSchema();
+ * Produces a XSD for this AxisService and prints it to the specified
+ * OutputStream.
+ *
+ * @param out
+ * destination stream, NOTE: the stream is not closed after the operation,
+ * it is the responsibility of the caller to close the stream after usage.
+ * @param xsd
+ * schema name
+ * @return -1 implies not found, 0 implies redirect to root, 1 implies
+ * found/printed a schema
+ * @throws IOException
+ */
+ public int printXSD(OutputStream out, String xsd) throws IOException {
+
+ // If we find a SchemaSupplier, use that
+ SchemaSupplier supplier = (SchemaSupplier) getParameterValue("SchemaSupplier");
+ if (supplier != null) {
+ XmlSchema schema = supplier.getSchema(this, xsd);
+ if (schema != null) {
+ updateSchemaLocation(schema);
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ return 1;
+ }
+ }
- // a name is present - try to pump the requested schema
+ // call the populator
+ populateSchemaMappings();
+ Map schemaMappingtable = getSchemaMappingTable();
+ ArrayList<XmlSchema> schemas = getSchema();
+
+ // a name is present - try to pump the requested schema
if ((xsd != null) && (!"".equals(xsd))) {
XmlSchema schema = (XmlSchema) schemaMappingtable.get(xsd);
if (schema == null) {
@@ -1416,102 +1416,102 @@ public class AxisService extends AxisDes
return -1;
}
}
- } else if (schemas.size() > 1) {
- // multiple schemas are present and the user specified
- // no name - in this case we cannot possibly pump a schema
- // so redirect to the service root
- return 0;
- } else {
- // user specified no name and there is only one schema
- // so pump that out
- ArrayList<XmlSchema> list = getSchema();
- if (list.size() > 0) {
- XmlSchema schema = getSchema(0);
- if (schema != null) {
- schema.write(new OutputStreamWriter(out, "UTF8"));
- out.flush();
- }
- } else {
- String xsdNotFound = "<error>"
- + "<description>Unable to access schema for this service</description>"
- + "</error>";
- out.write(xsdNotFound.getBytes());
- out.flush();
- }
- }
- return 1;
- }
-
- /**
- * Produces a WSDL for this AxisService and prints it to the specified
- * OutputStream.
- *
- * @param out
- * destination stream. The WSDL will be sent here. NOTE: the stream is not closed after the operation,
- * it is the responsibility of the caller to close the stream after usage.
- * @param requestIP
- * the hostname the WSDL request was directed at. This should be
- * the address that appears in the generated WSDL.
- * @throws AxisFault
- * if an error occurs
- */
- public void printWSDL(OutputStream out, String requestIP) throws AxisFault {
- // If we're looking for pre-existing WSDL, use that.
- if (isUseUserWSDL()) {
- printUserWSDL(out, null, requestIP);
- return;
- }
-
- // If we find a WSDLSupplier with WSDL 1.1 content, use that
- WSDLSupplier supplier = getUserDefinedWSDLSupplier("wsdl");
- if(supplier == null){
- supplier = (WSDLSupplier) getParameterValue(Constants.WSDL_SUPPLIER_PARAM);
- if(supplier instanceof WSDL11SupplierTemplate){
- ((WSDL11SupplierTemplate)supplier).init(this);
- }
- }
- if (supplier != null) {
- Object wsdlContent = supplier.getWSDL(this);
- if( wsdlContent instanceof Definition){
- try {
- Definition definition = (Definition) wsdlContent;
- if (definition != null) {
- changeImportAndIncludeLocations(definition);
- printDefinitionObject(getWSDLDefinition(definition, null),
- out, requestIP);
- }
- } catch (Exception e) {
- printWSDLError(out, e);
- }
- // wsdlContent can be a OMElement
- } else if (wsdlContent instanceof OMElement) {
- OMElement wsdlElement = (OMElement) wsdlContent;
- QName wsdlName = wsdlElement.getQName();
- if (wsdlName != null
- && wsdlName.getLocalPart().equals("definitions")
- && wsdlName.getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/")) {
- // TODO How to address port number/ ip name customization
- // here ?
- try {
- XMLPrettyPrinter.prettify(wsdlElement, out);
- out.flush();
- } catch (Exception e) {
- throw AxisFault.makeFault(e);
- }
- }
- }
- return;
- }
+ } else if (schemas.size() > 1) {
+ // multiple schemas are present and the user specified
+ // no name - in this case we cannot possibly pump a schema
+ // so redirect to the service root
+ return 0;
+ } else {
+ // user specified no name and there is only one schema
+ // so pump that out
+ ArrayList<XmlSchema> list = getSchema();
+ if (list.size() > 0) {
+ XmlSchema schema = getSchema(0);
+ if (schema != null) {
+ schema.write(new OutputStreamWriter(out, "UTF8"));
+ out.flush();
+ }
+ } else {
+ String xsdNotFound = "<error>"
+ + "<description>Unable to access schema for this service</description>"
+ + "</error>";
+ out.write(xsdNotFound.getBytes());
+ out.flush();
+ }
+ }
+ return 1;
+ }
+
+ /**
+ * Produces a WSDL for this AxisService and prints it to the specified
+ * OutputStream.
+ *
+ * @param out
+ * destination stream. The WSDL will be sent here. NOTE: the stream is not closed after the operation,
+ * it is the responsibility of the caller to close the stream after usage.
+ * @param requestIP
+ * the hostname the WSDL request was directed at. This should be
+ * the address that appears in the generated WSDL.
+ * @throws AxisFault
+ * if an error occurs
+ */
+ public void printWSDL(OutputStream out, String requestIP) throws AxisFault {
+ // If we're looking for pre-existing WSDL, use that.
+ if (isUseUserWSDL()) {
+ printUserWSDL(out, null, requestIP);
+ return;
+ }
+
+ // If we find a WSDLSupplier with WSDL 1.1 content, use that
+ WSDLSupplier supplier = getUserDefinedWSDLSupplier("wsdl");
+ if(supplier == null){
+ supplier = (WSDLSupplier) getParameterValue(Constants.WSDL_SUPPLIER_PARAM);
+ if(supplier instanceof WSDL11SupplierTemplate){
+ ((WSDL11SupplierTemplate)supplier).init(this);
+ }
+ }
+ if (supplier != null) {
+ Object wsdlContent = supplier.getWSDL(this);
+ if( wsdlContent instanceof Definition){
+ try {
+ Definition definition = (Definition) wsdlContent;
+ if (definition != null) {
+ changeImportAndIncludeLocations(definition);
+ printDefinitionObject(getWSDLDefinition(definition, null),
+ out, requestIP);
+ }
+ } catch (Exception e) {
+ printWSDLError(out, e);
+ }
+ // wsdlContent can be a OMElement
+ } else if (wsdlContent instanceof OMElement) {
+ OMElement wsdlElement = (OMElement) wsdlContent;
+ QName wsdlName = wsdlElement.getQName();
+ if (wsdlName != null
+ && wsdlName.getLocalPart().equals("definitions")
+ && wsdlName.getNamespaceURI().equals("http://schemas.xmlsoap.org/wsdl/")) {
+ // TODO How to address port number/ ip name customization
+ // here ?
+ try {
[... 3394 lines stripped ...]