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 ro...@apache.org on 2001/06/01 08:48:01 UTC
cvs commit: xml-axis/java/test/functional TestBidBuySample.java TestMiscSample.java TestStockSample.java FunctionalTests.java TestTCPEcho.java TestHTTPEcho.java
robj 01/05/31 23:48:01
Modified: java/samples/bidbuy TestClient.java v3.java
java/samples/echo TestClient.java
java/samples/misc TestClient.java
java/samples/stock GetInfo.java GetQuote.java
java/samples/transport FileTest.java
java/src/org/apache/axis/client AxisClient.java
ServiceClient.java
java/src/org/apache/axis/transport/tcp AxisListener.java
java/test build_functional_tests.xml
java/test/functional FunctionalTests.java TestTCPEcho.java
Added: java/src/org/apache/axis/client Transport.java
java/src/org/apache/axis/client/http AdminClient.java
HTTPTransport.java
java/src/org/apache/axis/client/tcp TCPTransport.java
java/test/functional TestBidBuySample.java
TestMiscSample.java TestStockSample.java
Removed: java/src/org/apache/axis/client/http HTTPAdminClient.java
HTTPClient.java
java/src/org/apache/axis/client/tcp TCPClient.java
java/test/functional TestHTTPEcho.java
Log:
Final pass (for now) at client transport stuff.
- AxisClient now has no subclasses (and is much more
comparable to AxisServer). No more client class renamings
from me!
- "new ServiceClient(new HTTPTransport(url, action))"
works. (and the HTTPTransport object can be reused, Sam :-)
- Added the bidbuy sample (which works) and the misc
sample (which is broken!) to functional-tests.
Revision Changes Path
1.3 +5 -4 xml-axis/java/samples/bidbuy/TestClient.java
Index: TestClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/bidbuy/TestClient.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- TestClient.java 2001/05/31 09:22:30 1.2
+++ TestClient.java 2001/06/01 06:47:51 1.3
@@ -61,7 +61,7 @@
import org.apache.axis.AxisFault ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.http.HTTPTransport ;
import org.apache.axis.encoding.BeanSerializer;
import org.apache.axis.encoding.SOAPTypeMappingRegistry;
import org.apache.axis.encoding.ServiceDescription;
@@ -103,9 +103,9 @@
// set up the call object
Options opts = new Options(args);
Debug.setDebugLevel( opts.isFlagSet( 'd' ) );
- call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, opts.getURL());
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Buy");
+ call = new ServiceClient(new HTTPTransport());
+ call.set(HTTPTransport.URL, opts.getURL());
+ call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Buy");
// register the PurchaseOrder class
QName poqn = new QName("http://www.soapinterop.org/Bid",
@@ -153,6 +153,7 @@
System.out.println(receipt);
} catch (Exception e) {
System.out.println("Buy failed: " + e);
+ throw e;
}
}
1.5 +21 -22 xml-axis/java/samples/bidbuy/v3.java
Index: v3.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/bidbuy/v3.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- v3.java 2001/05/31 09:22:33 1.4
+++ v3.java 2001/06/01 06:47:52 1.5
@@ -1,7 +1,7 @@
package samples.bidbuy ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.http.HTTPTransport ;
import org.apache.axis.message.RPCElement ;
import org.apache.axis.message.RPCParam ;
import org.apache.axis.utils.* ;
@@ -13,9 +13,8 @@
public class v3 implements vInterface {
public void register(String registryURL, Service s) throws Exception {
try {
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, registryURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Register");
+ ServiceClient call = new ServiceClient
+ (new HTTPTransport(registryURL, "http://www.soapinterop.org/Register"));
RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
"Register",
new RPCParam[] {
@@ -37,9 +36,8 @@
public void unregister(String registryURL, String name) throws Exception {
try {
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, registryURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Unegister");
+ ServiceClient call = new ServiceClient
+ (new HTTPTransport(registryURL, "http://www.soapinterop.org/Unregister"));
RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
"Unregister",
new RPCParam[] {
@@ -55,9 +53,9 @@
public Boolean ping(String serverURL) throws Exception {
try {
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, serverURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Ping");
+ ServiceClient call = new ServiceClient(new HTTPTransport());
+ call.set(HTTPTransport.URL, serverURL);
+ call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Ping");
call.invoke( "http://www.soapinterop.org/Bid", "Ping", null );
return( new Boolean(true) );
}
@@ -73,9 +71,9 @@
ServiceDescription sd = new ServiceDescription("lookup", true );
sd.addOutputParam("RequestForQuoteResult",
SOAPTypeMappingRegistry.XSD_DOUBLE);
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, registryURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/LookupAsString");
+ ServiceClient call = new ServiceClient(new HTTPTransport());
+ call.set(HTTPTransport.URL, registryURL);
+ call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/LookupAsString");
call.setServiceDescription(sd);
RPCElement body = new RPCElement( "http://www.soapinterop.org/Registry",
"LookupAsString",
@@ -124,9 +122,9 @@
SOAPTypeMappingRegistry.XSD_DOUBLE);
sd.addOutputParam("return",
SOAPTypeMappingRegistry.XSD_DOUBLE);
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, serverURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/RequestForQuote");
+ ServiceClient call =
+ new ServiceClient(new HTTPTransport
+ (serverURL, "http://www.soapinterop.org/RequestForQuote"));
call.setServiceDescription( sd );
RPCElement body = new RPCElement( "http://www.soapinterop.org/Bid",
"RequestForQuote",
@@ -156,9 +154,9 @@
SOAPTypeMappingRegistry.XSD_STRING);
sd.addOutputParam("return",
SOAPTypeMappingRegistry.XSD_STRING);
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, serverURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/SimpleBuy");
+ ServiceClient call =
+ new ServiceClient(new HTTPTransport
+ (serverURL, "http://www.soapinterop.org/SimpleBuy"));
RPCElement body = new RPCElement( "http://www.soapinterop.org/Bid",
"SimpleBuy",
new RPCParam[] {
@@ -189,9 +187,9 @@
SOAPTypeMappingRegistry.XSD_STRING);
sd.addOutputParam("return",
SOAPTypeMappingRegistry.XSD_STRING);
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, serverURL);
- call.set(HTTPClient.ACTION, "http://www.soapinterop.org/Buy");
+ ServiceClient call = new ServiceClient(new HTTPTransport());
+ call.set(HTTPTransport.URL, serverURL);
+ call.set(HTTPTransport.ACTION, "http://www.soapinterop.org/Buy");
// register the PurchaseOrder class
@@ -248,3 +246,4 @@
}
}
+
1.6 +5 -5 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.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- TestClient.java 2001/05/31 09:22:40 1.5
+++ TestClient.java 2001/06/01 06:47:53 1.6
@@ -60,7 +60,7 @@
import org.apache.axis.AxisFault ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.http.HTTPTransport ;
import org.apache.axis.encoding.BeanSerializer;
import org.apache.axis.encoding.SOAPTypeMappingRegistry;
import org.apache.axis.encoding.ServiceDescription;
@@ -120,7 +120,7 @@
if (addMethodToAction) {
action += method;
}
- call.set(HTTPClient.ACTION, action);
+ call.set(HTTPTransport.ACTION, action);
// issue the request
Object gotBack = call.invoke(
@@ -154,9 +154,9 @@
if (action != null)
soapAction = action;
- call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, opts.getURL());
- call.set(HTTPClient.ACTION, "http://soapinterop.org/");
+ call = new ServiceClient(new HTTPTransport());
+ call.set(HTTPTransport.URL, opts.getURL());
+ call.set(HTTPTransport.ACTION, "http://soapinterop.org/");
// register the SOAPStruct class
QName ssqn = new QName("http://soapinterop.org/xsd", "SOAPStruct");
1.5 +18 -14 xml-axis/java/samples/misc/TestClient.java
Index: TestClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/misc/TestClient.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- TestClient.java 2001/05/31 09:22:45 1.4
+++ TestClient.java 2001/06/01 06:47:54 1.5
@@ -63,7 +63,7 @@
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.http.HTTPTransport ;
/**
*
@@ -71,8 +71,11 @@
* @author Glen Daniels (gdaniels@allaire.com)
*/
public class TestClient {
- public static void main(String args[]) {
- try {
+ public static String msg = "<m:GetLastTradePrice xmlns:m=\"Some-URI\">\n" +
+ "<symbol>IBM</symbol>\n" +
+ "</m:GetLastTradePrice>\n" ;
+
+ public static String doTest (String args[]) throws Exception {
Options opts = new Options( args );
String url = opts.getURL();
String action = "EchoService" ;
@@ -82,27 +85,28 @@
args = opts.getRemainingArgs();
if ( args != null ) action = args[0];
- ServiceClient hMsg = new ServiceClient(new HTTPClient());
- hMsg.set(HTTPClient.URL, url);
- hMsg.set(HTTPClient.ACTION, action);
+ ServiceClient hMsg = new ServiceClient(new HTTPTransport());
+ hMsg.set(HTTPTransport.URL, url);
+ hMsg.set(HTTPTransport.ACTION, action);
if ( opts.isFlagSet('t') > 0 ) hMsg.doLocal = true ;
- String msg = "<m:GetLastTradePrice xmlns:m=\"Some-URI\">\n" +
- "<symbol>IBM</symbol>\n" +
- "</m:GetLastTradePrice>\n" ;
-
- MessageContext msgContext = new MessageContext();
Message inMsg = new Message( msg, "String" );
Message outMsg = null ;
System.out.println( "Request:\n" + msg );
- msgContext.setRequestMessage( inMsg );
- hMsg.invoke( msgContext );
- outMsg = msgContext.getResponseMessage();
+ hMsg.setRequestMessage( inMsg );
+ hMsg.invoke();
+ outMsg = hMsg.getMessageContext().getResponseMessage();
System.out.println( "Response:\n" + outMsg.getAs( "String" ) );
+ return (String)outMsg.getAs("String");
+ }
+
+ public static void main(String args[]) {
+ try {
+ doTest(args);
}
catch( Exception e ) {
if ( e instanceof AxisFault ) ((AxisFault)e).dump();
1.7 +6 -6 xml-axis/java/samples/stock/GetInfo.java
Index: GetInfo.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/stock/GetInfo.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- GetInfo.java 2001/05/31 09:22:50 1.6
+++ GetInfo.java 2001/06/01 06:47:54 1.7
@@ -63,7 +63,8 @@
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.Transport ;
+import org.apache.axis.client.http.HTTPTransport ;
/**
*
@@ -85,14 +86,13 @@
}
String symbol = args[0] ;
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, opts.getURL());
- call.set(HTTPClient.ACTION, "urn:cominfo");
+ ServiceClient call = new ServiceClient
+ (new HTTPTransport(opts.getURL(), "urn:cominfo"));
if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
- call.set( HTTPClient.USER, opts.getUser() );
- call.set( HTTPClient.PASSWORD, opts.getPassword() );
+ call.set( Transport.USER, opts.getUser() );
+ call.set( Transport.PASSWORD, opts.getPassword() );
String res = (String) call.invoke(
"urn:cominfo", "getInfo",
new Object[] { args[0], args[1] } );
1.20 +6 -6 xml-axis/java/samples/stock/GetQuote.java
Index: GetQuote.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/stock/GetQuote.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- GetQuote.java 2001/05/31 15:52:18 1.19
+++ GetQuote.java 2001/06/01 06:47:55 1.20
@@ -61,7 +61,8 @@
import org.apache.axis.AxisFault ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.Transport ;
+import org.apache.axis.client.http.HTTPTransport ;
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.utils.QName ;
@@ -90,17 +91,16 @@
String action = "urn:xmltoday-delayed-quotes";
symbol = args[0] ;
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, opts.getURL());
- call.set(HTTPClient.ACTION, action);
+ ServiceClient call = new ServiceClient
+ (new HTTPTransport(opts.getURL(), action));
ServiceDescription sd = new ServiceDescription("stockQuotes", true);
sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
call.setServiceDescription(sd);
if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
- call.set( HTTPClient.USER, opts.getUser() );
- call.set( HTTPClient.PASSWORD, opts.getPassword() );
+ call.set( Transport.USER, opts.getUser() );
+ call.set( Transport.PASSWORD, opts.getPassword() );
// useful option for profiling - perhaps we should remove before
// shipping?
1.3 +6 -6 xml-axis/java/samples/transport/FileTest.java
Index: FileTest.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/transport/FileTest.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- FileTest.java 2001/05/31 09:23:10 1.2
+++ FileTest.java 2001/06/01 06:47:55 1.3
@@ -5,7 +5,8 @@
import org.apache.axis.AxisFault ;
import org.apache.axis.client.AxisClient ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.http.HTTPClient ;
+import org.apache.axis.client.Transport ;
+import org.apache.axis.client.http.HTTPTransport ;
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.encoding.* ;
@@ -35,17 +36,16 @@
}
String symbol = args[0] ;
- ServiceClient call = new ServiceClient(new HTTPClient());
- call.set(HTTPClient.URL, opts.getURL());
- call.set(HTTPClient.ACTION, "urn:xmltoday-delayed-quotes");
+ ServiceClient call = new ServiceClient
+ (new HTTPTransport(opts.getURL(), "urn:xmltoday-delayed-quotes"));
ServiceDescription sd = new ServiceDescription("stockQuotes", true);
sd.addOutputParam("return", SOAPTypeMappingRegistry.XSD_FLOAT);
call.setServiceDescription(sd);
if ( opts.isFlagSet('t') > 0 ) call.doLocal = true ;
- call.set(AxisClient.USER, opts.getUser() );
- call.set(AxisClient.PASSWORD, opts.getPassword() );
+ call.set(Transport.USER, opts.getUser() );
+ call.set(Transport.PASSWORD, opts.getPassword() );
call.setTransportInput( "FileSender" );
Float res = new Float(0.0F);
1.8 +10 -25 xml-axis/java/src/org/apache/axis/client/AxisClient.java
Index: AxisClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/AxisClient.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- AxisClient.java 2001/05/31 09:23:24 1.7
+++ AxisClient.java 2001/06/01 06:47:56 1.8
@@ -70,21 +70,15 @@
* @author Doug Davis (dug@us.ibm.com)
* @author Glen Daniels (gdaniels@allaire.com)
*/
-public abstract class AxisClient extends BasicHandler
+public class AxisClient extends BasicHandler
{
public AxisClient() {}
/**
- * Property names for user & password.
- * Soon to be moved elsewhere.
- */
- public static String USER = "user";
- public static String PASSWORD = "password";
-
- /**
* Allows the Listener to specify which handler/service registry
* implementation they want to use.
*/
+ /*
public AxisClient(HandlerRegistry handlers, HandlerRegistry services)
{
Debug.Print( 1, "Enter: AxisClient::Constructor");
@@ -93,7 +87,7 @@
addOption(Constants.HANDLER_REGISTRY, handlers);
addOption(Constants.SERVICE_REGISTRY, services);
Debug.Print( 1, "Exit: AxisClient::Constructor");
- }
+ }*/
/**
* Find/load the registries and save them so we don't need to do this
@@ -102,8 +96,8 @@
public void init() {
// Load the simple handler registry and init it
Debug.Print( 1, "Enter: AxisClient::init" );
- DefaultHandlerRegistry hr =
- new DefaultHandlerRegistry(Constants.CLIENT_HANDLER_REGISTRY);
+ DefaultHandlerRegistry hr =
+ new DefaultHandlerRegistry(Constants.CLIENT_HANDLER_REGISTRY);
hr.setOnServer( false );
hr.init();
addOption( Constants.HANDLER_REGISTRY, hr );
@@ -119,16 +113,6 @@
}
/**
- * Set up the message context as appropriate for this transport.
- * @param context the context to set up (with transport chain info, etc.)
- * @param message the client service instance
- * @throws AxisFault if service cannot be found
- */
- public abstract void setupMessageContext
- (MessageContext context, ServiceClient message, boolean doLocal)
- throws AxisFault;
-
- /**
* Main routine of the AXIS server. In short we locate the appropriate
* handler for the desired service and invoke() it.
*/
@@ -141,9 +125,9 @@
/* Do some prep-work. Get the registries and put them in the */
/* msgContext so they can be used by later handlers. */
/**************************************************************/
- HandlerRegistry hr =
+ HandlerRegistry hr =
(HandlerRegistry) getOption(Constants.HANDLER_REGISTRY);
- HandlerRegistry sr =
+ HandlerRegistry sr =
(HandlerRegistry) getOption(Constants.SERVICE_REGISTRY);
if ( hr != null )
@@ -244,5 +228,6 @@
public void undo(MessageContext msgContext) {
Debug.Print( 1, "Enter: AxisClient::undo" );
Debug.Print( 1, "Exit: AxisClient::undo" );
- };
-};
+ }
+}
+
1.3 +97 -45 xml-axis/java/src/org/apache/axis/client/ServiceClient.java
Index: ServiceClient.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/client/ServiceClient.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ServiceClient.java 2001/05/31 16:02:14 1.2
+++ ServiceClient.java 2001/06/01 06:47:56 1.3
@@ -97,8 +97,8 @@
public boolean doLocal = false ;
private static final boolean DEBUG_LOG = false;
- // Our selected Client
- private AxisClient transport;
+ // Our engine; either AxisClient (usually) or AxisServer (doLocal)
+ private Handler engine;
// The description of our service
private ServiceDescription serviceDesc;
@@ -106,28 +106,77 @@
// The message context we use across invocations
private MessageContext msgContext;
+ // Our Transport, if any
+ private Transport transport;
+
+
/**
- * Construct a ServiceClient on the given AxisClient.
+ * Construct a ServiceClient with no properties.
+ * Set it up yourself!
*/
- public ServiceClient (AxisClient transport) {
- this.transport = transport;
+ public ServiceClient () {
msgContext = new MessageContext();
+ this.setupEngine();
+ }
+
+ /**
+ * Construct a ServiceClient with the given Transport.
+ */
+ public ServiceClient (Transport transport) {
+ msgContext = new MessageContext();
+ this.transport = transport;
+
+ this.setupEngine();
+
+ // set up the message context with the transport
+ try {
+ transport.init(engine);
+ transport.initMessageContext(msgContext, this, engine, doLocal);
+ } catch (AxisFault f) {
+ // this will happen if there is no appropriate service
+ // what? system.err for now
+ System.err.println("ServiceClient(Transport): Faulted when initializing message context: "+f);
+ }
+ }
+
+ /**
+ * Set up the engine as appropriate for client / server.
+ */
+ private void setupEngine () {
+ // For testing - skip HTTP layer
+ if (engine != null) {
+ return;
+ }
+
+ if ( doLocal ) {
+ engine = new org.apache.axis.server.AxisServer();
+ engine.init();
+ } else {
+ engine = new AxisClient();
+ engine.init();
+ }
}
+
+
/**
- * set property
+ * Set property; pass through to MessageContext.
+ * This works because the constants defined in Transport and its
+ * subclasses are synonyms for MessageContext constants.
*/
public void set (String name, String value) {
if (value == null) return;
- properties.put(name, value);
+ msgContext.setProperty(name, value);
}
/**
- * get property
+ * Get property; pass through to MessageContext.
+ * This works because the constants defined in Transport and its
+ * subclasses are synonyms for MessageContext constants.
*/
public String get (String name) {
- return (String)properties.get(name);
+ return (String)msgContext.getProperty(name);
}
public void setEncodingStyleURI( String uri ) {
@@ -145,6 +194,17 @@
public void setTransportOutput(String handlerName) {
msgContext.setProperty( MessageContext.TRANS_OUTPUT, handlerName );
}
+
+ public void setRequestMessage(Message msg) {
+ msgContext.setRequestMessage(msg);
+ }
+
+ /**
+ * all-purpose accessor for fringe cases....
+ */
+ public MessageContext getMessageContext () {
+ return msgContext;
+ }
public void setServiceDescription(ServiceDescription serviceDesc)
{
@@ -214,7 +274,7 @@
}
try {
- invoke( msgContext );
+ invoke();
}
catch( Exception e ) {
Debug.Print( 1, e );
@@ -250,13 +310,19 @@
return( result );
}
- public void invoke( MessageContext mc ) throws AxisFault {
+ /**
+ * invoke this ServiceClient with its established MessageContext
+ * (perhaps because you called this.setRequestMessage())
+ */
+ public void invoke() throws AxisFault {
Debug.Print( 1, "Enter: ClientMessage::invoke(MessageContext)" );
- // set up the message context with the transport
- transport.setupMessageContext(mc, this, doLocal);
+ // set up message context if there is a transport
+ if (transport != null) {
+ transport.setupMessageContext(msgContext, this, this.engine, doLocal);
+ }
- Message inMsg = mc.getRequestMessage();
+ Message inMsg = msgContext.getRequestMessage();
SOAPEnvelope reqEnv = null ;
@@ -272,35 +338,21 @@
}
// local (if null) or pre-existing transport (if !null)
- Handler client = null ;
Message reqMsg = new Message( reqEnv, "SOAPEnvelope" );
-
- // For testing - skip HTTP layer
- if ( doLocal ) {
- if ( localServer == null ) {
- localServer = new org.apache.axis.server.AxisServer();
- localServer.init();
- }
- client = localServer;
- }
- else {
- /* Ok, this might seem strange, but here it is... */
- /* Create a new AxisClient Engine and init it. This will load any */
- /* registries that *might* be there. We set the target service to */
- /* the service so that if it is registered here on the client */
- /* we'll find it's request/response chains and invoke them. Next we */
- /* check to see if there is any ServiceRegistry at all, or if there */
- /* is one, check to see if a chain called HTTP.input is there. If */
- /* not then we need to default to just the simple HTTPDispatchHandler*/
- /* to call the server. */
- /* The hard part about the client is that we can't assume *any* */
- /* configuration has happened at all so hard-coded defaults are */
- /* required. */
- /*********************************************************************/
- client = transport;
- client.init();
- }
+ /* Ok, this might seem strange, but here it is... */
+ /* Create a new AxisClient Engine and init it. This will load any */
+ /* registries that *might* be there. We set the target service to */
+ /* the service so that if it is registered here on the client */
+ /* we'll find it's request/response chains and invoke them. Next we */
+ /* check to see if there is any ServiceRegistry at all, or if there */
+ /* is one, check to see if a chain called HTTP.input is there. If */
+ /* not then we need to default to just the simple HTTPDispatchHandler*/
+ /* to call the server. */
+ /* The hard part about the client is that we can't assume *any* */
+ /* configuration has happened at all so hard-coded defaults are */
+ /* required. */
+ /*********************************************************************/
if ( Debug.getDebugLevel() > 0 ) {
DebugHeader header = new DebugHeader(Debug.getDebugLevel());
header.setActor( Constants.URI_NEXT_ACTOR );
@@ -309,17 +361,17 @@
}
try {
- client.invoke( mc );
- client.cleanup();
+ engine.invoke( msgContext );
+ engine.cleanup();
}
catch( AxisFault fault ) {
Debug.Print( 1, fault );
throw fault ;
}
- Message resMsg = mc.getResponseMessage();
+ Message resMsg = msgContext.getResponseMessage();
//SOAPEnvelope resEnv = (SOAPEnvelope) resMsg.getAs( "SOAPEnvelope" );
- mc.setResponseMessage(resMsg);
+ msgContext.setResponseMessage(resMsg);
/*
SOAPBody resBody = null; //resEnv.getFirstBody();
1.1 xml-axis/java/src/org/apache/axis/client/Transport.java
Index: Transport.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.client;
import java.util.* ;
import org.apache.axis.MessageContext;
import org.apache.axis.AxisFault;
import org.apache.axis.Handler;
public abstract class Transport {
/**
* Synonyms for MessageContext userid / password.
*/
public static String USER = MessageContext.USERID;
public static String PASSWORD = MessageContext.PASSWORD;
/**
* Initialize the given AxisClient with whatever transport state
* is appropriate.
*/
public void init (Handler client) {
// default is do nothing
}
/**
* Initialize the given MessageContext with the correct handlers and registries.
*/
public abstract void initMessageContext
(MessageContext context, ServiceClient message, Handler engine, boolean doLocal)
throws AxisFault;
/**
* Set up any transport-specific derived properties in the message context.
* @param context the context to set up
* @param message the client service instance
* @param engine the engine containing the registries
* @param doLocal if true, we are setting up for local testing
* @throws AxisFault if service cannot be found
*/
public abstract void setupMessageContext
(MessageContext context, ServiceClient message, Handler engine, boolean doLocal)
throws AxisFault;
}
1.1 xml-axis/java/src/org/apache/axis/client/http/AdminClient.java
Index: AdminClient.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.client.http ;
import java.net.*;
import java.io.*;
import java.util.*;
import org.apache.axis.utils.Options ;
import org.apache.axis.encoding.SerializationContext ;
import org.apache.axis.message.SOAPEnvelope ;
import org.apache.axis.message.SOAPBodyElement ;
import org.apache.axis.client.ServiceClient;
import org.apache.axis.client.Transport;
import org.apache.axis.Message ;
import org.apache.axis.MessageContext ;
import org.apache.axis.utils.Debug ;
import org.apache.axis.encoding.ServiceDescription;
/**
* An admin client object, specific to HTTP.
*
* @author Rob Jellinghaus (robj@unrealities.com)
* @author Doug Davis (dug@us.ibm.com)
*/
public class AdminClient {
public static void main(String args[]) {
try {
new AdminClient().doAdmin(args);
}
catch( Exception e ) {
System.err.println( e );
e.printStackTrace( System.err );
}
}
// do the real work, and throw exception if fubar
// this is reused by the TestHTTPDeploy functional tests
public void doAdmin (String[] args)
throws Exception
{
Options opts = new Options( args );
Debug.setDebugLevel( opts.isFlagSet('d') );
args = opts.getRemainingArgs();
if ( args == null ) {
System.err.println( "Usage: AdminClient xml-files | list" );
System.exit(1);
}
for ( int i = 0 ; i < args.length ; i++ ) {
InputStream input = null ;
if ( args[i].equals("list") ) {
System.out.println( "Doing a list" );
String str = "<list/>" ;
input = new ByteArrayInputStream( str.getBytes() );
} else if (args[i].equals("quit")) {
System.out.println("Doing a quit");
String str = "<quit/>";
input = new ByteArrayInputStream(str.getBytes());
}
else {
System.out.println( "Processing file: " + args[i] );
input = new FileInputStream( args[i] );
}
ServiceClient hMsg =
new ServiceClient(new HTTPTransport(opts.getURL(), "AdminService"));
Message inMsg = new Message( input, "BodyInputStream" );
hMsg.setRequestMessage( inMsg );
if ( opts.isFlagSet('t') > 0 ) hMsg.doLocal = true ;
hMsg.set( Transport.USER, opts.getUser() );
hMsg.set( Transport.PASSWORD, opts.getPassword() );
hMsg.invoke();
Message outMsg = hMsg.getMessageContext().getResponseMessage();
hMsg.getMessageContext().setServiceDescription(new ServiceDescription("Admin", false));
input.close();
SOAPEnvelope envelope = (SOAPEnvelope) outMsg.getAs("SOAPEnvelope");
SOAPBodyElement body = envelope.getFirstBody();
StringWriter writer = new StringWriter();
SerializationContext ctx = new SerializationContext(writer, hMsg.getMessageContext());
body.output(ctx);
System.out.println(writer.toString());
}
}
}
1.1 xml-axis/java/src/org/apache/axis/client/http/HTTPTransport.java
Index: HTTPTransport.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.client.http;
import java.util.* ;
import org.apache.axis.* ;
import org.apache.axis.utils.Debug ;
import org.apache.axis.handlers.* ;
import org.apache.axis.registries.* ;
import org.apache.axis.client.ServiceClient;
import org.apache.axis.client.Transport;
import org.apache.axis.transport.http.HTTPConstants;
/**
* Extends Transport by implementing the setupMessageContext function to
* set HTTP-specific message context fields and transport chains.
* May not even be necessary if we arrange things differently somehow.
* Can hold state relating to URL properties.
*
* @author Rob Jellinghaus (robj@unrealities.com)
* @author Doug Davis (dug@us.ibm.com)
* @author Glen Daniels (gdaniels@allaire.com)
*/
public class HTTPTransport extends Transport
{
/**
* HTTP properties
*/
static public String URL = MessageContext.TRANS_URL;
static public String ACTION = HTTPConstants.MC_HTTP_SOAPACTION;
private String url;
private String action;
public HTTPTransport () {
}
/**
* helper constructor
*/
public HTTPTransport (String url, String action)
{
this.url = url;
this.action = action;
}
/**
* Initialize the given MessageContext with the correct handlers and registries.
*/
public void initMessageContext (MessageContext mc, ServiceClient serviceClient, Handler engine, boolean doLocal)
throws AxisFault
{
DefaultServiceRegistry sr = (DefaultServiceRegistry)engine.getOption(Constants.SERVICE_REGISTRY);
if ( sr == null || sr.find("HTTP.input") == null )
mc.setProperty( MessageContext.TRANS_INPUT, "HTTPSender" );
else
mc.setProperty( MessageContext.TRANS_INPUT, "HTTP.input" );
mc.setProperty(MessageContext.TRANS_OUTPUT, "HTTP.output" );
/* If there is Input Transport Chain then default to HTTP. */
/* In order for the client to override the transport chain */
/* they should just set the TRANS_INPUT/OUTPUT fields in */
/* the msgContext. */
/***********************************************************/
if ( mc.getProperty( MessageContext.TRANS_INPUT ) == null )
mc.setProperty( MessageContext.TRANS_INPUT, "HTTPSender" );
if ( mc.getProperty( MessageContext.TRANS_OUTPUT ) == null )
mc.setProperty( MessageContext.TRANS_OUTPUT, "HTTP.output" );
}
/**
* Set up any transport-specific derived properties in the message context.
* @param context the context to set up
* @param message the client service instance
* @param engine the engine containing the registries
* @param doLocal if true, we are setting up for local testing
* @throws AxisFault if service cannot be found
*/
public void setupMessageContext (MessageContext mc, ServiceClient serviceClient, Handler engine, boolean doLocal)
throws AxisFault
{
if (url != null) mc.setProperty(URL, url);
if (action != null) mc.setProperty(ACTION, action);
try {
mc.setTargetService( (String)mc.getProperty(ACTION) );
} catch (AxisFault f) {
System.err.println("HTTPClinet.setupMessageContext: Could not set target service to "+serviceClient.get(ACTION));
throw f;
}
if ( doLocal && ((String)mc.getProperty(URL)).endsWith( ".jws") ) {
mc.setProperty( "JWSFileName", serviceClient.get(URL).substring(11) );
mc.setTargetService( Constants.JWSPROCESSOR_TARGET );
}
}
}
1.1 xml-axis/java/src/org/apache/axis/client/tcp/TCPTransport.java
Index: TCPTransport.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.client.tcp ;
import java.util.* ;
import org.apache.axis.* ;
import org.apache.axis.utils.Debug ;
import org.apache.axis.handlers.* ;
import org.apache.axis.registries.* ;
import org.apache.axis.client.Transport;
import org.apache.axis.client.AxisClient;
import org.apache.axis.client.ServiceClient;
import org.apache.axis.client.http.HTTPTransport; // UGLY!!!!!
import org.apache.axis.transport.tcp.TCPDispatchHandler;
import org.apache.axis.handlers.tcp.TCPActionHandler;
/**
* Extends Client by implementing the setupMessageContext function to
* set TCP-specific message context fields. May not even be necessary
* if we arrange things differently somehow.
*
* @author Rob Jellinghaus (robj@unrealities.com)
* @author Doug Davis (dug@us.ibm.com)
* @author Glen Daniels (gdaniels@allaire.com)
*/
public class TCPTransport extends Transport
{
private Handler engine;
static private boolean initedClient = false;
private String host;
private String port;
public TCPTransport () {
}
public TCPTransport (String host, String port) {
this.host = host;
this.port = port;
}
/**
* Find/load the registries and save them so we don't need to do this
* each time we're called.
*/
public void init(Handler engine) {
this.engine = engine;
// Load the simple handler registry and init it
Debug.Print( 1, "Enter: TCPTransport::init" );
// add the TCPDispatchHandler
HandlerRegistry hr = (DefaultHandlerRegistry)engine.getOption(Constants.HANDLER_REGISTRY);
hr.add("TCPSender", new TCPDispatchHandler());
hr.add("TCPAction", new TCPActionHandler());
SimpleChain c = new SimpleChain();
c.addHandler( hr.find( "TCPAction" ) );
hr.add( "TCP.input", c );
}
/**
* TCP properties
*/
static public String HOST = "tcp.host";
static public String PORT = "tcp.port";
/**
* Initialize the given MessageContext with the correct handlers and registries.
*/
public void initMessageContext (MessageContext mc, ServiceClient serv, Handler engine, boolean doLocal)
{
DefaultServiceRegistry sr = (DefaultServiceRegistry)engine.getOption(Constants.SERVICE_REGISTRY);
if ( sr == null || sr.find("TCP.input") == null )
mc.setProperty( MessageContext.TRANS_INPUT, "TCPSender" );
else
mc.setProperty( MessageContext.TRANS_INPUT, "TCP.input" );
mc.setProperty(MessageContext.TRANS_OUTPUT, "TCP.output" );
}
/**
* Set up any transport-specific derived properties in the message context.
* @param context the context to set up
* @param message the client service instance
* @param engine the engine containing the registries
* @param doLocal if true, we are setting up for local testing
* @throws AxisFault if service cannot be found
*/
public void setupMessageContext (MessageContext mc, ServiceClient serv, Handler engine, boolean doLocal)
{
// kind of ugly... fake up a "http://host:port/" url to send down the chain
// ROBJ TODO: clean this up so we use TCP transport properties all the way down
// use serviceclient properties if any, otherwise use ours
if (host != null) serv.set(HOST, host);
if (port != null) serv.set(PORT, port);
String url = "http://"+serv.get(HOST)+":"+serv.get(PORT);
serv.set(HTTPTransport.URL, url);
}
}
1.2 +2 -1 xml-axis/java/src/org/apache/axis/transport/tcp/AxisListener.java
Index: AxisListener.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/transport/tcp/AxisListener.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AxisListener.java 2001/05/31 09:24:50 1.1
+++ AxisListener.java 2001/06/01 06:47:59 1.2
@@ -150,6 +150,7 @@
engine.init();
HandlerRegistry hr = (HandlerRegistry)engine.getOption(Constants.HANDLER_REGISTRY);
+ HandlerRegistry sr = (HandlerRegistry)engine.getOption(Constants.SERVICE_REGISTRY);
// add the TCPDispatchHandler
hr.add("TCPSender", new TCPDispatchHandler());
hr.add("TCPAction", new TCPActionHandler());
@@ -164,7 +165,7 @@
service.addOption(SOAPService.OPTION_PIVOT, "RPCDispatcher");
service.addOption( "className", "org.apache.axis.transport.tcp.PseudoStockQuoteService" );
service.addOption( "methodName", "getQuote" );
- hr.add( "urn:xmltoday-delayed-quotes", service ); // ???
+ sr.add( "urn:xmltoday-delayed-quotes", service ); // ???
}
/* Place the Request message in the MessagContext object - notice */
1.3 +1 -1 xml-axis/java/test/build_functional_tests.xml
Index: build_functional_tests.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- build_functional_tests.xml 2001/05/31 16:24:11 1.2
+++ build_functional_tests.xml 2001/06/01 06:47:59 1.3
@@ -74,7 +74,7 @@
<!-- =================================================================== -->
<target name="stop-functional-test-http-server" if="junit.present">
<echo message="Stopping test http server."/>
- <java classname="org.apache.axis.client.http.HTTPAdminClient" fork="yes">
+ <java classname="org.apache.axis.client.http.AdminClient" fork="yes">
<classpath refid="test-classpath" />
<arg line="quit"/>
</java>
1.2 +13 -2 xml-axis/java/test/functional/FunctionalTests.java
Index: FunctionalTests.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/functional/FunctionalTests.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- FunctionalTests.java 2001/05/31 09:25:21 1.1
+++ FunctionalTests.java 2001/06/01 06:48:00 1.2
@@ -20,8 +20,19 @@
System.out.println("Creating FunctionalTests suite.");
TestSuite suite = new TestSuite();
- //suite.addTestSuite(TestTCPEcho.class);
- suite.addTestSuite(TestHTTPEcho.class);
+ // misc (echo) test
+ // BROKEN AS OF RIGHT NOW, 11:26 PST 20010531 -- RobJ
+ // suite.addTestSuite(TestMiscSample.class);
+
+ // test of the TCP transport
+ // ... should be removed?
+ suite.addTestSuite(TestTCPEcho.class);
+
+ // stock sample test
+ suite.addTestSuite(TestStockSample.class);
+
+ // bid-buy test
+ suite.addTestSuite(TestBidBuySample.class);
return suite;
}
1.2 +7 -6 xml-axis/java/test/functional/TestTCPEcho.java
Index: TestTCPEcho.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/functional/TestTCPEcho.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestTCPEcho.java 2001/05/31 09:25:21 1.1
+++ TestTCPEcho.java 2001/06/01 06:48:00 1.2
@@ -61,7 +61,7 @@
import org.apache.axis.AxisFault ;
import org.apache.axis.client.ServiceClient ;
-import org.apache.axis.client.tcp.TCPClient;
+import org.apache.axis.client.tcp.TCPTransport;
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.utils.QName ;
@@ -80,6 +80,7 @@
public void testData() throws Exception {
try {
+ System.out.println("Testing TCP stock service...");
/*
Options opts = new Options( args );
@@ -103,9 +104,8 @@
System.exit(1);
}
- ServiceClient call = new ServiceClient( new TCPClient() );
- call.set(TCPClient.HOST, url.getHost());
- call.set(TCPClient.PORT, ""+url.getPort());
+ ServiceClient call = new ServiceClient
+ ( new TCPTransport(url.getHost(), ""+url.getPort()) );
// reconstruct URL
ServiceDescription sd = new ServiceDescription("stockQuotes", true);
@@ -139,8 +139,9 @@
res = (Float) ret;
// System.out.println( symbol + ": " + res );
assertEquals("TestTCPEcho: stock price is 55.25", res.floatValue(), 55.25, 0.000001);
+ System.out.println("Test complete.");
} else {
- throw new Exception("Bad return value from echo test: "+ret);
+ throw new Exception("Bad return value from TCP stock test: "+ret);
}
}
@@ -148,7 +149,7 @@
catch( Exception e ) {
if ( e instanceof AxisFault ) ((AxisFault)e).dump();
e.printStackTrace();
- throw new Exception("Fault returned from echo test: "+e);
+ throw new Exception("Fault returned from TCP stock test: "+e);
}
}
}
1.1 xml-axis/java/test/functional/TestBidBuySample.java
Index: TestBidBuySample.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.functional;
import java.net.*;
import java.io.*;
import java.util.*;
import org.apache.axis.AxisFault ;
import org.apache.axis.client.http.AdminClient;
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.utils.QName ;
import org.apache.axis.encoding.ServiceDescription;
import org.apache.axis.encoding.SOAPTypeMappingRegistry;
import junit.framework.TestCase;
import samples.bidbuy.TestClient;
/** Test the stock sample code.
*/
public class TestBidBuySample extends TestCase {
public TestBidBuySample(String name) {
super(name);
}
public void doTestDeploy () throws Exception {
String[] args = { "samples/bidbuy/deploy.xml" };
new AdminClient().doAdmin(args);
}
public void doTest () throws Exception {
String[] args = { "http://localhost:8080" };
TestClient.main(args);
}
public void testService () throws Exception {
try {
System.out.println("Testing bidbuy sample.");
System.out.println("Testing deployment...");
doTestDeploy();
System.out.println("Testing service...");
doTest();
System.out.println("Test complete.");
}
catch( Exception e ) {
if ( e instanceof AxisFault ) ((AxisFault)e).dump();
e.printStackTrace();
throw new Exception("Fault returned from test: "+e);
}
}
/**
* Read all the contents that are to be read
*/
static void readFully(HttpURLConnection connection) throws IOException
{
// finish reading it to prevent (harmless) server-side exceptions
BufferedInputStream is = new BufferedInputStream(connection.getInputStream());
byte[] buffer = new byte[256];
while((is.read(buffer)) > 0) {}
is.close();
}
}
1.1 xml-axis/java/test/functional/TestMiscSample.java
Index: TestMiscSample.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.functional;
import java.net.*;
import java.io.*;
import java.util.*;
import org.apache.axis.AxisFault ;
import org.apache.axis.client.http.AdminClient;
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.utils.QName ;
import org.apache.axis.encoding.ServiceDescription;
import org.apache.axis.encoding.SOAPTypeMappingRegistry;
import junit.framework.TestCase;
import samples.misc.TestClient;
/** Test the stock sample code.
*/
public class TestMiscSample extends TestCase {
public TestMiscSample(String name) {
super(name);
}
public void doTest () throws Exception {
String[] args = { "-d" };
TestClient.main(args);
}
public void testService () throws Exception {
try {
System.out.println("Testing misc sample.");
System.out.println("Testing service...");
doTest();
System.out.println("Test complete.");
}
catch( Exception e ) {
if ( e instanceof AxisFault ) ((AxisFault)e).dump();
e.printStackTrace();
throw new Exception("Fault returned from test: "+e);
}
}
}
1.1 xml-axis/java/test/functional/TestStockSample.java
Index: TestStockSample.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
*
* Copyright (c) 1999 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution,
* if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowledgment may appear in the software itself,
* if and wherever such third-party acknowledgments normally appear.
*
* 4. The names "Axis" and "Apache Software Foundation" must
* not be used to endorse or promote products derived from this
* software without prior written permission. For written
* permission, please contact apache@apache.org.
*
* 5. Products derived from this software may not be called "Apache",
* nor may "Apache" appear in their name, without prior written
* permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package test.functional;
import java.net.*;
import java.io.*;
import java.util.*;
import org.apache.axis.AxisFault ;
import org.apache.axis.client.http.AdminClient;
import org.apache.axis.utils.Debug ;
import org.apache.axis.utils.Options ;
import org.apache.axis.utils.QName ;
import org.apache.axis.encoding.ServiceDescription;
import org.apache.axis.encoding.SOAPTypeMappingRegistry;
import junit.framework.TestCase;
import samples.stock.GetQuote;
/** Test the stock sample code.
*/
public class TestStockSample extends TestCase {
public TestStockSample(String name) {
super(name);
}
public void doTestStockJWS () throws Exception {
String[] args = { "-uuser1", "-wpass1", "XXX", "-s/axis/StockQuoteService.jws" };
float val = new GetQuote().getQuote(args);
assertEquals("TestStockSample.doTestStockJWS(): stock price is 55.25", val, 55.25, 0.01);
}
public void doTestDeploy () throws Exception {
String[] args = { "samples/stock/deploy.xml" };
new AdminClient().doAdmin(args);
}
public void doTestStock () throws Exception {
String[] args = { "-uuser1", "-wpass1", "XXX" };
float val = new GetQuote().getQuote(args);
assertEquals("TestStockSample.doTestStock(): stock price is 55.25", val, 55.25, 0.01);
}
public void doTestUndeploy () throws Exception {
String[] args = { "samples/stock/undeploy.xml" };
new AdminClient().doAdmin(args);
}
public void testStockService () throws Exception {
try {
System.out.println("Testing stock sample.");
System.out.println("Testing JWS...");
doTestStockJWS();
System.out.println("Testing deployment...");
doTestDeploy();
System.out.println("Testing service...");
doTestStock();
System.out.println("Testing undeployment...");
doTestUndeploy();
System.out.println("Test complete.");
}
catch( Exception e ) {
if ( e instanceof AxisFault ) ((AxisFault)e).dump();
e.printStackTrace();
throw new Exception("Fault returned from test: "+e);
}
}
/**
* Read all the contents that are to be read
*/
static void readFully(HttpURLConnection connection) throws IOException
{
// finish reading it to prevent (harmless) server-side exceptions
BufferedInputStream is = new BufferedInputStream(connection.getInputStream());
byte[] buffer = new byte[256];
while((is.read(buffer)) > 0) {}
is.close();
}
}