gdaniels 2002/10/15 14:15:44
Modified: java/samples/echo TestClient.java
java/src/org/apache/axis/message EnvelopeBuilder.java
RPCHandler.java SOAPEnvelope.java SOAPHeader.java
SOAPHeaderElement.java
java/src/org/apache/axis/providers/java RPCProvider.java
java/src/org/apache/axis/server AxisServer.java
java/src/org/apache/axis/transport/local LocalResponder.java
LocalSender.java
java/test/soap PackageTests.java TestHeaderAttrs.java
Log:
Improve SOAP 1.2 support.
* Propagate the SOAPConstants better when creating headers/
envelopes
* Fix support for the <rpc:result> element, which is actually the result
itself, not another parameter
* Add a SOAP1.2 version of the header attributes test, to make sure
"role" works instead of "actor", etc. (this just tests round-tripping,
need to add separate tests to check serialization)
* Bits of import cleanup along the way
Revision Changes Path
1.69 +0 -1 xml-axis/java/samples/echo/TestClient.java
Index: TestClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/echo/TestClient.java,v
retrieving revision 1.68
retrieving revision 1.69
diff -u -r1.68 -r1.69
--- TestClient.java 15 Sep 2002 19:16:16 -0000 1.68
+++ TestClient.java 15 Oct 2002 21:15:42 -0000 1.69
@@ -74,7 +74,6 @@
import java.lang.reflect.Array;
import java.math.BigDecimal;
-import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
1.29 +1 -0 xml-axis/java/src/org/apache/axis/message/EnvelopeBuilder.java
Index: EnvelopeBuilder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/EnvelopeBuilder.java,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -r1.28 -r1.29
--- EnvelopeBuilder.java 18 Sep 2002 16:10:28 -0000 1.28
+++ EnvelopeBuilder.java 15 Oct 2002 21:15:42 -0000 1.29
@@ -126,6 +126,7 @@
envelope.setPrefix(prefix);
envelope.setNamespaceURI(namespace);
envelope.setNSMappings(context.getCurrentNSMappings());
+ envelope.setSoapConstants(soapConstants);
context.pushNewElement(envelope);
}
1.67 +0 -3 xml-axis/java/src/org/apache/axis/message/RPCHandler.java
Index: RPCHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCHandler.java,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -r1.66 -r1.67
--- RPCHandler.java 9 Oct 2002 19:06:31 -0000 1.66
+++ RPCHandler.java 15 Oct 2002 21:15:42 -0000 1.67
@@ -178,9 +178,6 @@
Vector params = rpcElem.getParams();
- // SAR: for now, ignore RPC Result elements
- if (qname.equals(Constants.QNAME_RPC_RESULT)) return this;
-
// Create a new param if not the same element
if (currentParam == null ||
!currentParam.getQName().getNamespaceURI().equals(namespace) ||
1.81 +4 -0 xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java
Index: SOAPEnvelope.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPEnvelope.java,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -r1.80 -r1.81
--- SOAPEnvelope.java 18 Sep 2002 16:10:28 -0000 1.80
+++ SOAPEnvelope.java 15 Oct 2002 21:15:42 -0000 1.81
@@ -419,6 +419,10 @@
return soapConstants;
}
+ public void setSoapConstants(SOAPConstants soapConstants) {
+ this.soapConstants = soapConstants;
+ }
+
// JAXM methods
public javax.xml.soap.SOAPBody addBody() throws SOAPException {
1.61 +2 -1 xml-axis/java/src/org/apache/axis/message/SOAPHeader.java
Index: SOAPHeader.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeader.java,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -r1.60 -r1.61
--- SOAPHeader.java 18 Sep 2002 16:10:28 -0000 1.60
+++ SOAPHeader.java 15 Oct 2002 21:15:42 -0000 1.61
@@ -60,7 +60,6 @@
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.SerializationContext;
-import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.handlers.soap.SOAPService;
@@ -98,6 +97,7 @@
soapConstants = soapConsts;
try {
setParentElement(env);
+ setEnvelope(env);
} catch (SOAPException ex) {
// class cast should never fail when parent is a SOAPEnvelope
log.fatal(Messages.getMessage("exception00"), ex);
@@ -130,6 +130,7 @@
public javax.xml.soap.SOAPHeaderElement addHeaderElement(Name name)
throws SOAPException {
SOAPHeaderElement headerElement = new SOAPHeaderElement(name);
+ headerElement.setEnvelope(getEnvelope());
addHeader(headerElement);
return headerElement;
}
1.14 +24 -13 xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java
Index: SOAPHeaderElement.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/message/SOAPHeaderElement.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- SOAPHeaderElement.java 22 Sep 2002 17:26:29 -0000 1.13
+++ SOAPHeaderElement.java 15 Oct 2002 21:15:42 -0000 1.14
@@ -57,7 +57,7 @@
import org.apache.axis.Constants;
import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.encoding.DeserializationContext;
-import org.apache.axis.utils.JavaUtils;
+import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.utils.Messages;
import org.w3c.dom.Element;
import org.xml.sax.Attributes;
@@ -154,28 +154,17 @@
}
processed = false;
+ alreadySerialized = true;
}
public boolean getMustUnderstand() { return( mustUnderstand ); }
public void setMustUnderstand(boolean b) {
mustUnderstand = b ;
- String val = b ? "1" : "0";
-
- // Instead of doing this can we hang out until serialization time
- // and do it there, so that we can then resolve SOAP version?
- setAttribute(Constants.URI_SOAP11_ENV,
- Constants.ATTR_MUST_UNDERSTAND,
- val);
}
public String getActor() { return( actor ); }
public void setActor(String a) {
actor = a ;
-
- // FIXME
- // Instead of doing this can we hang out until serialization time
- // and do it there, so that we can then resolve SOAP version?
- setAttribute(Constants.URI_SOAP11_ENV, Constants.ATTR_ACTOR, a);
}
public void setProcessed(boolean value) {
@@ -184,5 +173,27 @@
public boolean isProcessed() {
return( processed );
+ }
+
+ boolean alreadySerialized = false;
+
+ /** Subclasses can override
+ */
+ protected void outputImpl(SerializationContext context) throws Exception {
+ if (!alreadySerialized) {
+ SOAPConstants soapVer = getEnvelope().getSOAPConstants();
+ QName roleQName = soapVer.getRoleAttributeQName();
+
+ setAttribute(roleQName.getNamespaceURI(),
+ roleQName.getLocalPart(), actor);
+
+ String val = mustUnderstand ? "1" : "0";
+
+ setAttribute(soapVer.getEnvelopeURI(),
+ Constants.ATTR_MUST_UNDERSTAND,
+ val);
+ }
+
+ super.outputImpl(context);
}
}
1.98 +1 -8
xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java
Index: RPCProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/RPCProvider.java,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -r1.97 -r1.98
--- RPCProvider.java 9 Oct 2002 19:06:32 -0000 1.97
+++ RPCProvider.java 15 Oct 2002 21:15:42 -0000 1.98
@@ -333,14 +333,7 @@
if (msgContext.getSOAPConstants() ==
SOAPConstants.SOAP12_CONSTANTS)
{
- RPCParam result = new RPCParam
- (Constants.QNAME_RPC_RESULT, returnQName.getLocalPart());
- if (!operation.isReturnHeader()) {
- resBody.addParam(result);
- } else {
- resEnv.addHeader(new RPCHeaderParam(result));
- }
-
+ returnQName = Constants.QNAME_RPC_RESULT;
}
RPCParam param = new RPCParam(returnQName, objRes);
1.84 +0 -1 xml-axis/java/src/org/apache/axis/server/AxisServer.java
Index: AxisServer.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/server/AxisServer.java,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -r1.83 -r1.84
--- AxisServer.java 18 Sep 2002 16:10:39 -0000 1.83
+++ AxisServer.java 15 Oct 2002 21:15:43 -0000 1.84
@@ -67,7 +67,6 @@
import org.apache.axis.client.AxisClient;
import org.apache.axis.configuration.EngineConfigurationFactoryFinder;
import org.apache.axis.utils.ClassUtils;
-import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.components.logger.LogFactory;
1.21 +3 -1
xml-axis/java/src/org/apache/axis/transport/local/LocalResponder.java
Index: LocalResponder.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalResponder.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- LocalResponder.java 12 Aug 2002 22:53:09 -0000 1.20
+++ LocalResponder.java 15 Oct 2002 21:15:43 -0000 1.21
@@ -79,9 +79,11 @@
log.debug("Enter: LocalResponder::invoke");
}
- msgContext.getResponseMessage().getSOAPPartAsString();
+ String msgStr = msgContext.getResponseMessage().getSOAPPartAsString();
if (log.isDebugEnabled()) {
+ log.debug(msgStr);
+
log.debug("Exit: LocalResponder::invoke");
}
}
1.42 +0 -1
xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java
Index: LocalSender.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/local/LocalSender.java,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -r1.41 -r1.42
--- LocalSender.java 18 Sep 2002 16:10:44 -0000 1.41
+++ LocalSender.java 15 Oct 2002 21:15:43 -0000 1.42
@@ -63,7 +63,6 @@
import org.apache.axis.message.SOAPEnvelope;
import org.apache.axis.message.SOAPFault;
import org.apache.axis.server.AxisServer;
-import org.apache.axis.utils.JavaUtils;
import org.apache.axis.utils.Messages;
import org.apache.axis.components.logger.LogFactory;
1.4 +1 -1 xml-axis/java/test/soap/PackageTests.java
Index: PackageTests.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/soap/PackageTests.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- PackageTests.java 25 Sep 2002 21:28:59 -0000 1.3
+++ PackageTests.java 15 Oct 2002 21:15:44 -0000 1.4
@@ -69,7 +69,7 @@
{
TestSuite suite = new TestSuite("All axis.soap tests");
- suite.addTest(TestHeaderAttrs.suite());
+ suite.addTestSuite(TestHeaderAttrs.class);
suite.addTestSuite(TestOnFaultHeaders.class);
return suite;
1.8 +11 -13 xml-axis/java/test/soap/TestHeaderAttrs.java
Index: TestHeaderAttrs.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/soap/TestHeaderAttrs.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- TestHeaderAttrs.java 25 Sep 2002 21:28:59 -0000 1.7
+++ TestHeaderAttrs.java 15 Oct 2002 21:15:44 -0000 1.8
@@ -60,9 +60,12 @@
import junit.framework.Test;
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
+import org.apache.axis.SimpleTargetedChain;
+import org.apache.axis.soap.SOAPConstants;
import org.apache.axis.configuration.SimpleProvider;
import org.apache.axis.providers.java.RPCProvider;
import org.apache.axis.transport.local.LocalTransport;
+import org.apache.axis.transport.local.LocalResponder;
import org.apache.axis.client.Call;
import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.message.SOAPHeaderElement;
@@ -103,10 +106,9 @@
static final String localURL = "local:///testService";
- public static Test suite() {
- return new TestSuite(TestHeaderAttrs.class);
- }
-
+ // Which SOAP version are we using? Default to SOAP 1.1
+ protected SOAPConstants soapVersion = SOAPConstants.SOAP11_CONSTANTS;
+
public TestHeaderAttrs(String name) {
super(name);
}
@@ -127,6 +129,10 @@
service.setOption("allowedMethods", "*");
provider.deployService("testService", service);
+
+ SimpleTargetedChain serverTransport =
+ new SimpleTargetedChain(null, null, new LocalResponder());
+ provider.deployTransport("local", serverTransport);
}
/**
@@ -215,6 +221,7 @@
boolean doubled) throws Exception
{
Call call = new Call(new Service());
+ call.setSOAPVersion(soapVersion);
call.setTransport(localTransport);
call.addHeader(header);
@@ -231,14 +238,5 @@
if (doubled) desiredResult = desiredResult * 2;
return (i.intValue() == desiredResult);
- }
-
- public static void main(String[] args) throws Exception {
- TestHeaderAttrs tester = new TestHeaderAttrs("test");
- tester.setUp();
- tester.testMUBadHeader();
- tester.testNonMUBadHeader();
- tester.testGoodHeader();
- tester.testGoodHeaderWithActors();
}
}