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 da...@apache.org on 2006/07/03 19:02:20 UTC
svn commit: r418808 - in /webservices/axis2/trunk/java:
modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/
modules/codegen/src/org/apache/axis2/wsdl/template/general/
modules/core/src/org/apache/axis2/
modules/core/src/org/apache/axis2/deployme...
Author: davidillsley
Date: Mon Jul 3 10:02:19 2006
New Revision: 418808
URL: http://svn.apache.org/viewvc?rev=418808&view=rev
Log:
Final part of merged patch from AXIS2-750.
- Adds support for reading output and fault actions from services.xml
- Updates the services.xml xsd
- Adds support to codegen to generate services.xml with outputActionMapping and faultActionMapping
- Adds support from wsaw:Action to AxisService2OM
All unit tests pass locally
Modified:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
webservices/axis2/trunk/java/xdocs/latest/resources/schemas/services.xsd
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java Mon Jul 3 10:02:19 2006
@@ -16,6 +16,7 @@
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.URIResolver;
+import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.description.AxisMessage;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -1258,6 +1259,7 @@
addSOAPAction(doc, methodElement, axisOperation);
+ addOutputAndFaultActions(doc, methodElement, axisOperation);
//add header ops for input
addHeaderOperations(soapHeaderInputParameterList, axisOperation, true);
//add header ops for output
@@ -1296,6 +1298,7 @@
addSOAPAction(doc, methodElement, axisOperation);
+ addOutputAndFaultActions(doc, methodElement, axisOperation);
addHeaderOperations(soapHeaderInputParameterList, axisOperation, true);
addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
@@ -1457,6 +1460,31 @@
addAttribute(doc, "soapaction", axisOperation.getSoapAction(), rootElement);
}
+ /**
+ * Adds the output and fault actions
+ * @param doc
+ * @param methodElement
+ * @param operation
+ */
+ private void addOutputAndFaultActions(Document doc, Element methodElement, AxisOperation operation){
+ String outputAction = operation.getOutputAction();
+ if(outputAction != null){
+ Element outputActionElt = doc.createElement(org.apache.axis2.Constants.OUTPUT_ACTION_MAPPING);
+ outputActionElt.setAttribute(AddressingConstants.WSA_ACTION, outputAction);
+ methodElement.appendChild(outputActionElt);
+ }
+
+ String[] faultActionNames = operation.getFaultActionNames();
+ if(faultActionNames != null){
+ for(int i=0;i<faultActionNames.length; i++){
+ Element faultActionElt = doc.createElement(org.apache.axis2.Constants.FAULT_ACTION_MAPPING);
+ faultActionElt.setAttribute(org.apache.axis2.Constants.FAULT_ACTION_NAME, faultActionNames[i]);
+ faultActionElt.setAttribute(AddressingConstants.WSA_ACTION, operation.getFaultAction(faultActionNames[i]));
+ methodElement.appendChild(faultActionElt);
+ }
+ }
+ }
+
/**
* populate the header parameters
*
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/general/ServiceXMLTemplate.xsl Mon Jul 3 10:02:19 2006
@@ -49,6 +49,17 @@
<actionMapping>
<xsl:value-of select="@soapaction"/>
</actionMapping>
+ <xsl:for-each select="outputActionMapping">
+ <outputActionMapping>
+ <xsl:value-of select="@Action"/>
+ </outputActionMapping>
+ </xsl:for-each>
+ <xsl:for-each select="faultActionMapping">
+ <faultActionMapping>
+ <xsl:attribute name="faultName"><xsl:value-of select="@faultName"/></xsl:attribute>
+ <xsl:value-of select="@Action"/>
+ </faultActionMapping>
+ </xsl:for-each>
</operation>
</xsl:for-each>
</service>
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/Constants.java Mon Jul 3 10:02:19 2006
@@ -163,6 +163,9 @@
public static final String CONFIG_CONTEXT = "config_context";
public static final String WSDL_CONTENT = "wsdl";
public static final String ACTION_MAPPING = "actionMapping";
+ public static final String OUTPUT_ACTION_MAPPING = "outputActionMapping";
+ public static final String FAULT_ACTION_MAPPING = "faultActionMapping";
+ public static final String FAULT_ACTION_NAME = "faultName";
public static final String VALUE_TRUE = "true";
public static final String VALUE_FALSE = "false";
public static final String TESTING_PATH = "target/test-resources/";
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/DescriptionBuilder.java Mon Jul 3 10:02:19 2006
@@ -24,6 +24,7 @@
import org.apache.axiom.om.util.StAXUtils;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axis2.AxisFault;
+import org.apache.axis2.Constants;
import org.apache.axis2.wsdl.WSDLConstants;
import org.apache.axis2.description.AxisOperation;
import org.apache.axis2.description.AxisService;
@@ -386,21 +387,47 @@
}
/**
- * To process <wsamapping>Value</wsamapping> elements which can be there inside operation tag
- * either in services.xml or module.xml
- *
- * @param mappingIterator
- * @return ArrayList
+ * Populate the AxisOperation with details from the actionMapping, outputActionMapping
+ * and faultActionMapping elements from the operation element.
+ * @param operation
+ * @param op_descrip
*/
- protected ArrayList processWsaMapping(Iterator mappingIterator) {
+ protected void processActionMappings(OMElement operation, AxisOperation op_descrip){
+ Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.ACTION_MAPPING));
ArrayList mappingList = new ArrayList();
while (mappingIterator.hasNext()) {
OMElement mappingElement = (OMElement) mappingIterator.next();
- mappingList.add(mappingElement.getText().trim());
+ String inputActionString = mappingElement.getText().trim();
+ if(log.isTraceEnabled()){
+ log.trace("Input Action Mapping found: "+inputActionString);
+ }
+ mappingList.add(inputActionString);
+ }
+ op_descrip.setWsamappingList(mappingList);
+
+ OMElement outputAction = operation.getFirstChildWithName(new QName(Constants.OUTPUT_ACTION_MAPPING));
+ if((outputAction != null) && (outputAction.getText() != null)){
+ String outputActionString = outputAction.getText().trim();
+ if(log.isTraceEnabled()){
+ log.trace("Output Action Mapping found: "+outputActionString);
+ }
+ op_descrip.setOutputAction(outputActionString);
+ }
+ Iterator faultActionsIterator = operation.getChildrenWithName(new QName(Constants.FAULT_ACTION_MAPPING));
+ while (faultActionsIterator.hasNext()) {
+ OMElement faultMappingElement = (OMElement) faultActionsIterator.next();
+ String faultActionString = faultMappingElement.getText().trim();
+ String faultActionName = faultMappingElement.getAttributeValue(new QName(Constants.FAULT_ACTION_NAME));
+ if(faultActionName != null && faultActionString!=null){
+ if(log.isTraceEnabled()){
+ log.trace("Fault Action Mapping found: "+faultActionName+", "+faultActionString);
+ }
+ op_descrip.addFaultAction(faultActionName, faultActionString);
+ }
}
- return mappingList;
}
-
+
+
protected void processPolicyElements(int type, Iterator policyElements,
PolicyInclude policyInclude) {
OMPolicyReader reader = (OMPolicyReader) PolicyFactory
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ModuleBuilder.java Mon Jul 3 10:02:19 2006
@@ -17,10 +17,17 @@
package org.apache.axis2.deployment;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.description.AxisOperation;
@@ -32,13 +39,6 @@
import org.apache.axis2.i18n.Messages;
import org.apache.axis2.modules.Module;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Iterator;
-
/**
* Builds a module description from OM
*/
@@ -216,12 +216,8 @@
processParameters(parameters, op_descrip, module);
//To process wsamapping;
- Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.ACTION_MAPPING));
- if (mappingIterator != null) {
- ArrayList wsamappings = processWsaMapping(mappingIterator);
- op_descrip.setWsamappingList(wsamappings);
- }
-
+ processActionMappings(operation, op_descrip);
+
// setting the mep of the operation
// loading the message receivers
OMElement receiverElement = operation.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER));
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/deployment/ServiceBuilder.java Mon Jul 3 10:02:19 2006
@@ -17,10 +17,18 @@
package org.apache.axis2.deployment;
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
-import org.apache.axis2.Constants;
import org.apache.axis2.deployment.util.PhasesInfo;
import org.apache.axis2.deployment.util.Utils;
import org.apache.axis2.description.*;
@@ -32,14 +40,6 @@
import org.apache.commons.logging.LogFactory;
import org.apache.ws.java2wsdl.Java2WSDLConstants;
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import java.io.InputStream;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
/**
* Builds a service description from OM
*/
@@ -469,11 +469,7 @@
Iterator parameters = operation.getChildrenWithName(new QName(TAG_PARAMETER));
processParameters(parameters, op_descrip, service);
//To process wsamapping;
- Iterator mappingIterator = operation.getChildrenWithName(new QName(Constants.ACTION_MAPPING));
- if (mappingIterator != null) {
- ArrayList wsamappings = processWsaMapping(mappingIterator);
- op_descrip.setWsamappingList(wsamappings);
- }
+ processActionMappings(operation, op_descrip);
// loading the message receivers
OMElement receiverElement = operation.getFirstChildWithName(new QName(TAG_MESSAGE_RECEIVER));
Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/description/AxisService2OM.java Mon Jul 3 10:02:19 2006
@@ -324,6 +324,10 @@
+ ":" + inaxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.INPUT_POLICY,
inaxisMessage.getPolicyInclude(), input, fac);
+ if(axisOperation.getWsamappingList()!=null && axisOperation.getWsamappingList().size()>0){
+ String action = axisOperation.getWsamappingList().get(0).toString();
+ addWSAWActionAttribute(fac,input,action);
+ }
operation.addChild(input);
}
}
@@ -343,6 +347,7 @@
+ ":" + outAxisMessage.getName(), null);
addPolicyAsExtElement(PolicyInclude.OUTPUT_POLICY,
outAxisMessage.getPolicyInclude(), output, fac);
+ addWSAWActionAttribute(fac,output,axisOperation.getOutputAction());
operation.addChild(output);
}
}
@@ -359,6 +364,7 @@
+ ":" + faultyMessge.getName(), null);
fault.addAttribute(ATTRIBUTE_NAME, faultyMessge.getName(),
null);
+ addWSAWActionAttribute(fac,fault,axisOperation.getFaultAction(faultyMessge.getName()));
// TODO add policies for fault messages
operation.addChild(fault);
}
@@ -847,6 +853,14 @@
return null;
}
+ private void addWSAWActionAttribute(OMFactory fac, OMElement element, String action){
+ if(action==null || action.length()==0){
+ return;
+ }
+ OMNamespace namespace = element.declareNamespace(AddressingConstants.Final.WSAW_NAMESPACE,"wsaw");
+ element.addAttribute("Action", action, namespace);
+ }
+
private void addPolicyAsExtElement(int type, PolicyInclude policyInclude,
OMElement element, OMFactory factory) throws Exception {
ArrayList elementList = policyInclude.getPolicyElements(type);
Modified: webservices/axis2/trunk/java/xdocs/latest/resources/schemas/services.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/xdocs/latest/resources/schemas/services.xsd?rev=418808&r1=418807&r2=418808&view=diff
==============================================================================
--- webservices/axis2/trunk/java/xdocs/latest/resources/schemas/services.xsd (original)
+++ webservices/axis2/trunk/java/xdocs/latest/resources/schemas/services.xsd Mon Jul 3 10:02:19 2006
@@ -3,6 +3,12 @@
<xs:complexType name="operationType">
<xs:sequence>
<xs:element name="actionMapping" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="outputActionMapping" type="xs:string" minOccurs="0" maxOccurs="1"/>
+ <xs:element name="faultActionMapping" type="xs:string" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:attribute name="faultName" use="required"/>
+ </xs:complexType>
+ </xs:element>
<xs:element name="messageReceiver" minOccurs="0">
<xs:complexType>
<xs:attribute name="class" use="required"/>
@@ -45,6 +51,7 @@
<xs:element name="operation" type="operationType" minOccurs="0" maxOccurs="unbounded"/>
</xs:sequence>
<xs:attribute name="name" type="xs:string" use="required"/>
+ <xs:attribute name="wsaddressing" type="xs:string" />
</xs:complexType>
</xs:element>
<xs:element name="serviceGroup">
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org