You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2008/07/11 01:02:08 UTC
svn commit: r675798 - in /ode/branches/APACHE_ODE_1.1:
axis2-war/src/test/resources/TestHttpBindingExt_PUT/
axis2-war/src/test/resources/TestStructuredFault/
axis2/src/main/java/org/apache/ode/axis2/
axis2/src/main/java/org/apache/ode/axis2/httpbinding...
Author: midon
Date: Thu Jul 10 16:02:07 2008
New Revision: 675798
URL: http://svn.apache.org/viewvc?rev=675798&view=rev
Log:
ODE-328: pass fault name instead of fault type
Modified:
ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/Blog.wsdl
ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel
ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/HelloWorld2.bpel
ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/dummy-service.wsdl
ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java
Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/Blog.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/Blog.wsdl?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/Blog.wsdl (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/Blog.wsdl Thu Jul 10 16:02:07 2008
@@ -80,7 +80,7 @@
<wsdl:operation name="doPUT">
<wsdl:input message="tns:PUTRequest"/>
<wsdl:output message="tns:NoPartMessage"/>
- <wsdl:fault name="UpdateFault" message="tns:UpdateFault"/>
+ <wsdl:fault name="UpdateException" message="tns:UpdateFault"/>
</wsdl:operation>
<wsdl:operation name="doPOST">
<wsdl:input message="tns:CommentRequest"/>
@@ -123,7 +123,7 @@
</wsdl:input>
<wsdl:output/>
<!-- fault binding -->
- <wsdl:fault name="UpdateFault">
+ <wsdl:fault name="UpdateException">
<!-- name attribute is optional -->
<!--<odex:fault name="UpdateException"/>-->
<odex:fault/>
Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel Thu Jul 10 16:02:07 2008
@@ -44,9 +44,6 @@
<variable name="faultVar" messageType="dummy:UpdateFault"/>
<variable name="putMsg" messageType="dummy:PUTRequest"/>
<variable name="noPartMsg" messageType="dummy:NoPartMessage"/>
- <!--<variable name="generatedTimestamp" type="xsd:string"/>-->
- <!--<variable name="receivedTimestamp" type="xsd:string"/>-->
- <!--<variable name="receivedUserAgent" type="xsd:string"/>-->
</variables>
<sequence>
@@ -54,6 +51,7 @@
operation="hello" variable="inputVar" createInstance="yes"/>
<!-- Initialize output var -->
+ <!-- Change this value to make the test fail. -->
<assign>
<copy>
<from>'What a success!'</from>
@@ -98,7 +96,7 @@
<!-- ############################################### -->
<scope>
<faultHandlers>
- <catch faultMessageType="dummy:UpdateFault" faultName="dummy:UpdateFault" faultVariable="faultVar">
+ <catch faultMessageType="dummy:UpdateFault" faultName="dummy:UpdateException" faultVariable="faultVar">
<empty/>
</catch>
</faultHandlers>
@@ -134,7 +132,7 @@
<catch faultName="ext:activityFailure">
<!-- expected result-->
<!--
- Warning!! At this point what we know for sure is that a failure occured
+ Warning #1!! At this point what we know for sure is that a failure occured
but we don't know which failure exactly.
We would like to test if the the failure is really the one we triggered on purpose and not a TimeoutFailure for instance.
-->
@@ -173,7 +171,7 @@
<catch faultName="ext:activityFailure">
<!-- expected result-->
<!--
- Warning!! At this point what we know for sure is that a failure occured
+ Warning #1!! At this point what we know for sure is that a failure occured
but we don't know which failure exactly.
We would like to test if the the failure is really the one we triggered on purpose and not a TimeoutFailure for instance.
-->
@@ -188,8 +186,7 @@
</copy>
</assign>
<invoke partnerLink="blogPartnerLink" portType="dummy:BlogPortType"
- operation="doPUT" inputVariable="putMsg" outputVariable="noPartMsg">
- </invoke>
+ operation="doPUT" inputVariable="putMsg" outputVariable="noPartMsg"/>
<assign>
<copy>
<from>'500_text_body: A failure should have been thrown'</from>
@@ -212,7 +209,7 @@
<catch faultName="ext:activityFailure">
<!-- expected result-->
<!--
- Warning!! At this point what we know for sure is that a failure occured
+ Warning #1!! At this point what we know for sure is that a failure occured
but we don't know which failure exactly.
We would like to test if the the failure is really the one we triggered on purpose and not a TimeoutFailure for instance.
-->
@@ -240,6 +237,35 @@
</sequence>
</scope>
+ <!-- ############################################### -->
+ <!-- 500_expected_xml_body - Fault expected -->
+ <!-- ############################################### -->
+ <scope>
+ <faultHandlers>
+ <catch faultMessageType="dummy:UpdateFault" faultName="dummy:UpdateException" faultVariable="faultVar">
+ <empty/>
+ </catch>
+ </faultHandlers>
+ <sequence>
+ <assign>
+ <copy>
+ <from>'500_expected_xml_body'</from>
+ <to variable="putMsg" header="Fault-Type"/>
+ </copy>
+ </assign>
+ <invoke partnerLink="blogPartnerLink" portType="dummy:BlogPortType"
+ operation="doPUT" inputVariable="putMsg" outputVariable="noPartMsg"/>
+ <assign>
+ <copy>
+ <from>'500_expected_xml_body: A fault should have been thrown'</from>
+ <to>$outputVar.TestPart</to>
+ </copy>
+ </assign>
+ <reply name="end" partnerLink="helloPartnerLink" portType="test:HelloPortType"
+ operation="hello" variable="outputVar"/>
+ </sequence>
+ </scope>
+
<reply name="end" partnerLink="helloPartnerLink" portType="test:HelloPortType"
operation="hello" variable="outputVar"/>
Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/HelloWorld2.bpel
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/HelloWorld2.bpel?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/HelloWorld2.bpel (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/HelloWorld2.bpel Thu Jul 10 16:02:07 2008
@@ -41,7 +41,7 @@
<variable name="myVar" messageType="test:HelloMessage"/>
<variable name="faultInput" messageType="dummy:faultTestRequest"/>
<variable name="faultOutput" messageType="dummy:faultTestResponse"/>
- <variable name="faultVar" messageType="dummy:DummyException"/>
+ <variable name="faultVar" messageType="dummy:DummyExceptionType"/>
<variable name="tmpVar" type="xsd:string"/>
</variables>
@@ -58,7 +58,7 @@
<invoke partnerLink="dummyPartnerLink" portType="test:DummyServicePortType"
operation="faultTest" inputVariable="faultInput" outputVariable="faultOutput">
- <catch faultMessageType="dummy:DummyException" faultName="dummy:DummyException" faultVariable="faultVar">
+ <catch faultMessageType="dummy:DummyExceptionType" faultName="dummy:DummyException" faultVariable="faultVar">
<sequence>
<assign>
<copy>
Modified: ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/dummy-service.wsdl
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/dummy-service.wsdl?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/dummy-service.wsdl (original)
+++ ode/branches/APACHE_ODE_1.1/axis2-war/src/test/resources/TestStructuredFault/dummy-service.wsdl Thu Jul 10 16:02:07 2008
@@ -56,7 +56,7 @@
<wsdl:message name="faultTestResponse">
<wsdl:part name="parameters" element="ns1:faultTestResponse"/>
</wsdl:message>
- <wsdl:message name="DummyException">
+ <wsdl:message name="DummyExceptionType">
<wsdl:part name="parameters" element="ns1:DummyException"/>
</wsdl:message>
<wsdl:message name="helloRequest">
@@ -69,7 +69,7 @@
<wsdl:operation name="faultTest">
<wsdl:input message="ns1:faultTestRequest" wsaw:Action="urn:faultTest"/>
<wsdl:output message="ns1:faultTestResponse" wsaw:Action="urn:faultTestResponse"/>
- <wsdl:fault message="ns1:DummyException" name="DummyException"
+ <wsdl:fault message="ns1:DummyExceptionType" name="DummyException"
wsaw:Action="urn:faultTestDummyException"/>
</wsdl:operation>
<wsdl:operation name="hello">
Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/SoapExternalService.java Thu Jul 10 16:02:07 2008
@@ -27,8 +27,8 @@
import java.io.InputStream;
import javax.wsdl.Definition;
-import javax.wsdl.Fault;
import javax.wsdl.Operation;
+import javax.wsdl.Fault;
import javax.xml.namespace.QName;
import org.apache.axiom.soap.SOAPEnvelope;
@@ -73,7 +73,7 @@
*
* @author Matthieu Riou <mriou at apache dot org>
*/
-public class SoapExternalService implements ExternalService {
+public class SoapExternalService implements ExternalService {
private static final Log __log = LogFactory.getLog(SoapExternalService.class);
@@ -322,7 +322,7 @@
}
- private void reply(final String odeMexId, final Operation operation, final MessageContext reply, final boolean fault) {
+ private void reply(final String odeMexId, final Operation operation, final MessageContext reply, final boolean isFault) {
// ODE MEX needs to be invoked in a TX.
try {
_sched.execIsolatedTransaction(new Callable<Void>() {
@@ -331,19 +331,22 @@
// Setting the response
try {
if (__log.isDebugEnabled()) __log.debug("Received response for MEX " + odeMex);
- if (fault) {
+ if (isFault) {
Document odeMsg = DOMUtils.newDocument();
Element odeMsgEl = odeMsg.createElementNS(null, "message");
odeMsg.appendChild(odeMsgEl);
- QName faultType = _converter.parseSoapFault(odeMsgEl, reply.getEnvelope(), operation);
+ Fault fault = _converter.parseSoapFault(odeMsgEl, reply.getEnvelope(), operation);
- if (faultType != null) {
+ if (fault != null) {
if (__log.isWarnEnabled())
- __log.warn("Fault response: faultType=" + faultType + "\n" + DOMUtils.domToString(odeMsgEl));
+ __log.warn("Fault response: faultName=" + fault.getName() + " faultType="+fault.getMessage().getQName()+ "\n" + DOMUtils.domToString(odeMsgEl));
+
+ QName faultType = fault.getMessage().getQName();
+ QName faultName = new QName(_definition.getTargetNamespace(), fault.getName());
Message response = odeMex.createMessage(faultType);
response.setMessage(odeMsgEl);
- odeMex.replyWithFault(faultType, response);
+ odeMex.replyWithFault(faultName, response);
} else {
if (__log.isWarnEnabled())
__log.warn("Fault response: faultType=(unkown)\n" + reply.getEnvelope().toString());
Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Thu Jul 10 16:02:07 2008
@@ -57,9 +57,7 @@
import javax.wsdl.extensions.mime.MIMEContent;
import javax.xml.namespace.QName;
import java.io.IOException;
-import java.io.InputStream;
import java.io.UnsupportedEncodingException;
-import java.io.StringReader;
import java.util.Map;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
@@ -354,7 +352,8 @@
// import the response body
partEl.appendChild(odeMsgEl.getOwnerDocument().importNode(bodyEl, true));
- QName faultType = new QName(targetNamespace, faultDef.getName());
+ QName faultName = new QName(targetNamespace, faultDef.getName());
+ QName faultType = faultDef.getMessage().getQName();
Message response = odeMex.createMessage(faultType);
response.setMessage(odeMsgEl);
@@ -362,8 +361,9 @@
httpMethodConverter.extractHttpResponseHeaders(response, method, faultDef.getMessage(), opBinding.getBindingOutput());
// finally send the fault. We did it!
- if(log.isWarnEnabled()) log.warn("Fault response: faultType=" + faultType + "\n" + DOMUtils.domToString(odeMsgEl));
- odeMex.replyWithFault(faultType, response);
+ if (log.isWarnEnabled())
+ log.warn("Fault response: faultName=" + faultName + " faultType=" + faultType + "\n" + DOMUtils.domToString(odeMsgEl));
+ odeMex.replyWithFault(faultName, response);
}
} catch (Exception e) {
errmsg = "Unable to parse the response body as xml. This 500 error will be considered as a failure.";
Modified: ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java?rev=675798&r1=675797&r2=675798&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java (original)
+++ ode/branches/APACHE_ODE_1.1/axis2/src/main/java/org/apache/ode/axis2/util/SoapMessageConverter.java Thu Jul 10 16:02:07 2008
@@ -510,7 +510,7 @@
return "";
}
- public QName parseSoapFault(Element odeMsgEl, SOAPEnvelope envelope, Operation operation) throws AxisFault {
+ public Fault parseSoapFault(Element odeMsgEl, SOAPEnvelope envelope, Operation operation) throws AxisFault {
SOAPFault flt = envelope.getBody().getFault();
SOAPFaultDetail detail = flt.getDetail();
Fault fdef = inferFault(operation, flt);
@@ -528,7 +528,7 @@
partel.appendChild(odeMsgEl.getOwnerDocument().importNode(OMUtils.toDOM(detail),true));
}
- return new QName(_def.getTargetNamespace(), fdef.getName());
+ return fdef;
}
@SuppressWarnings("unchecked")