/** 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, Scriptable start) {
- return new SOAP(url.toString(), (methodname.equals("") ? "" : methodname + ".") + name, action, nameSpace);
+ return new SOAP(url.toString(), (methodname.equals("") ? "" : methodname + ".") + name, http, action, nameSpace);
}
protected String send(Object[] args, HTTP http) throws JavaScriptException, IOException {
// build up the request
StringBuffer content = new StringBuffer();
+ content.append("SOAPAction: " + action + "\r\n\r\n");
content.append("<?xml version=\"1.0\"?>\n");
content.append("<SOAP-ENV:Envelope SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\"\n");
content.append(" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"\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>");
- http.addHeader("SOAPAction", action);
return content.toString();
}
- SOAP(String url, String methodname, String action, String nameSpace) {
- super(url, methodname);
+ 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;
}