You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2007/07/03 15:23:59 UTC
svn commit: r552830 - in /webservices/axis2/trunk/java/modules:
codegen/src/org/apache/axis2/wsdl/codegen/emitter/
codegen/src/org/apache/axis2/wsdl/codegen/extension/
codegen/src/org/apache/axis2/wsdl/template/java/
kernel/src/org/apache/axis2/descrip...
Author: sanka
Date: Tue Jul 3 06:23:57 2007
New Revision: 552830
URL: http://svn.apache.org/viewvc?view=rev&rev=552830
Log:
Fixed : JIRA AXIS2-2426.
Added:
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.java
Removed:
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/modules/ModulePolicyExtension.java
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/modules/PolicyExtension.java
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/codegen/extension/PolicyEvaluator.java
webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/faults/SendingResponseFaultTest.java
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?view=diff&rev=552830&r1=552829&r2=552830
==============================================================================
--- 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 Tue Jul 3 06:23:57 2007
@@ -265,19 +265,23 @@
return property;
}
+
+ private Policy getBindingPolicyFromMessage(QName qName, String key) {
-
- private Policy getBindingPolicyFromOperation(QName qName) {
AxisBindingOperation axisBindingOperation = null;
-
if (axisBinding != null) {
axisBindingOperation = (AxisBindingOperation) axisBinding.getChild(qName);
}
+ AxisBindingMessage axisBindingMessage = null;
+
if (axisBindingOperation != null) {
- return axisBindingOperation.getEffectivePolicy();
+
+ axisBindingMessage = (AxisBindingMessage) axisBindingOperation.getChild(key);
+ if (axisBindingMessage != null) {
+ return axisBindingMessage.getEffectivePolicy();
+ }
}
-
return null;
}
@@ -2173,24 +2177,7 @@
addOutputAndFaultActions(doc, methodElement, axisOperation);
addHeaderOperations(soapHeaderInputParameterList, axisOperation, true);
// addHeaderOperations(soapHeaderOutputParameterList, axisOperation, false);
-
- /*
- * Setting the policy of the operation
- */
- Policy policy = getBindingPolicyFromOperation(axisOperation.getName());
-
- if (policy != null) {
- try {
- addAttribute(doc, "policy",
- PolicyUtil.getSafeString(PolicyUtil.policyComponentToString(policy)),
- methodElement);
- } catch (Exception ex) {
- throw new RuntimeException("can't serialize the policy ..");
- }
- }
-
-// System.out.println(DOM2Writer.nodeToString(methodElement));
-
+
if (WSDLUtil.isInputPresentForMEP(messageExchangePattern)) {
methodElement.appendChild(getInputElement(doc,
@@ -2647,6 +2634,22 @@
for (int i = 0; i < parameterElementList.size(); i++) {
inputElt.appendChild((Element) parameterElementList.get(i));
}
+
+ /*
+ * Setting the effective policy of input message
+ */
+ Policy policy = getBindingPolicyFromMessage(operation.getName(), WSDLConstants.WSDL_MESSAGE_DIRECTION_IN);
+
+ if (policy != null) {
+ try {
+ addAttribute(doc, "policy",
+ PolicyUtil.getSafeString(PolicyUtil.policyComponentToString(policy)),
+ inputElt);
+ } catch (Exception ex) {
+ throw new RuntimeException("can't serialize the policy ..");
+ }
+ }
+
}
return inputElt;
}
@@ -2700,6 +2703,21 @@
for (int i = 0; i < outputElementList.size(); i++) {
outputElt.appendChild((Element) outputElementList.get(i));
+ }
+
+ /*
+ * Setting the effective policy for the output message.
+ */
+ Policy policy = getBindingPolicyFromMessage(operation.getName(), WSDLConstants.WSDL_MESSAGE_DIRECTION_OUT);
+
+ if (policy != null) {
+ try {
+ addAttribute(doc, "policy",
+ PolicyUtil.getSafeString(PolicyUtil.policyComponentToString(policy)),
+ outputElt);
+ } catch (Exception ex) {
+ throw new RuntimeException("can't serialize the policy ..");
+ }
}
}
return outputElt;
Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.java?view=auto&rev=552830
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/ModulePolicyExtension.java Tue Jul 3 06:23:57 2007
@@ -0,0 +1,27 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen.extension;
+
+
+public interface ModulePolicyExtension {
+
+ public PolicyExtension getPolicyExtension();
+
+}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java?view=diff&rev=552830&r1=552829&r2=552830
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyEvaluator.java Tue Jul 3 06:23:57 2007
@@ -27,8 +27,6 @@
import org.apache.axis2.description.PolicyInclude;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.axis2.modules.Module;
-import org.apache.axis2.modules.ModulePolicyExtension;
-import org.apache.axis2.modules.PolicyExtension;
import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
import org.apache.neethi.Assertion;
import org.apache.neethi.Policy;
@@ -46,6 +44,8 @@
import java.util.Map;
public class PolicyEvaluator implements CodeGenExtension {
+
+ private CodeGenConfiguration configuration;
/**
* Init method to initialization
@@ -54,6 +54,7 @@
* @param namespace2ExtsMap
*/
private void init(CodeGenConfiguration configuration, Map namespace2ExtsMap) {
+ this.configuration = configuration;
// adding default PolicyExtensions
namespace2ExtsMap
@@ -61,12 +62,7 @@
new MTOMPolicyExtension(configuration));
namespace2ExtsMap.put("http://schemas.xmlsoap.org/ws/2004/09/policy/encoding",
new EncodePolicyExtension());
-
- //set the policy handling template
- configuration.putProperty("policyExtensionTemplate",
- "/org/apache/axis2/wsdl/template/java/PolicyExtensionTemplate.xsl");
-
-
+
String repository = configuration.getRepositoryPath();
if (repository == null) {
@@ -190,6 +186,7 @@
continue;
}
+ policyExtension.init(configuration);
policyExtension.addMethodsToStub(document, rootElement, opName,
(List)map.get(targetNamespace));
}
@@ -211,6 +208,9 @@
private boolean setOnce = false;
private CodeGenConfiguration configuration;
+ public void init(CodeGenConfiguration configuration) {
+ }
+
public MTOMPolicyExtension(CodeGenConfiguration configuration) {
this.configuration = configuration;
}
@@ -240,6 +240,10 @@
}
class EncodePolicyExtension implements PolicyExtension {
+
+ public void init(CodeGenConfiguration configuration) {
+ }
+
public void addMethodsToStub(Document document, Element element, QName operationName,
List assertions) {
// TODO implement encoding
Added: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.java?view=auto&rev=552830
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.java (added)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/PolicyExtension.java Tue Jul 3 06:23:57 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.wsdl.codegen.extension;
+
+import org.apache.axis2.wsdl.codegen.CodeGenConfiguration;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import javax.xml.namespace.QName;
+import java.util.List;
+
+public interface PolicyExtension {
+
+ public void init(CodeGenConfiguration codeGenConfiguration);
+
+ public void addMethodsToStub(Document document, Element element, QName methodName,
+ List assertions);
+
+}
Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl?view=diff&rev=552830&r1=552829&r2=552830
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/InterfaceImplementationTemplate.xsl Tue Jul 3 06:23:57 2007
@@ -67,19 +67,9 @@
//creating the Service with a unique name
_service = new org.apache.axis2.description.AxisService("<xsl:value-of select="@servicename"/>" + this.hashCode());
-
- <xsl:if test="@policy">
- java.lang.String _endpoint_policy_string = "<xsl:value-of select="@policy"/>";
- org.apache.neethi.Policy _endpoint_policy = getPolicy(_endpoint_policy_string);
- ((org.apache.axis2.description.PolicyInclude) _service.getPolicyInclude()).setPolicy(_endpoint_policy);
- </xsl:if>
//creating the operations
org.apache.axis2.description.AxisOperation __operation;
- <xsl:if test="//method[@policy]">
- java.lang.String __operation_policy_string;
- </xsl:if>
-
_operations = new org.apache.axis2.description.AxisOperation[<xsl:value-of select="count(method)"/>];
<xsl:for-each select="method">
@@ -94,22 +84,18 @@
__operation = new org.apache.axis2.description.OutInAxisOperation();
</xsl:otherwise>
</xsl:choose>
- <xsl:if test="@policy">
- (__operation).getPolicyInclude().setPolicy(getPolicy("<xsl:value-of select="@policy"/>"));
- </xsl:if>
__operation.setName(new javax.xml.namespace.QName("<xsl:value-of select="@namespace"/>", "<xsl:value-of select="@name"/>"));
_service.addOperation(__operation);
- <!--
+
<xsl:if test="input/@policy">
- (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicyInclude().setPolicy(getPolicy("<xsl:value-of select="input/@policy"/>"));
+ (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicyInclude().setPolicy(getPolicy("<xsl:value-of select="input/@policy"/>"));
</xsl:if>
<xsl:if test="output/@policy">
- (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE).getPolicyInclude().setPolicy(getPolicy("<xsl:value-of select="output/@policy"/>"));
+ (__operation).getMessage(org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_OUT_VALUE).getPolicyInclude().setPolicy(getPolicy("<xsl:value-of select="output/@policy"/>"));
</xsl:if>
- -->
_operations[<xsl:value-of select="position()-1"/>]=__operation;
@@ -162,7 +148,7 @@
populateFaults();
_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);
- <xsl:if test="//method[@policy]">
+ <xsl:if test="//@policy">
_service.applyPolicy();
</xsl:if>
Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java?view=diff&rev=552830&r1=552829&r2=552830
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisDescription.java Tue Jul 3 06:23:57 2007
@@ -282,10 +282,6 @@
*/
public void applyPolicy() throws AxisFault {
- if (this instanceof AxisMessage) {
- return;
- }
-
AxisConfiguration configuration = getAxisConfiguration();
if (configuration == null) {
return; // CHECKME: May be we need to throw an Exception ??
Modified: webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/faults/SendingResponseFaultTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/faults/SendingResponseFaultTest.java?view=diff&rev=552830&r1=552829&r2=552830
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/faults/SendingResponseFaultTest.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/test/org/apache/axis2/faults/SendingResponseFaultTest.java Tue Jul 3 06:23:57 2007
@@ -49,7 +49,7 @@
// Make sure this is NOT the "real" fault (which should have been swallowed while
// writing the response)
assertFalse("Got unexpected fault",
- axisFault.getMessage().contains("Invalid white space character"));
+ axisFault.getMessage().contentEquals(new StringBuffer("Invalid white space character")));
}
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org