diff --git a/examples/wservice/AlignmentClient.java b/examples/wservice/AlignmentClient.java
new file mode 100644
index 0000000000000000000000000000000000000000..80f8ede49d3a6b4a4c722a7b7c28b83733845beb
--- /dev/null
+++ b/examples/wservice/AlignmentClient.java
@@ -0,0 +1,422 @@
+/*
+ * $Id: AlignmentClient.java 522 2007-07-18 09:08:08Z euzenat $
+ *
+ * Copyright (C) INRIA Rhône-Alpes, 2007.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/** 
+ * Example of connection to the Alignment Server through  HTTP/SOAP 
+ * Inspired from SOAPClient4XG by Bob DuCharme
+ * $Id: Client.java 521 2007-07-18 09:02:04Z euzenat $
+ *
+*/
+
+import fr.inrialpes.exmo.align.impl.BasicParameters;
+
+import fr.inrialpes.exmo.align.util.NullStream;
+
+import org.semanticweb.owl.align.Parameters;
+
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.io.PrintStream;
+import java.io.File;
+import java.io.*;
+import java.net.*;
+
+import gnu.getopt.LongOpt;
+import gnu.getopt.Getopt;
+
+
+public class AlignmentClient {
+
+
+    public static final String //Port Strings
+	HTML = "8089",
+	WSDL = "7777";
+
+    public static final String //IP Strings
+	HOST = "localhost";
+
+    private int debug = 0;
+    private String filename = null;
+    private String outfile = null;
+    private String paramfile = null;
+    private Hashtable services = null;
+
+    private URL SOAPUrl = null;
+    private String SOAPAction = null;
+
+    public static void main(String[] args) {
+	try { new AlignmentClient().run( args ); }
+	catch ( Exception ex ) { ex.printStackTrace(); };
+    }
+    
+    public void run(String[] args) throws Exception {
+	services = new Hashtable();
+	// Read parameters
+	Parameters params = readParameters( args );
+	if ( outfile != null ) {
+	    // This redirects error outout to log file given by -o
+	    System.setErr( new PrintStream( outfile ) );
+	}
+	// JE//: Should not be correct.
+	SOAPUrl = new URL( "http://" + HOST + ":" + HTML + "/aserv" );
+	if ( debug > 0 ) {
+	    System.err.println("***** Parameter parsed");
+	    for ( int i=0; i < args.length; i++ ){
+		System.err.print( args[i]+" / " );
+	    }
+	    System.err.println();
+	}
+	// Create the SOAP message
+	String message = createMessage( params );
+	if ( debug > 1 ){
+	    System.err.print("***** Send to "+SOAPUrl+" :: "+SOAPAction);
+	    System.err.println("==>");
+	    System.err.println(message);
+	    System.err.println();
+	}
+	// Send message
+	String answer = sendMessage( message, params );
+	if ( debug > 1 ){
+	    System.err.println("***** Received ==>");
+	    System.err.println(answer);
+	    System.err.println();
+	}
+	// Displays it
+	displayAnswer( answer );
+    }
+
+    public String createMessage( Parameters params ) throws Exception {
+        String messageBegin = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\'http://schemas.xmlsoap.org/soap/envelope/\' " +
+			                  "xmlns:xsi=\'http://www.w3.org/1999/XMLSchema-instance\' " + 
+			                  "xmlns:xsd=\'http://www.w3.org/1999/XMLSchema\'>" +
+			                  "<SOAP-ENV:Body>";
+	String messageBody = "";
+	String cmd = (String)params.getParameter( "command" );
+	if ( cmd.equals("list" ) ) {
+	    String arg = (String)params.getParameter( "arg1" );
+	    if ( arg.equals("methods" ) ){
+		SOAPAction = "listmethods";
+	    } else if ( arg.equals("renderers" ) ){
+		SOAPAction = "listrenderers";
+	    } else if ( arg.equals("services" ) ){
+		SOAPAction = "listservices";
+	    } else if ( arg.equals("alignments" ) ){
+		SOAPAction = "listalignments";
+	    } else {
+		usage();
+		System.exit(-1);
+	    }
+	} else if ( cmd.equals("wsdl" ) ) {
+	    SOAPAction = "wsdl";
+	} else if ( cmd.equals("find" ) ) {
+	    SOAPAction = "find";
+	    String uri1 = (String)params.getParameter( "arg1" );
+	    String uri2 = (String)params.getParameter( "arg2" );
+	    if ( uri2 == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    messageBody = "<uri1>"+uri1+"</uri1><uri2>"+uri2+"</uri2>";
+	} else if ( cmd.equals("match" ) ) {
+	    SOAPAction = "align";
+	    String uri1 = (String)params.getParameter( "arg1" );
+	    String uri2 = (String)params.getParameter( "arg2" );
+	    if ( uri2 == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    String method = null;
+	    String arg3 = (String)params.getParameter( "arg3" );
+	    if ( arg3 != null ) {
+		method = uri1; uri1 = uri2; uri2 = arg3;
+	    }
+	    arg3 = (String)params.getParameter( "arg4" );
+	    messageBody = "<url1>"+uri1+"</url1><url2>"+uri2+"</url2>";
+	    if ( method != null )
+		messageBody += "<method>"+method+"</method>";
+	    //fr.inrialpes.exmo.align.impl.method.SubsDistNameAlignment
+	    if ( arg3 != null )
+		messageBody += "<force>"+arg3+"</force>";
+	} else if ( cmd.equals("trim" ) ) {
+	    SOAPAction = "cut";
+	    String id = (String)params.getParameter( "arg1" );
+	    String thres = (String)params.getParameter( "arg2" );
+	    if ( thres == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    String method = null;
+	    String arg3 = (String)params.getParameter( "arg3" );
+	    if ( arg3 != null ) {
+		method = thres; thres = arg3;
+	    }
+	    messageBody = "<id>"+id+"</id><threshold>"+thres+"</threshold>";
+	    if ( method != null )
+		messageBody += "<method>"+method+"</method>";
+	} else if ( cmd.equals("invert" ) ) {
+	    SOAPAction = "invert";
+	    String uri = (String)params.getParameter( "arg1" );
+	    if ( uri == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    messageBody = "<id>"+uri+"</id>";
+	} else if ( cmd.equals("store" ) ) {
+	    SOAPAction = "store";
+	    String uri = (String)params.getParameter( "arg1" );
+	    if ( uri == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    messageBody = "<id>"+uri+"</id>";
+	} else if ( cmd.equals("load" ) ) {
+	    SOAPAction = "load";
+	    String url = (String)params.getParameter( "arg1" );
+	    if ( url == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    messageBody = "<url>"+url+"</url>";
+	    /* This may read the input stream!
+			// Most likely Web service request
+			int length = request.getContentLength();
+			char [] mess = new char[length+1];
+			try { 
+			    new BufferedReader(new InputStreamReader(request.getInputStream())).read( mess, 0, length);
+			} catch (Exception e) {
+			    e.printStackTrace(); // To clean up
+			}
+			params.setProperty( "content", new String( mess ) );
+	    */
+	    /* Or even better:
+	    BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
+	    String line;
+	    while ((line = in.readLine()) != null) {
+		wsdlSpec += line + "\n";
+	    }
+	    if (in != null) in.close();
+	     */
+	} else if ( cmd.equals("retrieve" ) ) {
+	    SOAPAction = "retrieve";
+	    String uri = (String)params.getParameter( "arg1" );
+	    String method = (String)params.getParameter( "arg2" );
+	    if ( method == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    messageBody = "<id>"+uri+"</id><method>"+method+"</method>";
+	} else if ( cmd.equals("metadata" ) ) {
+	    SOAPAction = "metadata";
+	    String uri = (String)params.getParameter( "arg1" );
+	    String key = (String)params.getParameter( "arg2" );
+	    if ( key == null ){
+		usage();
+		System.exit(-1);
+	    }
+	    messageBody = "<id>"+uri+"</id><key>"+key+"</key>";
+	} else {
+	    usage();
+	    System.exit(-1);
+	}
+	// Create input message and URL
+	String messageEnd = "</SOAP-ENV:Body>"+"</SOAP-ENV:Envelope>";
+	String message = messageBegin + messageBody + messageEnd;
+	return message;
+    }
+        
+    public String sendMessage( String message, Parameters param ) throws Exception {
+	// Create the connection
+        URLConnection connection = SOAPUrl.openConnection();
+        HttpURLConnection httpConn = (HttpURLConnection) connection;
+
+        byte[] b = message.getBytes();
+
+	// Create HTTP Request
+        httpConn.setRequestProperty( "Content-Length",
+                                     String.valueOf( b.length ) );
+        httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
+	httpConn.setRequestProperty("SOAPAction",SOAPAction);
+        httpConn.setRequestMethod( "POST" );
+        httpConn.setDoOutput(true);
+        httpConn.setDoInput(true);
+
+        // Send the request through the connection
+        OutputStream out = httpConn.getOutputStream();
+        out.write( b );    
+        out.close();
+
+        // Read the response and write it to standard output
+        InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
+        BufferedReader in = new BufferedReader(isr);
+	String answer = "";
+	String line;
+	while ((line = in.readLine()) != null) {
+	    answer += line + "\n";
+	}
+	if (in != null) in.close();
+
+	return answer;
+    }
+    public Parameters readParameters( String[] args ) {
+	Parameters params = new BasicParameters();
+
+	params.setParameter( "host", HOST );
+
+	// Read parameters
+
+	LongOpt[] longopts = new LongOpt[16];
+	// General parameters
+	longopts[0] = new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'h');
+	longopts[1] = new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o');
+	longopts[2] = new LongOpt("debug", LongOpt.OPTIONAL_ARGUMENT, null, 'd');
+	longopts[3] = new LongOpt("impl", LongOpt.REQUIRED_ARGUMENT, null, 'l');
+	longopts[4] = new LongOpt("D", LongOpt.REQUIRED_ARGUMENT, null, 'D');
+	// Service parameters
+	longopts[5] = new LongOpt("html", LongOpt.OPTIONAL_ARGUMENT, null, 'H');
+	longopts[6] = new LongOpt("jade", LongOpt.OPTIONAL_ARGUMENT, null, 'A');
+	longopts[7] = new LongOpt("wsdl", LongOpt.OPTIONAL_ARGUMENT, null, 'W');
+	longopts[8] = new LongOpt("jxta", LongOpt.OPTIONAL_ARGUMENT, null, 'P');
+	// DBMS Server parameters
+	longopts[9] = new LongOpt("dbmshost", LongOpt.REQUIRED_ARGUMENT, null, 'm');
+	longopts[10] = new LongOpt("dbmsport", LongOpt.REQUIRED_ARGUMENT, null, 's');
+	longopts[11] = new LongOpt("dbmsuser", LongOpt.REQUIRED_ARGUMENT, null, 'u');
+	longopts[12] = new LongOpt("dbmspass", LongOpt.REQUIRED_ARGUMENT, null, 'p');
+	longopts[13] = new LongOpt("dbmsbase", LongOpt.REQUIRED_ARGUMENT, null, 'b');
+	longopts[14] = new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'S');
+	longopts[15] = new LongOpt("serv", LongOpt.REQUIRED_ARGUMENT, null, 'i');
+	// Is there a way for that in LongOpt ???
+
+	Getopt g = new Getopt("", args, "ho:S:l:d::D:H::A::W::P::m:s:u:p:b:i:", longopts);
+	int c;
+	String arg;
+
+	while ((c = g.getopt()) != -1) {
+	    switch (c) {
+	    case 'h' :
+		usage();
+		System.exit(0);
+	    case 'o' :
+		/* Use filename instead of stdout */
+		outfile = g.getOptarg();
+		break;
+	    case 'd' :
+		/* Debug level  */
+		arg = g.getOptarg();
+		if ( arg != null ) debug = Integer.parseInt(arg.trim());
+		else debug = 4;
+		break;
+	    case 'H' :
+		/* HTTP Server + port */
+		arg = g.getOptarg();
+		if ( arg != null ) {
+		    params.setParameter( "http", arg );
+		} else {
+		    params.setParameter( "http", HTML );
+		}
+		// This shows that it does not work
+		services.put( "fr.inrialpes.exmo.align.service.HTMLAServProfile", params.getParameter( "http" ) );
+		break;
+	    case 'W' :
+		/* Web service + port */
+		arg = g.getOptarg();
+		if ( arg != null ) {
+		    params.setParameter( "wsdl", arg );
+		} else {
+		    params.setParameter( "wsdl", WSDL );
+		}		    
+		break;
+	    case 'S' :
+		/* Server */
+		params.setParameter( "host", g.getOptarg() );
+		break;
+	    case 'D' :
+		/* Parameter definition */
+		arg = g.getOptarg();
+		int index = arg.indexOf('=');
+		if ( index != -1 ) {
+		    params.setParameter( arg.substring( 0, index), 
+					 arg.substring(index+1));
+		} else {
+		    System.err.println("Bad parameter syntax: "+g);
+		    usage();
+		    System.exit(0);
+		    
+		}
+		break;
+	    }
+	}
+	
+	if (debug > 0) {
+	    params.setParameter("debug", new Integer(debug));
+	} else if ( params.getParameter("debug") != null ) {
+	    debug = Integer.parseInt((String)params.getParameter("debug"));
+	}
+
+	// Store the remaining arguments in param
+	int i = g.getOptind();
+	if ( args.length < i + 1 ){
+	    usage();
+	    System.exit(-1);
+	} else {
+	    params.setParameter("command", args[i++]);
+	    for ( int k = 1; i < args.length; i++,k++ ){
+		params.setParameter("arg"+k, args[i]);
+	    }
+	}
+	return params;
+    }
+
+    public void displayAnswer( String answer ) {
+	// Printout to be improved...
+	System.out.println( answer );
+    }
+    // Really missing:
+    // OUTPUT(o): what for, there is no output (maybe LOGS)
+    // LOAD(l): good idea, load from file, but what kind? sql?
+    // PARAMS(p is taken, P is taken): yes good as well to read parameters from file
+    public void usage() {
+	System.err.println("usage: AlignmentClient [options] command [args]");
+	System.err.println("options are:");
+	System.err.println("\t--html[=port] -H[port]\t\t\tLaunch HTTP service");
+	System.err.println("\t--wsdl[=port] -W[port]\t\t\tLaunch Web service");
+	System.err.println("\t--output=filename -o filename\tRedirect output to filename");
+	System.err.println("\t--debug[=n] -d[n]\t\tReport debug info at level n");
+	System.err.println("\t-Dparam=value\t\t\tSet parameter");
+	System.err.println("\t--help -h\t\t\tPrint this message");
+	System.err.println();
+	System.err.println("commandss are:");
+	System.err.println("\twsdl");
+	System.err.println("\tfind URI URI");
+	System.err.println("\tmatch URI URI");
+	System.err.println("\ttrim AURI [method] threshold");
+	System.err.println("\tinvert AURI");
+	System.err.println("\tload URI | File");
+	System.err.println("\tstore AURI");
+	System.err.println("\tretrieve AURI");
+	//	System.err.println("\tmetadata AURI key");
+	System.err.println("\tlist alignments");
+	System.err.println("\tlist method");
+	System.err.println("\tlist renderers");
+	System.err.println("\tlist services");
+	System.err.println("\n$Id$\n");
+    }
+    
+}
+
diff --git a/examples/wservice/Client.java b/examples/wservice/Client.java
deleted file mode 100644
index 0d54cf8f9962a83a8b779c7b087cc2b306c3ad41..0000000000000000000000000000000000000000
--- a/examples/wservice/Client.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/** 
- * Example of connection to the Alignment Server through  HTTP/SOAP 
- * Inspired from SOAPClient4XG by Bob DuCharme
- * $Id$
- *
-*/
-
-import java.io.*;
-import java.net.*;
-
-public class Client {
-    public static void main(String[] args) throws Exception {
-        String SOAPUrl      = "http://localhost:8089/aserv";
-        String MessageBegin = "<SOAP-ENV:Envelope xmlns:SOAP-ENV=\'http://schemas.xmlsoap.org/soap/envelope/\' " +
-			                  "xmlns:xsi=\'http://www.w3.org/1999/XMLSchema-instance\' " + 
-			                  "xmlns:xsd=\'http://www.w3.org/1999/XMLSchema\'> " +
-			                  "<SOAP-ENV:Body>";
-	// Create input message and URL
-	String SOAPAction = "align";  // define the specific action name
-	//String SOAPAction = "listmethods";  // define the specific action name
-	String MessageBody = "<url1>http://alignapi.gforge.inria.fr/tutorial/myOnto.owl</url1>" +  // defind the profer argument for the specific action name
-	    "<url2>http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl</url2>" +
-	    "<method>fr.inrialpes.exmo.align.impl.method.SubsDistNameAlignment</method>" +
-	    "<force>false</force>";
-	String MessageEnd = "</SOAP-ENV:Body> "+"</SOAP-ENV:Envelope>";
-
-	String Message = MessageBegin + MessageBody + MessageEnd;
-        // Create the connection where we're going to send the file.
-        
-	System.out.println("Send to "+SOAPUrl+" :: "+SOAPAction);
-	System.out.println("==>");
-	System.out.println(Message);
-	System.out.println("");
-
-	// Create the connection
-	URL url = new URL(SOAPUrl);
-        URLConnection connection = url.openConnection();
-        HttpURLConnection httpConn = (HttpURLConnection) connection;
-
-        byte[] b = Message.getBytes();
-
-	// Create HTTP Request
-        httpConn.setRequestProperty( "Content-Length",
-                                     String.valueOf( b.length ) );
-        httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
-	httpConn.setRequestProperty("SOAPAction",SOAPAction);
-        httpConn.setRequestMethod( "POST" );
-        httpConn.setDoOutput(true);
-        httpConn.setDoInput(true);
-
-        // Send the request through the connection
-        OutputStream out = httpConn.getOutputStream();
-        out.write( b );    
-        out.close();
-
-        // Read the response and write it to standard output
-        InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());
-        BufferedReader in = new BufferedReader(isr);
-        String inputLine = in.readLine();
-	//       while ((inputLine = in.readLine()) != null)
-        System.out.println("Receive ==>");
-	System.out.println(inputLine);
-
-        in.close();
-    }
-}
-
diff --git a/examples/wservice/README.TXT b/examples/wservice/README.TXT
index c59f3c1c079619796ef4a1b496df0a21f7f33ed6..c5a91246fa7f30b8c6d6d1c909663d4f123dceb8 100644
--- a/examples/wservice/README.TXT
+++ b/examples/wservice/README.TXT
@@ -2,30 +2,44 @@ Examples for AlignmentServer web service communication.
 
 # $Id$
 
-This directory contains an example of connecting to the Alignment Server through web services.
-It is rudimentary and minimal... but works.
+This directory contains an example of connecting to the
+Alignment Server through web services.
+
+-------------------------------------
+CLIENT INVOKATION
+
+java AlignmentClient keyword [genoptions] [options]
+genoptions:
+	-d [num]	 debug level
+	-h 		 hostname
+	-q		 quiet
+
+java AlignmentClient wsdl			-> XML
+     => Find the WSDL file from the path
+java AlignmentClient find URI URI		-> AURI
+java AlignmentClient match [method] URI URI	-> AURI
+     -> CleanUp reception (err messages)
+java AlignmentClient trim [method] AURI float	-> AURI
+java AlignmentClient invert AURI		-> AURI
+java AlignmentClient load URI | <stdin>		-> AURI
+     => finir la partie stdin
+java AlignmentClient store AURI 		-> AURI
+java AlignmentClient retrieve AURI method	-> XML
+       => embed a <?xml ...>
+       => not always XML
+//-java AlignmentClient metadata AURI key	-> XML
+
+java AlignmentClient list alignments		-> XML
+java AlignmentClient list method		-> XML
+java AlignmentClient list renderers		-> XML
+java AlignmentClient list services		-> XML
 
 ----------------------------------
 USE
 
-$ javac Client
+$ javac -cp .:../../lib/procalign.jar AlignmentClient.java
 
-$ java Client
-Send to http://localhost:8089/aserv :: align
-==>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance' xmlns:xsd='http://www.w3.org/1999/XMLSchema'> <SOAP-ENV:Body><url1>http://alignapi.gforge.inria.fr/tutorial/myOnto.owl</url1><url2>http://alignapi.gforge.inria.fr/tutorial/edu.mit.visus.bibtex.owl</url2><method>fr.inrialpes.exmo.align.impl.method.SubsDistNameAlignment</method><force>false</force></SOAP-ENV:Body> </SOAP-ENV:Envelope>
+$ java -cp .:../../lib/procalign.jar AlignmentClient match file:///Java/alignapi/html/tutorial/myOnto.owl file:///Java/alignapi/html/tutorial/myOnto.owl
+<SOAP-ENV:Envelope   xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'   xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'   xmlns:xsd='http://www.w3.org/1999/XMLSchema'>  <SOAP-ENV:Body><id>1</id><sender>http://localhost:8089</sender><receiver>LocalHTMLInterface</receiver><in-reply-to>fr.inrialpes.exmo.align.service.Message@dd3d1b</in-reply-to><content>http://localhost:8089/alid/1186044903591/898</content>  </SOAP-ENV:Body></SOAP-ENV:Envelope>
 
-Receive ==>
-<SOAP-ENV:Envelope   xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/'   xmlns:xsi='http://www.w3.org/1999/XMLSchema-instance'   xmlns:xsd='http://www.w3.org/1999/XMLSchema'>  <SOAP-ENV:Body><id>0</id><sender>http://localhost:8089</sender><receiver>LocalHTMLInterface</receiver><in-reply-to>fr.inrialpes.exmo.align.service.Message@ce3388</in-reply-to><content>http://localhost:8089/alid/1181763377472/560</content>  </SOAP-ENV:Body></SOAP-ENV:Envelope>
-
-------------------------------------
-FILES
-
-SOAPClient4XG.java
-	-> a minimal SOAP client for sending messages
-soap-example.xml
-	-> a sample Soap message for the previous client
-Client.java
-	-> a more adapted Client to the AlignmentServer
-Sympa.wsdl
 
diff --git a/examples/wservice/SOAPClient4XG.java b/examples/wservice/SOAPClient4XG.java
deleted file mode 100644
index eef383b5d6e0c85b544d3382b9e5ccc89ebe2f65..0000000000000000000000000000000000000000
--- a/examples/wservice/SOAPClient4XG.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/** 
- * SOAPClient4XG. Read the SOAP envelope file passed as the second
- * parameter, pass it to the SOAP endpoint passed as the first parameter, and
- * print out the SOAP envelope passed as a response.  with help from Michael
- * Brennan 03/09/01
- * 
- * java SOAPClient4XG http://services.xmethods.net:80/soap/servlet/rpcrouter weatherreq.xml
- *
- * @author  Bob DuCharme
- * @version 1.1
- * @param   SOAPUrl      URL of SOAP Endpoint to send request.
- * @param   xmlFile2Send A file with an XML document of the request.  
- *
- * 5/23/01 revision: SOAPAction added
-*/
-
-import java.io.*;
-import java.net.*;
-
-public class SOAPClient4XG {
-    public static void main(String[] args) throws Exception {
-
-        if (args.length  < 2) {
-            System.err.println("Usage:  java SOAPClient4XG " +
-                               "http://soapURL soapEnvelopefile.xml" +
-                               " [SOAPAction]");
-				System.err.println("SOAPAction is optional.");
-            System.exit(1);
-        }
-
-        String SOAPUrl      = args[0];
-        String xmlFile2Send = args[1];
-
-		  String SOAPAction = "";
-        if (args.length  > 2) 
-				SOAPAction = args[2];
-				
-        // Create the connection where we're going to send the file.
-        URL url = new URL(SOAPUrl);
-        URLConnection connection = url.openConnection();
-        HttpURLConnection httpConn = (HttpURLConnection) connection;
-
-        // Open the input file. After we copy it to a byte array, we can see
-        // how big it is so that we can set the HTTP Cotent-Length
-        // property. (See complete e-mail below for more on this.)
-
-        FileInputStream fin = new FileInputStream(xmlFile2Send);
-
-        ByteArrayOutputStream bout = new ByteArrayOutputStream();
-    
-        // Copy the SOAP file to the open connection.
-        copy(fin,bout);
-        fin.close();
-
-        byte[] b = bout.toByteArray();
-
-        // Set the appropriate HTTP parameters.
-        httpConn.setRequestProperty( "Content-Length",
-                                     String.valueOf( b.length ) );
-        httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
-		  httpConn.setRequestProperty("SOAPAction",SOAPAction);
-        httpConn.setRequestMethod( "POST" );
-        httpConn.setDoOutput(true);
-        httpConn.setDoInput(true);
-
-        // Everything's set up; send the XML that was read in to b.
-        OutputStream out = httpConn.getOutputStream();
-        out.write( b );    
-        out.close();
-
-        // Read the response and write it to standard out.
-
-        InputStreamReader isr =
-            new InputStreamReader(httpConn.getInputStream());
-        BufferedReader in = new BufferedReader(isr);
-
-        String inputLine;
-
-        while ((inputLine = in.readLine()) != null)
-            System.out.println(inputLine);
-
-        in.close();
-    }
-
-  // copy method from From E.R. Harold's book "Java I/O"
-  public static void copy(InputStream in, OutputStream out) 
-   throws IOException {
-
-    // do not allow other threads to read from the
-    // input or write to the output while copying is
-    // taking place
-
-    synchronized (in) {
-      synchronized (out) {
-
-        byte[] buffer = new byte[256];
-        while (true) {
-          int bytesRead = in.read(buffer);
-          if (bytesRead == -1) break;
-          out.write(buffer, 0, bytesRead);
-        }
-      }
-    }
-  } 
-}
-