}
}
- protected Object send(Object[] args, BufferedReader br, PrintWriter ps) throws IOException, JavaScriptException {
-
+ protected String send(Object[] args, HTTP http) throws JavaScriptException, IOException {
// build up the request
StringBuffer content = new StringBuffer();
content.append("<?xml version=\"1.0\"?>\n");
appendObject(o[i].toString(), ((Scriptable)args[0]).get(o[i].toString(), (Scriptable)args[0]), content);
}
content.append(" </" + methodname + "></SOAP-ENV:Body></SOAP-ENV:Envelope>");
-
- // send it
- ps.print("POST " + filename + " HTTP/1.0\r\n");
- ps.print("Host: " + host + "\r\n");
- ps.print("User-Agent: XWT (http://www.xwt.org/)\r\n");
- ps.print("Content-Type: text/xml; charset=\"us-ascii\"\r\n");
- ps.print("Content-length: " + (content.length() + 1) + "\r\n");
- ps.print("SOAPAction: " + (action == null ? filename : action) + "\r\n");
- ps.print("\r\n");
- ps.print(content);
- ps.print("\n");
- ps.flush();
-
- // throw away HTTP reply headers
- while(!br.readLine().equals("")) { }
-
- // parse XML reply
- try {
- parse(br);
- } catch (XML.SAXException e) {
- if (Log.on) Log.log(this, "reply from server was not well-formed XML: " + e);
- throw new JavaScriptException("reply from server was not well-formed XML: " + e);
- }
-
- if (fault) throw new JavaScriptException((Scriptable)objects.elementAt(0));
- if (objects.size() == 0) return null;
- return objects.elementAt(0);
+ http.addHeader("SOAPAction", action);
+ return content.toString();
}
- SOAP(String urlstr, String methodname, String action, String nameSpace) {
- super(urlstr, methodname);
+ SOAP(String url, String methodname, String action, String nameSpace) {
+ super(url, methodname);
this.action = action;
this.nameSpace = nameSpace;
}