-// FIXME
-// Copyright 2003 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
package org.xwt;
import java.io.*;
* <li> WSDL support
* </ul>
*/
-class SOAP /*extends XMLRPC*/ {
- /*
- /&* the desired content of the SOAPAction header &/
+class SOAP extends XMLRPC {
+
+ /** the desired content of the SOAPAction header */
String action = null;
- /&* the namespace to use &/
+ /** the namespace to use */
String nameSpace = null;
- /&* When you get a property from an SOAP, it just returns another SOAP with the property name tacked onto methodname. &/
+ /** 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);
}
} else if (me instanceof byte[]) {
objects.removeElementAt(objects.size() - 1);
- objects.addElement(new Res.ByteArray(Base64.decode(new String(content.getBuf(), 0, content.size())), null));
+ objects.addElement(new Stream.ByteArray(Base64.decode(new String(content.getBuf(), 0, content.size())), null));
content.reset();
} else if (me instanceof Integer) {
}
- /&* Appends the SOAP representation of <code>o</code> to <code>sb</code> &/
+ /** Appends the SOAP representation of <code>o</code> to <code>sb</code> */
void appendObject(String name, Object o, StringBuffer sb) throws JSExn {
if (o instanceof Number) {
if ((double)((Number)o).intValue() == ((Number)o).doubleValue()) {
sb.append(((Boolean)o).booleanValue() ? "true" : "false");
sb.append("</" + name + ">\r\n");
- } else if (o instanceof Res) {
+ } else if (o instanceof Stream) {
try {
sb.append(" <" + name + " xsi:type=\"SOAP-ENC:base64\">\r\n");
- InputStream is = ((Res)o).getInputStream();
+ InputStream is = ((Stream)o).getInputStream();
byte[] buf = new byte[54];
while(true) {
int numread = is.read(buf, 0, 54);
sb.append(((Boolean)o).booleanValue() ? "1" : "0");
sb.append("</" + name + ">\r\n");
} 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);
+ if (Log.on) Log.info(this, "caught IOException while attempting to send a ByteStream via SOAP");
+ if (Log.on) Log.info(this, e);
throw new JSExn("caught IOException while attempting to send a ByteStream via SOAP");
}
}
}
- protected String send(JSArray args, HTTP http) throws JSExn, 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");
content.append(" xmlns:xsi=\"http://www.w3.org/1999/XMLSchema-instance\">\r\n");
content.append("<SOAP-ENV:Body>\r\n");
content.append(" <");
- content.append(methodname);
+ content.append(method);
content.append(nameSpace != null ? " xmlns=\"" + nameSpace + "\"" : "");
content.append(">\r\n");
if (args.length() > 0) {
appendObject((String)key, ((JS)args.elementAt(0)).get(key), content);
}
}
- content.append(" </" + methodname + "></SOAP-ENV:Body></SOAP-ENV:Envelope>\r\n");
+ content.append(" </" + method + "></SOAP-ENV:Body></SOAP-ENV:Envelope>\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;
this.nameSpace = nameSpace;
}
-*/
+
}