diff --git a/examples/wservice/AlignmentClient.java b/examples/wservice/AlignmentClient.java index d1130d0404756a8f70174064ed2e4684c4b5acb0..4694beb785654122fd820eb0b23d41e6e87a7795 100644 --- a/examples/wservice/AlignmentClient.java +++ b/examples/wservice/AlignmentClient.java @@ -78,13 +78,6 @@ public class AlignmentClient { services = new Hashtable(); // Read parameters Properties params = readParameters( args ); - if ( SERVUrl == null ) SERVUrl = "http://" + HOST + ":" + HTML; - SOAPUrl = new URL( SERVUrl + "/aserv" ); - RESTStr = SERVUrl + "/rest" ; - if ( outfile != null ) { - // This redirects error outout to log file given by -o - System.setErr( new PrintStream( outfile ) ); - } if ( debug > 0 ) { System.err.println("***** Parameter parsed"); for ( int i=0; i < args.length; i++ ){ @@ -92,6 +85,13 @@ public class AlignmentClient { } System.err.println(); } + if ( SERVUrl == null ) SERVUrl = "http://" + HOST + ":" + HTML; + SOAPUrl = new URL( SERVUrl + "/aserv" ); + RESTStr = SERVUrl + "/rest" ; + if ( outfile != null ) { + // This redirects error outout to log file given by -o + System.setErr( new PrintStream( outfile ) ); + } // Create the message (SOAP Message or REST URI) String message = createMessage( params ); @@ -179,7 +179,7 @@ public class AlignmentClient { messageBody += " <wsmethod>"+arg4+"</wsmethod>\n"; RESTParams += "¶mn2=wsmethod¶mv2=" + arg4; } - messageBody += " <force>on</force>"; + messageBody += " <force>on</force>"; RESTParams += "&force=on"; //we do not need this command from WS client } else if ( cmd.equals("align" ) ) { @@ -295,13 +295,42 @@ public class AlignmentClient { // Create input message or URL String message; if ( rest ) { - message = RESTAction + "?" + RESTParams; + message = RESTAction + "?" + RESTParams + addParams( params ); } else { - message = messageBody; + message = messageBody+addParams( params ); } return message; } + public String addParams( Properties params ){ + String opt = ""; + int i = 5; + for ( Object ko : params.keySet() ){ + String k = (String)ko; + if ( !k.startsWith("arg") && !k.equals("host") && !k.equals("debug") && !k.equals("command") ) { + if ( rest ) { + opt += "¶mn"+i+"="+k+"¶mv"+i+"="+params.getProperty(k); + i++; + } else { + opt += " <param name=\""+k+"\">"+params.getProperty(k)+"</param>\n"; + // opt += " <"+k+">"+params.getProperty(k)+"</"+k+">\n"; + } + } + } + return opt; + } + + public String addSOAPParams( Properties params ){ + String opt = ""; + for ( Object ko : params.keySet() ){ + String k = (String)ko; + if ( !k.startsWith("arg") ) { + } + } + return opt; + } + + public HttpURLConnection sendRESTMessage( String message, Properties param ) throws Exception { URL RESTUrl = null; URLConnection connection = null;