gdaniels 02/02/20 10:59:22
Modified: java build.xml
java/samples/echo TestClient.java
java/samples/proxy ProxyService.java
java/samples/security ClientSigningHandler.java
LogHandler.java
java/samples/userguide/example4 LogHandler.java
java/src/org/apache/axis AxisEngine.java
EngineConfiguration.java MessageContext.java
java/src/org/apache/axis/client Call.java
java/src/org/apache/axis/configuration FileProvider.java
NullProvider.java SimpleProvider.java
java/src/org/apache/axis/deployment/wsdd WSDDDeployment.java
WSDDService.java
java/src/org/apache/axis/encoding
DeserializationContextImpl.java
java/src/org/apache/axis/handlers JWSHandler.java
JWSProcessor.java SimpleAuthorizationHandler.java
java/src/org/apache/axis/handlers/http
HTTPActionHandler.java URLMapper.java
java/src/org/apache/axis/handlers/soap SOAPService.java
java/src/org/apache/axis/message BodyBuilder.java
RPCElement.java RPCHandler.java
java/src/org/apache/axis/providers/java EJBProvider.java
JavaProvider.java MsgProvider.java RPCProvider.java
java/src/org/apache/axis/server AxisServer.java
java/src/org/apache/axis/transport/http HTTPTransport.java
java/src/org/apache/axis/utils Admin.java
java/src/org/apache/axis/utils/cache ClassCache.java
java/src/org/apache/axis/wsdl/fromJava Emitter.java
java/test/RPCDispatch Service.java TestRPC.java
TestSerializedRPC.java
java/test/encoding TestBody.java
java/test/session TestSimpleSession.java
Log:
Several changes:
1. Fix bug in RPCProvider where we were dispatching to no-arg methods
regardless of what we received in the XML.
2. Remove the code to search for methods which have a MessageContext
as the first arg, and upgrade all usages of this functionality to
use MessageContext.getCurrentContext()
3. Add a switch in the WSDD so you can say:
<service name="foo" provider="java:RPC" style="document">
and the "document-ness" will be remembered through the system,
including in particular the WSDL emitter. This will be used a lot
more later as our doc/lit support improves.
4. Change MessageContext.getServiceHandler() to getService(), and
it now returns a SOAPService explicitly. Also setServiceHandler()
is now setService(SOAPService). This rippled through AxisServer
and EngineConfiguration as well.
5. Remove the code which attempted to map an element QName as a type
QName - if we need to do type mapping via elements, there should be
a better way.
6. Handle overloaded methods - this was accomplished for now by
moving the "determineDefaultParams" logic that used to be in
RPCHandler into RPCElement.deserialize(). That method now attempts
to deserialize the RPCElement once for each potential method
match, and it continues in the face of deserialization errors.
This is the biggest change, and it needs some more looking at, IMO.
The logic that is currently spread out between here, RPCHandler, and
RPCProvider to deal with method dispatch and argument conversion
could be cleaned up and made a lot more efficient, I think.
7. Add an overloaded method test to test.RPCDispatch.TestSerializedRPC
*whew*, I think that's it. This all started with just wanting to do
the document switch!!
Revision Changes Path
1.112 +1 -0 xml-axis/java/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/build.xml,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -r1.111 -r1.112
--- build.xml 20 Feb 2002 13:46:08 -0000 1.111
+++ build.xml 20 Feb 2002 18:59:20 -0000 1.112
@@ -74,6 +74,7 @@
<property name="docs.dir" value="./docs"/>
<property name="samples.dir" value="./samples"/>
<property name="test.dir" value="./test"/>
+ <property name="lib.dir" value="./lib"/>
<property name="wsdl4j.jar" value="lib/wsdl4j.jar"/>
<property name="commons-logging.jar" value="lib/commons-logging.jar"/>
1.54 +20 -7 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.53
retrieving revision 1.54
diff -u -r1.53 -r1.54
--- TestClient.java 19 Feb 2002 22:46:40 -0000 1.53
+++ TestClient.java 20 Feb 2002 18:59:20 -0000 1.54
@@ -79,6 +79,8 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.io.StringWriter;
+import java.io.PrintWriter;
import javax.xml.rpc.holders.StringHolder;
import javax.xml.rpc.holders.IntHolder;
@@ -456,22 +458,33 @@
} else {
client = new TestClient() {
public void verify(String method, Object sent, Object gotBack) {
+ String message;
if (this.equals(sent, gotBack)) {
- System.out.println(method + "\t OK");
+ message = "OK";
} else {
- String message = "Fail: ";
if (gotBack instanceof Exception) {
if (gotBack instanceof AxisFault) {
- message = "Fault: ";
- gotBack = ((AxisFault)gotBack).getFaultString();
+ message = "Fault: " +
+ ((AxisFault)gotBack).getFaultString();
} else {
+ StringWriter sw = new StringWriter();
+ PrintWriter pw = new PrintWriter(sw);
message = "Exception: ";
- ((Exception)gotBack).printStackTrace();
+ ((Exception)gotBack).printStackTrace(pw);
+ message += sw.getBuffer().toString();
}
+ } else {
+ message = "Fail:" + gotBack + " expected " + sent;
}
- System.out.println(method + "\t " + message +
- gotBack + " expected " + sent);
}
+ // Line up the output
+ String tab = "";
+ int l = method.length();
+ while (l < 25) {
+ tab += " ";
+ l++;
+ }
+ System.out.println(method + tab + " " + message);
}
};
}
1.13 +1 -1 xml-axis/java/samples/proxy/ProxyService.java
Index: ProxyService.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/proxy/ProxyService.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- ProxyService.java 28 Jan 2002 18:22:59 -0000 1.12
+++ ProxyService.java 20 Feb 2002 18:59:20 -0000 1.13
@@ -83,7 +83,7 @@
{
try {
// Look in the message context for our service
- Handler self = msgContext.getServiceHandler();
+ Handler self = msgContext.getService();
// what is our target URL?
String dest = (String)self.getOption("URL");
1.5 +1 -1 xml-axis/java/samples/security/ClientSigningHandler.java
Index: ClientSigningHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/security/ClientSigningHandler.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- ClientSigningHandler.java 19 Feb 2002 17:38:18 -0000 1.4
+++ ClientSigningHandler.java 20 Feb 2002 18:59:20 -0000 1.5
@@ -72,7 +72,7 @@
/** Sign the SOAPEnvelope
*/
try {
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
String filename = (String) getOption("keystore");
if ((filename == null) || (filename.equals("")))
throw new AxisFault("Server.NoKeyStoreFile",
1.6 +1 -1 xml-axis/java/samples/security/LogHandler.java
Index: LogHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/security/LogHandler.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- LogHandler.java 19 Feb 2002 17:38:18 -0000 1.5
+++ LogHandler.java 20 Feb 2002 18:59:20 -0000 1.6
@@ -117,7 +117,7 @@
public void undo(MessageContext msgContext) {
try {
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
String filename = (String) getOption("filename");
if ((filename == null) || (filename.equals("")))
throw new AxisFault("Server.NoLogFile",
1.10 +1 -1 xml-axis/java/samples/userguide/example4/LogHandler.java
Index: LogHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/userguide/example4/LogHandler.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- LogHandler.java 10 Jan 2002 20:00:59 -0000 1.9
+++ LogHandler.java 20 Feb 2002 18:59:20 -0000 1.10
@@ -70,7 +70,7 @@
/** Log an access each time we get invoked.
*/
try {
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
String filename = (String)getOption("filename");
if ((filename == null) || (filename.equals("")))
throw new AxisFault("Server.NoLogFile",
1.70 +1 -1 xml-axis/java/src/org/apache/axis/AxisEngine.java
Index: AxisEngine.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/AxisEngine.java,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- AxisEngine.java 19 Feb 2002 17:38:18 -0000 1.69
+++ AxisEngine.java 20 Feb 2002 18:59:20 -0000 1.70
@@ -256,7 +256,7 @@
}
}
- public Handler getService(String name) throws AxisFault
+ public SOAPService getService(String name) throws AxisFault
{
try {
return config.getService(new QName(null, name));
1.5 +4 -2 xml-axis/java/src/org/apache/axis/EngineConfiguration.java
Index: EngineConfiguration.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/EngineConfiguration.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- EngineConfiguration.java 12 Feb 2002 17:18:28 -0000 1.4
+++ EngineConfiguration.java 20 Feb 2002 18:59:20 -0000 1.5
@@ -58,6 +58,8 @@
import javax.xml.rpc.namespace.QName;
import org.apache.axis.encoding.TypeMappingRegistry;
import org.apache.axis.encoding.TypeMapping;
+import org.apache.axis.handlers.soap.SOAPService;
+
import java.util.Hashtable;
/**
@@ -111,7 +113,7 @@
* @return XXX
* @throws ConfigurationException XXX
*/
- public Handler getService(QName qname) throws ConfigurationException;
+ public SOAPService getService(QName qname) throws ConfigurationException;
/**
* Get a service which has been mapped to a particular namespace
@@ -119,7 +121,7 @@
* @param namespace a namespace URI
* @return an instance of the appropriate Service, or null
*/
- public Handler getServiceByNamespaceURI(String namespace)
+ public SOAPService getServiceByNamespaceURI(String namespace)
throws ConfigurationException;
/**
1.76 +6 -5 xml-axis/java/src/org/apache/axis/MessageContext.java
Index: MessageContext.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/MessageContext.java,v
retrieving revision 1.75
retrieving revision 1.76
diff -u -r1.75 -r1.76
--- MessageContext.java 19 Feb 2002 17:38:18 -0000 1.75
+++ MessageContext.java 20 Feb 2002 18:59:20 -0000 1.76
@@ -423,10 +423,10 @@
targetService = tServ ;
if (targetService == null)
- setServiceHandler(null);
+ setService(null);
else {
try {
- setServiceHandler(getAxisEngine().getService(tServ));
+ setService(getAxisEngine().getService(tServ));
} catch (AxisFault fault) {
// If we're on the client, don't throw this fault...
if (!isClient()) {
@@ -440,12 +440,13 @@
* can (and probably will actually be a chain that contains the
* service specific request/response/pivot point handlers
*/
- private Handler serviceHandler ;
- public Handler getServiceHandler() {
+ private SOAPService serviceHandler ;
+
+ public SOAPService getService() {
return( serviceHandler );
}
- public void setServiceHandler(Handler sh)
+ public void setService(SOAPService sh)
{
log.debug("MessageContext: setServiceHandler("+sh+")");
serviceHandler = sh;
1.75 +1 -1 xml-axis/java/src/org/apache/axis/client/Call.java
Index: Call.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/Call.java,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- Call.java 19 Feb 2002 17:38:19 -0000 1.74
+++ Call.java 20 Feb 2002 18:59:20 -0000 1.75
@@ -1595,7 +1595,7 @@
throw new AxisFault("Call.invoke",
JavaUtils.getMessage("cantInvoke00", body.getName()),
null, null);
- } else if (msgContext.getServiceHandler() == null) {
+ } else if (msgContext.getService() == null) {
msgContext.setTargetService(body.getNamespaceURI());
}
1.21 +3 -2
xml-axis/java/src/org/apache/axis/configuration/FileProvider.java
Index: FileProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/FileProvider.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -r1.20 -r1.21
--- FileProvider.java 19 Feb 2002 17:38:19 -0000 1.20
+++ FileProvider.java 20 Feb 2002 18:59:20 -0000 1.21
@@ -59,6 +59,7 @@
import org.apache.axis.ConfigurationException;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.Handler;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.deployment.wsdd.WSDDDeployment;
import org.apache.axis.deployment.wsdd.WSDDDocument;
import org.apache.axis.deployment.wsdd.WSDDGlobalConfiguration;
@@ -229,7 +230,7 @@
* @return XXX
* @throws ConfigurationException XXX
*/
- public Handler getService(QName qname) throws ConfigurationException {
+ public SOAPService getService(QName qname) throws ConfigurationException {
return deployment.getService(qname);
}
@@ -239,7 +240,7 @@
* @param namespace a namespace URI
* @return an instance of the appropriate Service, or null
*/
- public Handler getServiceByNamespaceURI(String namespace)
+ public SOAPService getServiceByNamespaceURI(String namespace)
throws ConfigurationException {
return deployment.getServiceByNamespaceURI(namespace);
}
1.4 +3 -2
xml-axis/java/src/org/apache/axis/configuration/NullProvider.java
Index: NullProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/NullProvider.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- NullProvider.java 12 Feb 2002 17:18:28 -0000 1.3
+++ NullProvider.java 20 Feb 2002 18:59:20 -0000 1.4
@@ -59,6 +59,7 @@
import org.apache.axis.ConfigurationException;
import org.apache.axis.EngineConfiguration;
import org.apache.axis.Handler;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.encoding.TypeMappingRegistry;
@@ -104,11 +105,11 @@
return null;
}
- public Handler getService(QName qname) throws ConfigurationException {
+ public SOAPService getService(QName qname) throws ConfigurationException {
return null;
}
- public Handler getServiceByNamespaceURI(String namespace)
+ public SOAPService getServiceByNamespaceURI(String namespace)
throws ConfigurationException {
return null;
}
1.4 +4 -4
xml-axis/java/src/org/apache/axis/configuration/SimpleProvider.java
Index: SimpleProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/configuration/SimpleProvider.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- SimpleProvider.java 12 Feb 2002 17:18:28 -0000 1.3
+++ SimpleProvider.java 20 Feb 2002 18:59:20 -0000 1.4
@@ -201,8 +201,8 @@
return transport;
}
- public Handler getService(QName qname) throws ConfigurationException {
- Handler service = (Handler)services.get(qname);
+ public SOAPService getService(QName qname) throws ConfigurationException {
+ SOAPService service = (SOAPService)services.get(qname);
if ((defaultConfiguration != null) && (service == null))
service = defaultConfiguration.getService(qname);
return service;
@@ -214,9 +214,9 @@
* @param namespace a namespace URI
* @return an instance of the appropriate Service, or null
*/
- public Handler getServiceByNamespaceURI(String namespace)
+ public SOAPService getServiceByNamespaceURI(String namespace)
throws ConfigurationException {
- Handler service = (Handler)services.get(new QName("",namespace));
+ SOAPService service = (SOAPService)services.get(new QName("",namespace));
if ((service == null) && (defaultConfiguration != null))
service = defaultConfiguration.getServiceByNamespaceURI(namespace);
return service;
1.25 +5 -4
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java
Index: WSDDDeployment.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDDeployment.java,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -r1.24 -r1.25
--- WSDDDeployment.java 12 Feb 2002 17:18:28 -0000 1.24
+++ WSDDDeployment.java 20 Feb 2002 18:59:20 -0000 1.25
@@ -58,6 +58,7 @@
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.apache.axis.*;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.deployment.DeploymentRegistry;
import org.apache.axis.deployment.DeploymentException;
import org.apache.axis.encoding.ser.BaseSerializerFactory;
@@ -448,22 +449,22 @@
* @param name XXX
* @return XXX
*/
- public Handler getService(QName name) throws ConfigurationException
+ public SOAPService getService(QName name) throws ConfigurationException
{
WSDDService s = (WSDDService)services.get(name);
if (s != null) {
- return s.getInstance(this);
+ return (SOAPService)s.getInstance(this);
}
return null;
}
- public Handler getServiceByNamespaceURI(String namespace)
+ public SOAPService getServiceByNamespaceURI(String namespace)
throws ConfigurationException
{
WSDDService s = (WSDDService)namespaceToServices.get(namespace);
if (s != null) {
- return s.getInstance(this);
+ return (SOAPService)s.getInstance(this);
}
return null;
1.40 +25 -0
xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java
Index: WSDDService.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/deployment/wsdd/WSDDService.java,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -r1.39 -r1.40
--- WSDDService.java 12 Feb 2002 17:18:28 -0000 1.39
+++ WSDDService.java 20 Feb 2002 18:59:20 -0000 1.40
@@ -90,6 +90,9 @@
private Vector namespaces = new Vector();
private String descriptionURL;
+
+ /** Style - document or RPC (the default) */
+ private int style = SOAPService.STYLE_RPC;
private SOAPService cachedService = null;
@@ -140,6 +143,10 @@
String typeStr = e.getAttribute("provider");
if (typeStr != null && !typeStr.equals(""))
providerQName = XMLUtils.getQNameFromString(typeStr, e);
+
+ String modeStr = e.getAttribute("style");
+ if (modeStr != null && modeStr.equals("document"))
+ style = SOAPService.STYLE_DOCUMENT;
}
/**
@@ -186,6 +193,20 @@
}
/**
+ * Get the service style - document or RPC
+ */
+ public int getStyle() {
+ return style;
+ }
+
+ /**
+ * Set the service style - document or RPC
+ */
+ public void setStyle(int style) {
+ this.style = style;
+ }
+
+ /**
*
* @return XXX
*/
@@ -268,6 +289,7 @@
SOAPService service = new SOAPService(reqHandler, providerHandler,
respHandler);
+ service.setStyle(style);
if ( getQName() != null )
service.setName(getQName().getLocalPart());
@@ -366,6 +388,9 @@
if (providerQName != null) {
attrs.addAttribute("", "provider", "provider",
"CDATA", context.qName2String(providerQName));
+ }
+ if (style == SOAPService.STYLE_DOCUMENT) {
+ attrs.addAttribute("", "style", "style", "CDATA", "document");
}
context.startElement(WSDDConstants.SERVICE_QNAME, attrs);
1.7 +6 -1
xml-axis/java/src/org/apache/axis/encoding/DeserializationContextImpl.java
Index: DeserializationContextImpl.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/encoding/DeserializationContextImpl.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- DeserializationContextImpl.java 19 Feb 2002 17:38:19 -0000 1.6
+++ DeserializationContextImpl.java 20 Feb 2002 18:59:21 -0000 1.7
@@ -357,11 +357,16 @@
return getQNameFromString(type);
}
+ /* Removing this code for now - Glen 2/20/02
+
// If all else fails see if the name is a known type
typeQName = new QName(namespace, localName);
if (getTypeMapping().getClassForQName(typeQName) != null)
return typeQName;
- return null;
+
+ */
+
+ return null;
}
/**
1.14 +3 -2 xml-axis/java/src/org/apache/axis/handlers/JWSHandler.java
Index: JWSHandler.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/JWSHandler.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- JWSHandler.java 19 Feb 2002 17:38:20 -0000 1.13
+++ JWSHandler.java 20 Feb 2002 18:59:21 -0000 1.14
@@ -57,6 +57,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Constants;
import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.utils.JavaUtils;
import org.apache.commons.logging.Log;
@@ -77,7 +78,7 @@
// Keep the processor Handler around so we can make it the service
// Handler for this request if appropriate.
- static JWSProcessor processor = new JWSProcessor();
+ static SOAPService processor = new SOAPService(new JWSProcessor());
public void invoke(MessageContext msgContext) throws AxisFault
{
@@ -90,7 +91,7 @@
String realpath = msgContext.getStrProp(Constants.MC_REALPATH);
if ((realpath!=null) && (realpath.endsWith(".jws"))) {
- msgContext.setServiceHandler(processor);
+ msgContext.setService(processor);
}
if (log.isDebugEnabled()) {
1.38 +3 -2 xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java
Index: JWSProcessor.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/JWSProcessor.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- JWSProcessor.java 19 Feb 2002 17:38:20 -0000 1.37
+++ JWSProcessor.java 20 Feb 2002 18:59:21 -0000 1.38
@@ -58,6 +58,7 @@
import org.apache.axis.Constants;
import org.apache.axis.Handler;
import org.apache.axis.MessageContext;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.providers.java.RPCProvider;
import org.apache.axis.transport.http.HTTPConstants;
import org.apache.axis.utils.JWSClassLoader;
@@ -263,8 +264,8 @@
/* Create a new RPCProvider - this will be the "service" */
/* that we invoke. */
/******************************************************************/
- Handler rpc = new RPCProvider();
- msgContext.setServiceHandler( rpc );
+ SOAPService rpc = new SOAPService(new RPCProvider());
+ msgContext.setService( rpc );
rpc.setOption( "className", clsName );
1.26 +1 -1
xml-axis/java/src/org/apache/axis/handlers/SimpleAuthorizationHandler.java
Index: SimpleAuthorizationHandler.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/handlers/SimpleAuthorizationHandler.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- SimpleAuthorizationHandler.java 19 Feb 2002 17:38:20 -0000 1.25
+++ SimpleAuthorizationHandler.java 20 Feb 2002 18:59:21 -0000 1.26
@@ -106,7 +106,7 @@
JavaUtils.getMessage("needUser00"), null, null);
String userID = user.getName();
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
if (serviceHandler == null)
throw new AxisFault(JavaUtils.getMessage("needService00"));
1.16 +1 -1
xml-axis/java/src/org/apache/axis/handlers/http/HTTPActionHandler.java
Index: HTTPActionHandler.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/handlers/http/HTTPActionHandler.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- HTTPActionHandler.java 19 Feb 2002 17:38:20 -0000 1.15
+++ HTTPActionHandler.java 20 Feb 2002 18:59:21 -0000 1.16
@@ -84,7 +84,7 @@
/** If there's already a targetService then just return.
*/
- if ( msgContext.getServiceHandler() == null ) {
+ if ( msgContext.getService() == null ) {
String action = (String) msgContext.getSOAPActionURI();
log.debug( " HTTP SOAPAction: " + action );
1.15 +1 -1 xml-axis/java/src/org/apache/axis/handlers/http/URLMapper.java
Index: URLMapper.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/handlers/http/URLMapper.java,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- URLMapper.java 19 Feb 2002 17:38:20 -0000 1.14
+++ URLMapper.java 20 Feb 2002 18:59:21 -0000 1.15
@@ -80,7 +80,7 @@
/** If there's already a targetService then just return.
*/
- if ( msgContext.getServiceHandler() == null ) {
+ if ( msgContext.getService() == null ) {
// Assumes "/" + servicename
String path =
(String)msgContext.getProperty(HTTPConstants.MC_HTTP_SERVLETPATHINFO);
if ((path != null) && (path.length() > 1)) {
1.46 +16 -0 xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java
Index: SOAPService.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/handlers/soap/SOAPService.java,v
retrieving revision 1.45
retrieving revision 1.46
diff -u -r1.45 -r1.46
--- SOAPService.java 19 Feb 2002 17:38:21 -0000 1.45
+++ SOAPService.java 20 Feb 2002 18:59:21 -0000 1.46
@@ -96,6 +96,9 @@
static Log log =
LogFactory.getLog(SOAPService.class.getName());
+ public static final int STYLE_RPC = 0;
+ public static final int STYLE_DOCUMENT = 1;
+
/** Valid transports for this service
* (server side only!)
*
@@ -109,6 +112,11 @@
private TypeMappingRegistry tmr;
/**
+ * Style of the service - document or RPC
+ */
+ private int style = STYLE_RPC;
+
+ /**
* SOAPRequestHandler is used to inject SOAP semantics just before
* the pivot handler.
*/
@@ -249,6 +257,14 @@
}
return true;
+ }
+
+ public int getStyle() {
+ return style;
+ }
+
+ public void setStyle(int style) {
+ this.style = style;
}
/*********************************************************************
1.17 +5 -4 xml-axis/java/src/org/apache/axis/message/BodyBuilder.java
Index: BodyBuilder.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/BodyBuilder.java,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -r1.16 -r1.17
--- BodyBuilder.java 19 Feb 2002 17:38:21 -0000 1.16
+++ BodyBuilder.java 20 Feb 2002 18:59:21 -0000 1.17
@@ -65,6 +65,7 @@
import org.apache.axis.AxisFault;
import org.apache.axis.Handler;
import org.apache.axis.ConfigurationException;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.utils.JavaUtils;
import org.apache.commons.logging.Log;
@@ -116,19 +117,19 @@
MessageContext msgContext = context.getMessageContext();
if (isRoot &&
- msgContext.getServiceHandler() == null) {
+ msgContext.getService() == null) {
if (log.isDebugEnabled()) {
log.debug(JavaUtils.getMessage("dispatching00",namespace));
}
try {
- Handler serviceHandler = msgContext.
+ SOAPService service = msgContext.
getAxisEngine().
getConfig().
getServiceByNamespaceURI(namespace);
- if (serviceHandler != null)
- msgContext.setServiceHandler(serviceHandler);
+ if (service != null)
+ msgContext.setService(service);
} catch (ConfigurationException e) {
// oh well...
}
1.32 +60 -4 xml-axis/java/src/org/apache/axis/message/RPCElement.java
Index: RPCElement.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/RPCElement.java,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- RPCElement.java 26 Jan 2002 02:48:38 -0000 1.31
+++ RPCElement.java 20 Feb 2002 18:59:21 -0000 1.32
@@ -58,12 +58,18 @@
import org.apache.axis.encoding.DeserializationContext;
import org.apache.axis.encoding.SerializationContext;
import org.apache.axis.Constants;
+import org.apache.axis.MessageContext;
+import org.apache.axis.Handler;
+import org.apache.axis.utils.cache.ClassCache;
+import org.apache.axis.utils.cache.JavaClass;
+import org.apache.axis.utils.JavaUtils;
import org.xml.sax.Attributes;
import org.xml.sax.helpers.AttributesImpl;
import org.xml.sax.SAXException;
import javax.xml.rpc.namespace.QName;
import java.util.Vector;
+import java.lang.reflect.Method;
public class RPCElement extends SOAPBodyElement
{
@@ -108,14 +114,64 @@
return name;
}
+ protected Class defaultParamTypes[] = null;
+
+ public Class [] getJavaParamTypes()
+ {
+ return defaultParamTypes;
+ }
+
public void deserialize() throws SAXException
{
- context.pushElementHandler(new EnvelopeHandler(new RPCHandler(this)));
- context.setCurElement(this);
-
needDeser = false;
+
+ MessageContext msgContext = context.getMessageContext();
+ Handler service = msgContext.getService();
+ String clsName = null;
+
+ if (service != null) {
+ clsName = (String)service.getOption("className");
+ }
+
+ if (clsName != null) {
+ ClassLoader cl = msgContext.getClassLoader();
+ ClassCache cache = msgContext.getAxisEngine().getClassCache();
+ JavaClass jc = null;
+ try {
+ jc = cache.lookup(clsName, cl);
+ } catch (ClassNotFoundException e) {
+ throw new SAXException(e);
+ }
+
+ if (log.isDebugEnabled()) {
+ log.debug(JavaUtils.getMessage(
+ "lookup00", name, clsName));
+ }
+
+ Method[] method = jc.getMethod(name);
+ int numChildren = (getChildren() == null) ? 0 : getChildren().size();
+ if (method != null) {
+ for (int i = 0; i < method.length; i++) {
+ defaultParamTypes = method[i].getParameterTypes();
+ if (defaultParamTypes.length >= numChildren) {
+ try {
+ context.pushElementHandler(new EnvelopeHandler(new
RPCHandler(this)));
+ context.setCurElement(this);
+
+ publishToHandler((org.xml.sax.ContentHandler) context);
+ } catch (SAXException e) {
+ // If there was a problem, try the next one.
+ params = new Vector();
+ continue;
+ }
+ // Succeeded in deserializing!
+ return;
+ }
+ }
+ }
+ }
- publishToHandler((org.xml.sax.ContentHandler) context);
+ publishToHandler((org.xml.sax.ContentHandler)context);
}
/** This gets the FIRST param whose name matches.
1.27 +3 -48 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.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- RPCHandler.java 19 Feb 2002 17:38:21 -0000 1.26
+++ RPCHandler.java 20 Feb 2002 18:59:21 -0000 1.27
@@ -90,53 +90,12 @@
private RPCElement call;
private RPCParam currentParam;
- protected Class defaultParamTypes[] = null;
-
public RPCHandler(RPCElement call)
throws SAXException
{
this.call = call;
}
- private void determineDefaultParams(String methodName,
- DeserializationContext context) {
- MessageContext msgContext = context.getMessageContext();
- Handler service = msgContext.getServiceHandler();
- if (service == null) return;
-
- String clsName = (String) service.getOption( "className" );
-
- try {
- ClassLoader cl = msgContext.getClassLoader();
- ClassCache cache = msgContext.getAxisEngine().getClassCache();
- JavaClass jc = cache.lookup(clsName, cl);
- Class cls = jc.getJavaClass();
-
- if (log.isDebugEnabled()) {
- log.debug(JavaUtils.getMessage(
- "lookup00", methodName, clsName));
- }
-
- // If we find only one method of this name, we can use it
- // to make better decisions about what deserializers to use
- // for parameters.
- Method[] method = jc.getMethod(methodName);
- if (method != null && method.length == 1) {
- defaultParamTypes = method[0].getParameterTypes();
- }
-
- // !!! This should be smart enough to deal with overloaded
- // methods - we should really be keeping a list of all of
- // the possibilities, then moving down the list to keep
- // matching as we deserialize params....
- //
-
- // in the future, we should add support for runtime information
- // from sources like WSDL, based on Handler.getDeploymentData();
- } catch (Exception e) {
- // oh well, we tried.
- }
- }
public SOAPHandler onStartChild(String namespace,
String localName,
@@ -155,8 +114,6 @@
}
Vector params = call.getParams();
- if (params.isEmpty())
- determineDefaultParams(call.getMethodName(), context);
// This is a param.
currentParam = new RPCParam(namespace, localName, null);
@@ -209,14 +166,12 @@
}
}
- if (type == null && defaultParamTypes!=null &&
- params.size()<=defaultParamTypes.length) {
+ if (type == null && call.getJavaParamTypes() !=null &&
+ params.size() <= call.getJavaParamTypes().length) {
TypeMapping typeMap = context.getTypeMapping();
int index = params.size()-1;
- if (index+1<defaultParamTypes.length)
- if (defaultParamTypes[0]==MessageContext.class) index++;
- type = typeMap.getTypeQName(defaultParamTypes[index]);
+ type = typeMap.getTypeQName(call.getJavaParamTypes()[index]);
if (log.isDebugEnabled()) {
log.debug(JavaUtils.getMessage("typeFromParms00", "" + type));
}
1.14 +3 -3
xml-axis/java/src/org/apache/axis/providers/java/EJBProvider.java
Index: EJBProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/EJBProvider.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- EJBProvider.java 12 Feb 2002 17:28:33 -0000 1.13
+++ EJBProvider.java 20 Feb 2002 18:59:21 -0000 1.14
@@ -102,7 +102,7 @@
String clsName)
throws Exception
{
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
// Get the EJB Home object from JNDI
Object ejbHome = getEJBHome(msgContext, clsName);
@@ -171,7 +171,7 @@
* @return the class info of the EJB remote interface
*/
protected Class getServiceClass(MessageContext msgContext, String beanJndiName)
throws Exception {
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
// Get the EJB Home object from JNDI
Object ejbHome = getEJBHome(msgContext, beanJndiName);
@@ -218,7 +218,7 @@
* Common routine to do the JNDI lookup on the Home interface object
*/
private Object getEJBHome(MessageContext msgContext, String beanJndiName)
throws AxisFault {
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
Object ejbHome;
Properties properties = null;
1.39 +7 -5
xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java
Index: JavaProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/JavaProvider.java,v
retrieving revision 1.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- JavaProvider.java 19 Feb 2002 17:38:21 -0000 1.38
+++ JavaProvider.java 20 Feb 2002 18:59:21 -0000 1.39
@@ -69,6 +69,7 @@
import org.apache.axis.wsdl.fromJava.Emitter;
import org.apache.axis.encoding.TypeMapping;
import org.apache.axis.Constants;
+import org.apache.axis.handlers.soap.SOAPService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
@@ -108,7 +109,7 @@
String clsName)
throws Exception
{
- String serviceName = msgContext.getServiceHandler().getName();
+ String serviceName = msgContext.getService().getName();
// scope can be "Request", "Session", "Application"
// (as with Apache SOAP)
@@ -127,7 +128,7 @@
// What do we do if serviceName is null at this point???
if (serviceName == null)
- serviceName = msgContext.getServiceHandler().toString();
+ serviceName = msgContext.getService().toString();
// look in incoming session
if (msgContext.getSession() != null) {
@@ -201,7 +202,7 @@
/* Find the service we're invoking so we can grab it's options */
/***************************************************************/
String serviceName = msgContext.getTargetService();
- Handler service = msgContext.getServiceHandler();
+ Handler service = msgContext.getService();
/* Now get the service (RPC) specific info */
/********************************************/
@@ -276,7 +277,7 @@
/* Find the service we're invoking so we can grab it's options */
/***************************************************************/
String serviceName = msgContext.getTargetService();
- Handler service = msgContext.getServiceHandler();
+ SOAPService service = msgContext.getService();
/* Now get the service (RPC) specific info */
/********************************************/
@@ -311,6 +312,7 @@
}
Emitter emitter = new Emitter();
+ emitter.setMode(service.getStyle());
emitter.setClsSmart(cls,url);
emitter.setAllowedMethods(allowedMethods);
emitter.setIntfNamespace(url);
@@ -382,7 +384,7 @@
* Returns the Class info about the service class.
*/
protected Class getServiceClass(MessageContext msgContext, String clsName)
throws Exception {
- Handler service = msgContext.getServiceHandler();
+ Handler service = msgContext.getService();
Object obj = getServiceObject(msgContext,
service,
clsName);
1.23 +1 -1
xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java
Index: MsgProvider.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/providers/java/MsgProvider.java,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -r1.22 -r1.23
--- MsgProvider.java 30 Jan 2002 20:36:08 -0000 1.22
+++ MsgProvider.java 20 Feb 2002 18:59:21 -0000 1.23
@@ -88,7 +88,7 @@
Object obj)
throws Exception
{
- Handler targetService = msgContext.getServiceHandler();
+ Handler targetService = msgContext.getService();
// is this service a body-only service?
// if true (the default), the servic3e expects two args,
1.39 +9 -7
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.38
retrieving revision 1.39
diff -u -r1.38 -r1.39
--- RPCProvider.java 19 Feb 2002 17:38:21 -0000 1.38
+++ RPCProvider.java 20 Feb 2002 18:59:21 -0000 1.39
@@ -198,19 +198,21 @@
for (m = 0; m < method.length; ++m) {
ex = null;
params = method[m].getParameterTypes();
-
-
+
+ // Don't bother with this one if it has FEWER params
+ if (argValues != null) {
+ if (params.length < argValues.length)
+ continue;
+ }
+
// The number of method parameters must match the
- // arguments taking into consideration a MessageContext argument
- // and output parameters.
+ // arguments taking into consideration output parameters.
Object[] newArgValues = new Object[params.length];
int old = 0;
boolean problem = false;
for (int n = 0; n < newArgValues.length; n++) {
Class heldType = JavaUtils.getHolderValueType(params[n]);
- if (params[n] == MessageContext.class) {
- newArgValues[n] = msgContext;
- } else if (argValues != null && old < argValues.length) {
+ if (argValues != null && old < argValues.length) {
newArgValues[n] = argValues[old++];
} else if (heldType == null) {
// The parameters that don't match the argValues must
1.59 +4 -4 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.58
retrieving revision 1.59
diff -u -r1.58 -r1.59
--- AxisServer.java 19 Feb 2002 17:38:21 -0000 1.58
+++ AxisServer.java 20 Feb 2002 18:59:22 -0000 1.59
@@ -268,7 +268,7 @@
* transport or global Handlers). If it hasn't been set, we
* fault.
*/
- h = msgContext.getServiceHandler();
+ h = msgContext.getService();
if (h == null) {
// It's possible that we haven't yet parsed the
// message at this point. This is a kludge to
@@ -277,7 +277,7 @@
// chain instead....
Message rm = msgContext.getRequestMessage();
rm.getSOAPEnvelope().getFirstBody();
- h = msgContext.getServiceHandler();
+ h = msgContext.getService();
if (h == null)
throw new AxisFault("Server.NoService",
JavaUtils.getMessage("noService05",
@@ -416,7 +416,7 @@
* transport or global Handlers). If it hasn't been set, we
* fault.
*/
- h = msgContext.getServiceHandler();
+ h = msgContext.getService();
if (h == null) {
// It's possible that we haven't yet parsed the
// message at this point. This is a kludge to
@@ -426,7 +426,7 @@
Message rm = msgContext.getRequestMessage();
if (rm != null) {
rm.getSOAPEnvelope().getFirstBody();
- h = msgContext.getServiceHandler();
+ h = msgContext.getService();
}
if (h == null)
throw new AxisFault("Server.NoService",
1.14 +1 -1
xml-axis/java/src/org/apache/axis/transport/http/HTTPTransport.java
Index: HTTPTransport.java
===================================================================
RCS file:
/home/cvs/xml-axis/java/src/org/apache/axis/transport/http/HTTPTransport.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- HTTPTransport.java 8 Feb 2002 22:14:11 -0000 1.13
+++ HTTPTransport.java 20 Feb 2002 18:59:22 -0000 1.14
@@ -122,7 +122,7 @@
// Allow the SOAPAction to determine the service, if the service
// (a) has not already been determined, and (b) if a service matching
// the soap action has been deployed.
- if (mc.getServiceHandler() == null) {
+ if (mc.getService() == null) {
mc.setTargetService( (String)mc.getSOAPActionURI() );
}
}
1.101 +1 -1 xml-axis/java/src/org/apache/axis/utils/Admin.java
Index: Admin.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/Admin.java,v
retrieving revision 1.100
retrieving revision 1.101
diff -u -r1.100 -r1.101
--- Admin.java 19 Feb 2002 17:38:22 -0000 1.100
+++ Admin.java 20 Feb 2002 18:59:22 -0000 1.101
@@ -225,7 +225,7 @@
/** For now, though - make sure we can only admin from our own
* IP, unless the remoteAdmin option is set.
*/
- Handler serviceHandler = msgContext.getServiceHandler();
+ Handler serviceHandler = msgContext.getService();
if (serviceHandler != null) {
String remoteAdmin = (String)serviceHandler.
getOption("enableRemoteAdmin");
1.2 +5 -1 xml-axis/java/src/org/apache/axis/utils/cache/ClassCache.java
Index: ClassCache.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/utils/cache/ClassCache.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ClassCache.java 8 Feb 2002 03:09:26 -0000 1.1
+++ ClassCache.java 20 Feb 2002 18:59:22 -0000 1.2
@@ -110,7 +110,11 @@
* @param cl ClassLoader to use if we need to load the class
* @return JavaClass entry
*/
- public JavaClass lookup(String className, ClassLoader cl) throws
ClassNotFoundException {
+ public JavaClass lookup(String className, ClassLoader cl)
+ throws ClassNotFoundException {
+ if (className == null) {
+ return null;
+ }
JavaClass jc = (JavaClass) classCache.get(className);
if ((jc == null) && (cl != null)) {
// Try to load the class with the specified classloader
1.19 +19 -2 xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java
Index: Emitter.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/fromJava/Emitter.java,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -r1.18 -r1.19
--- Emitter.java 19 Feb 2002 15:06:51 -0000 1.18
+++ Emitter.java 20 Feb 2002 18:59:22 -0000 1.19
@@ -116,6 +116,9 @@
public static final int MODE_ALL = 0;
public static final int MODE_INTERFACE = 1;
public static final int MODE_IMPLEMENTATION = 2;
+
+ public static final int MODE_RPC = 0;
+ public static final int MODE_DOCUMENT = 1;
private Class cls;
private Class implCls; // Optional implementation class
@@ -131,6 +134,7 @@
private String serviceElementName;
private String targetService = null;
private String description;
+ private int mode = MODE_RPC;
private TypeMapping tm = null; // Registered type mapping
private TypeMapping defaultTM = null; // Default TM
private Namespaces namespaces;
@@ -485,7 +489,8 @@
new javax.wsdl.QName(intfNS, getServicePortName() + "SoapBinding"));
SOAPBinding soapBinding = new SOAPBindingImpl();
- soapBinding.setStyle("rpc");
+ String modeStr = (mode == MODE_RPC) ? "rpc" : "document";
+ soapBinding.setStyle(modeStr);
soapBinding.setTransportURI(Constants.URI_SOAP_HTTP);
binding.addExtensibilityElement(soapBinding);
@@ -643,7 +648,11 @@
SOAPOperation soapOper = new SOAPOperationImpl();
soapOper.setSoapActionURI("");
- soapOper.setStyle("rpc");
+
+ // Until we have per-operation configuration, this will always be
+ // the same as the binding default.
+ // soapOper.setStyle("rpc");
+
bindingOper.addExtensibilityElement(soapOper);
SOAPBody soapBody = new SOAPBodyImpl();
@@ -1242,5 +1251,13 @@
*/
public void setDefaultTypeMapping(TypeMapping defaultTM) {
this.defaultTM = defaultTM;
+ }
+
+ public int getMode() {
+ return mode;
+ }
+
+ public void setMode(int mode) {
+ this.mode = mode;
}
}
1.10 +19 -9 xml-axis/java/test/RPCDispatch/Service.java
Index: Service.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/Service.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- Service.java 5 Dec 2001 00:27:18 -0000 1.9
+++ Service.java 20 Feb 2002 18:59:22 -0000 1.10
@@ -35,13 +35,6 @@
/**
* Return the target service (should be this!)
*/
- public String targetServiceExplicit(MessageContext mc) throws Exception {
- return mc.getTargetService();
- }
-
- /**
- * Return the target service (should be this!)
- */
public String targetServiceImplicit() throws Exception {
return MessageContext.getCurrentContext().getTargetService();
}
@@ -49,10 +42,10 @@
/**
* Return the target service (should be this!)
*/
- public String argAsDOM(MessageContext mc, Data input) throws Exception {
+ public String argAsDOM(Data input) throws Exception {
// get the first parameter
- Message message = mc.getRequestMessage();
+ Message message = MessageContext.getCurrentContext().getRequestMessage();
RPCElement body =
(RPCElement)message.getSOAPPart().getAsSOAPEnvelope().getFirstBody();
NodeList parms = body.getAsDOM().getChildNodes();
Node parm1 = null;
@@ -71,6 +64,23 @@
*/
public Integer echoInt(Integer value) throws Exception {
return value;
+ }
+
+ /**
+ * Return the boolean value passed in
+ */
+ public boolean overloaded(boolean b)
+ {
+ return b;
+ }
+
+ /**
+ * Return the int passed in (this and the function above test overloaded
+ * method dispatch)
+ */
+ public int overloaded(int i)
+ {
+ return i;
}
/**
1.33 +0 -15 xml-axis/java/test/RPCDispatch/TestRPC.java
Index: TestRPC.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestRPC.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- TestRPC.java 28 Jan 2002 18:23:02 -0000 1.32
+++ TestRPC.java 20 Feb 2002 18:59:22 -0000 1.33
@@ -147,21 +147,6 @@
}
/**
- * Test a simple method that returns a field from the message context
- */
- public void testMessageContextExplicit() throws Exception {
- // Register the targetService service
- SOAPService tgtSvc = new SOAPService(new RPCProvider());
- tgtSvc.setOption("className", "test.RPCDispatch.Service");
- tgtSvc.setOption("allowedMethods", "targetServiceExplicit");
- provider.deployService(new QName(null, SOAPAction), tgtSvc);
-
- // invoke the service and verify the result
- assertEquals("SOAP Action did not equal the targetService.",
- SOAPAction, rpc("targetServiceExplicit", new Object[] {}));
- }
-
- /**
* Test a simple method that accepts and returns a null
*/
public void testNull() throws Exception {
1.26 +20 -0 xml-axis/java/test/RPCDispatch/TestSerializedRPC.java
Index: TestSerializedRPC.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/RPCDispatch/TestSerializedRPC.java,v
retrieving revision 1.25
retrieving revision 1.26
diff -u -r1.25 -r1.26
--- TestSerializedRPC.java 1 Feb 2002 22:08:26 -0000 1.25
+++ TestSerializedRPC.java 20 Feb 2002 18:59:22 -0000 1.26
@@ -208,12 +208,32 @@
assertEquals("Did not echo arg correctly.", arg, rpc("argAsDOM", arg,
true));
}
+ /**
+ * Test overloaded method dispatch without the benefit of xsi:types
+ */
+ public void testOverloadedMethodDispatch() throws Exception
+ {
+ // invoke the service and verify the result
+ String arg = "<arg0>true</arg0>";
+ Boolean expected = Boolean.TRUE;
+ assertEquals("Overloaded method test failed with a boolean",
+ expected,
+ rpc("overloaded", arg, true));
+
+ arg = "<arg0>5</arg0>";
+ Integer expectedInt = new Integer(5);
+ assertEquals("Overloaded method test failed with an int",
+ expectedInt,
+ rpc("overloaded", arg, true));
+ }
+
public static void main(String args[]) {
try {
TestSerializedRPC tester = new TestSerializedRPC("Test Serialized RPC");
tester.testSerReverseString();
tester.testSerReverseData();
tester.testArgAsDOM();
+ tester.testOverloadedMethodDispatch();
} catch (Exception e) {
e.printStackTrace();
}
1.10 +1 -1 xml-axis/java/test/encoding/TestBody.java
Index: TestBody.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/encoding/TestBody.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- TestBody.java 12 Feb 2002 17:18:29 -0000 1.9
+++ TestBody.java 20 Feb 2002 18:59:22 -0000 1.10
@@ -52,7 +52,7 @@
//assertEquals("Namespace does not equal the message context target
service.", namespace, msgContext.getTargetService());
// verify the service is set
- assertEquals("The target is not the same as the message context service
handler", target, msgContext.getServiceHandler());
+ assertEquals("The target is not the same as the message context service
handler", target, msgContext.getService());
}
public static void main(String[] args) throws Exception {
1.14 +2 -2 xml-axis/java/test/session/TestSimpleSession.java
Index: TestSimpleSession.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/session/TestSimpleSession.java,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -r1.13 -r1.14
--- TestSimpleSession.java 19 Feb 2002 04:28:52 -0000 1.13
+++ TestSimpleSession.java 20 Feb 2002 18:59:22 -0000 1.14
@@ -141,9 +141,9 @@
* This is our service method for testing session data. Simply
* increments a session-scoped counter.
*/
- public Integer counter(MessageContext context) throws Exception
+ public Integer counter() throws Exception
{
- Session session = context.getSession();
+ Session session = MessageContext.getCurrentContext().getSession();
if (session == null)
throw new Exception("No session in MessageContext!");
Integer count = (Integer)session.get("counter");