X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FSOAP.java;h=190d8b4f4b4e2b104b4beeeed04900a6dc29c15e;hb=ba12823b3146d9d228c7a4b1c02ae94de9e02781;hp=5b969b4a0197dc3b77b529b3bbf79684dbea5a35;hpb=55c3195af733f3de6b7894f4c4a96f7b50f58c11;p=org.ibex.core.git diff --git a/src/org/xwt/SOAP.java b/src/org/xwt/SOAP.java index 5b969b4..190d8b4 100644 --- a/src/org/xwt/SOAP.java +++ b/src/org/xwt/SOAP.java @@ -29,7 +29,7 @@ class SOAP extends XMLRPC { /** When you get a property from an SOAP, it just returns another SOAP with the property name tacked onto methodname. */ public Object get(String name) { - return new SOAP(url.toString(), (methodname.equals("") ? "" : methodname + ".") + name, http, action, nameSpace); + return new SOAP(url.toString(), (method.equals("") ? "" : method + ".") + name, http, action, nameSpace); } @@ -41,9 +41,9 @@ class SOAP extends XMLRPC { if (name.equals("SOAP-ENV:Envelope")) return; if (name.equals("SOAP-ENV:Body")) return; if (name.equals("SOAP-ENV:Fault")) fault = true; - + // add a generic struct; we'll change this if our type is different - objects.addElement(new JS.Obj()); + objects.addElement(new JS()); for(int i=0; io to sb */ - void appendObject(String name, Object o, StringBuffer sb) throws JS.Exn { + void appendObject(String name, Object o, StringBuffer sb) throws JSExn { if (o instanceof Number) { if ((double)((Number)o).intValue() == ((Number)o).doubleValue()) { sb.append(" <" + name + " xsi:type=\"xsd:int\">"); @@ -179,11 +181,10 @@ class SOAP extends XMLRPC { sb.append(((Boolean)o).booleanValue() ? "true" : "false"); sb.append("\r\n"); - /* FIXME - } else if (o instanceof ByteStream) { + } else if (o instanceof Res) { try { sb.append(" <" + name + " xsi:type=\"SOAP-ENC:base64\">\r\n"); - InputStream is = ((ByteStream)o).getInputStream(); + InputStream is = ((Res)o).getInputStream(); byte[] buf = new byte[54]; while(true) { int numread = is.read(buf, 0, 54); @@ -202,9 +203,9 @@ class SOAP extends XMLRPC { } catch (IOException e) { if (Log.on) Log.log(this, "caught IOException while attempting to send a ByteStream via SOAP"); if (Log.on) Log.log(this, e); - throw new JS.Exn("caught IOException while attempting to send a ByteStream via SOAP"); + throw new JSExn("caught IOException while attempting to send a ByteStream via SOAP"); } - */ + } else if (o instanceof String) { sb.append(" <" + name + " xsi:type=\"xsd:string\">"); String s = (String)o; @@ -224,8 +225,8 @@ class SOAP extends XMLRPC { } sb.append("\r\n"); - } else if (o instanceof JS.Array) { - JS.Array a = (JS.Array)o; + } else if (o instanceof JSArray) { + JSArray a = (JSArray)o; sb.append(" <" + name + " SOAP-ENC:arrayType=\"xsd:ur-type[" + a.length() + "]\">"); for(int i=0; i\r\n"); @@ -233,13 +234,17 @@ class SOAP extends XMLRPC { } else if (o instanceof JS) { JS j = (JS)o; sb.append(" <" + name + ">"); - Object[] ids = j.keys(); - for(int i=0; i\r\n"); + } } - protected String send(JS.Array args, HTTP http) throws JS.Exn, IOException { + protected String buildRequest(JSArray args) throws JSExn, IOException { // build up the request StringBuffer content = new StringBuffer(); content.append("SOAPAction: " + action + "\r\n\r\n"); @@ -251,19 +256,23 @@ class SOAP extends XMLRPC { content.append(" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\">\r\n"); content.append("\r\n"); content.append(" <"); - content.append(methodname); + content.append(method); content.append(nameSpace != null ? " xmlns=\"" + nameSpace + "\"" : ""); content.append(">\r\n"); if (args.length() > 0) { - Object[] o = ((JS)args.elementAt(0)).keys(); - for(int i=0; i\r\n"); + content.append(" \r\n"); return content.toString(); } - SOAP(String url, String methodname, String action, String nameSpace) { this(url, methodname, new HTTP(url), action, nameSpace); } + SOAP(String url, String methodname, String action, String nameSpace) { + this(url, methodname, new HTTP(url), action, nameSpace); + } SOAP(String url, String methodname, HTTP http, String action, String nameSpace) { super(url, methodname, http); this.action = action;