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 di...@apache.org on 2004/01/30 21:19:11 UTC
cvs commit: ws-axis/java/src/org/apache/axis/providers/java RPCProvider.java
dims 2004/01/30 12:19:11
Modified: java/src/org/apache/axis/message BodyBuilder.java
java/test/soap12 PackageTests.java
java/src/org/apache/axis/providers/java RPCProvider.java
Added: java/test/soap12 TestExceptions.java
Log:
Let the RPCProvider throw Soap1.2 FAULT_SUBCODE_PROC_NOT_PRESENT exceptions and NOT the BodyBuilder. If the incoming soap message is encrypted and we are using SOAP 1.2 we run into problems.
Revision Changes Path
1.61 +0 -14 ws-axis/java/src/org/apache/axis/message/BodyBuilder.java
Index: BodyBuilder.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- BodyBuilder.java 23 Nov 2003 04:36:01 -0000 1.60
+++ BodyBuilder.java 30 Jan 2004 20:19:11 -0000 1.61
@@ -220,20 +220,6 @@
throw new SAXException(e);
}
- // SBFIX : If we're here with no operations, we're going to have
- // a dispatch problem. If SOAP12, fault.
- if (operations == null &&
- (msgContext != null && !msgContext.isClient() &&
- (msgContext.getProperty(Constants.MC_NO_OPERATION_OK) == null)) &&
- soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
- AxisFault fault =
- new AxisFault(Constants.FAULT_SOAP12_SENDER,
- "No such procedure", null, null);
- fault.addFaultSubCode(
- Constants.FAULT_SUBCODE_PROC_NOT_PRESENT);
- throw new SAXException(fault);
- }
-
// Only deserialize this way if there is a unique operation
// for this QName. If there are overloads,
// we'll need to start recording. If we're making a high-
1.6 +1 -0 ws-axis/java/test/soap12/PackageTests.java
Index: PackageTests.java
===================================================================
RCS file: /home/cvs/ws-axis/java/test/soap12/PackageTests.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- PackageTests.java 22 Apr 2003 19:36:56 -0000 1.5
+++ PackageTests.java 30 Jan 2004 20:19:11 -0000 1.6
@@ -77,6 +77,7 @@
suite.addTestSuite(TestRPC.class);
suite.addTestSuite(TestVersionMismatch.class);
suite.addTestSuite(TestEncodingStyle.class);
+ suite.addTestSuite(TestExceptions.class);
return suite;
}
}
1.1 ws-axis/java/test/soap12/TestExceptions.java
Index: TestExceptions.java
===================================================================
package test.soap12;
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.client.Call;
import test.GenericLocalTest;
import javax.xml.namespace.QName;
/**
* Ensure that SOAP 1.2's FAULT_SUBCODE_PROC_NOT_PRESENT is thrown if the method is not found
*/
public class TestExceptions extends GenericLocalTest {
public TestExceptions() {
super("foo");
}
public TestExceptions(String s) {
super(s);
}
/**
* base test ensure that SOAP1.2 works :)
* @throws Exception
*/
public void testEcho() throws Exception {
Object result = null;
Call call = getCall();
call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
result = call.invoke("echo", null);
assertEquals(result.toString(), "hello world");
}
/**
* call a method that does not exist and check if the correct exception
* is thrown from the server.
* @throws Exception
*/
public void testNoSuchProcedure() throws Exception {
Object result = null;
try {
Call call = getCall();
call.setSOAPVersion(SOAPConstants.SOAP12_CONSTANTS);
result = call.invoke("unknownFreakyMethod", null);
} catch (AxisFault fault){
assertEquals(Constants.FAULT_SOAP12_SENDER, fault.getFaultCode());
QName [] subCodes = fault.getFaultSubCodes();
assertNotNull(subCodes);
assertEquals(1, subCodes.length);
assertEquals(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT, subCodes[0]);
return;
}
fail("Didn't catch expected fault");
}
/**
* Service method. Returns a string
*
* @return a string
*/
public String echo() {
return "hello world";
}
}
1.112 +13 -2 ws-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
Index: RPCProvider.java
===================================================================
RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- RPCProvider.java 26 Dec 2003 15:18:48 -0000 1.111
+++ RPCProvider.java 30 Jan 2004 20:19:11 -0000 1.112
@@ -200,8 +200,19 @@
}
if (operation == null) {
- throw new AxisFault(Messages.getMessage("noSuchOperation",
- methodName));
+ SOAPConstants soapConstants = msgContext == null ?
+ SOAPConstants.SOAP11_CONSTANTS :
+ msgContext.getSOAPConstants();
+ if (soapConstants == SOAPConstants.SOAP12_CONSTANTS) {
+ AxisFault fault =
+ new AxisFault(Constants.FAULT_SOAP12_SENDER,
+ Messages.getMessage("noSuchOperation"), null, null);
+ fault.addFaultSubCode(Constants.FAULT_SUBCODE_PROC_NOT_PRESENT);
+ throw new SAXException(fault);
+ } else {
+ throw new AxisFault(Messages.getMessage("noSuchOperation",
+ methodName));
+ }
}
// Create the array we'll use to hold the actual parameter