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 00:37:13 UTC
svn commit: r675790 - in /ode/trunk:
axis2-war/src/test/resources/TestHttpBindingExt_PUT/
axis2/src/main/java/org/apache/ode/axis2/httpbinding/
axis2/src/main/java/org/apache/ode/axis2/soapbinding/
Author: midon
Date: Thu Jul 10 15:37:13 2008
New Revision: 675790
URL: http://svn.apache.org/viewvc?rev=675790&view=rev
Log:
ODE-328, step 1: replyWithFault must receive faultName, not faultType no matter what the method signature says.
Step 2 would be to get ride of this dirty trick an refactor APIs so that fault type is not mentionned anymore.
Modified:
ode/trunk/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java
ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java
Modified: ode/trunk/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel
URL: http://svn.apache.org/viewvc/ode/trunk/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel?rev=675790&r1=675789&r2=675790&view=diff
==============================================================================
--- ode/trunk/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel (original)
+++ ode/trunk/axis2-war/src/test/resources/TestHttpBindingExt_PUT/http-binding-ext-PUT.bpel Thu Jul 10 15:37:13 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>
@@ -86,37 +84,6 @@
<!-- ############################################### -->
- <!-- 500_expected_xml_body - Fault expected -->
- <!-- ############################################### -->
-<!--
- <scope>
- <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">
- <catch faultMessageType="dummy:UpdateFault" faultName="dummy:UpdateException" faultVariable="faultVar">
- <empty/>
- </catch>
- </invoke>
- <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>
-
--->
-
- <!-- ############################################### -->
<!-- regular PUT -->
<!-- ############################################### -->
<invoke partnerLink="blogPartnerLink" portType="dummy:BlogPortType"
@@ -135,7 +102,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.
-->
@@ -174,7 +141,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.
-->
@@ -189,8 +156,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>
@@ -213,7 +179,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.
-->
@@ -241,6 +207,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/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java?rev=675790&r1=675789&r2=675790&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/httpbinding/HttpExternalService.java Thu Jul 10 15:37:13 2008
@@ -56,9 +56,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;
@@ -324,15 +322,16 @@
// 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);
// extract and set headers
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: faultType=" + faultName + "\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/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java?rev=675790&r1=675789&r2=675790&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapExternalService.java Thu Jul 10 15:37:13 2008
@@ -56,8 +56,8 @@
import org.w3c.dom.Element;
import javax.wsdl.Definition;
-import javax.wsdl.Fault;
import javax.wsdl.Operation;
+import javax.wsdl.Fault;
import javax.xml.namespace.QName;
import java.io.File;
import java.io.InputStream;
@@ -264,23 +264,25 @@
}
- private void reply(final PartnerRoleMessageExchange odeMex, final Operation operation, final MessageContext reply, final boolean fault) {
+ private void reply(final PartnerRoleMessageExchange odeMex, final Operation operation, final MessageContext reply, final boolean isFault) {
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 + "\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/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java
URL: http://svn.apache.org/viewvc/ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java?rev=675790&r1=675789&r2=675790&view=diff
==============================================================================
--- ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java (original)
+++ ode/trunk/axis2/src/main/java/org/apache/ode/axis2/soapbinding/SoapMessageConverter.java Thu Jul 10 15:37:13 2008
@@ -503,7 +503,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);
@@ -521,7 +521,7 @@
partel.appendChild(odeMsgEl.getOwnerDocument().importNode(OMUtils.toDOM(detail),true));
}
- return new QName(_def.getTargetNamespace(), fdef.getName());
+ return fdef;
}
private Fault inferFault(Operation operation, SOAPFault flt) {