public class SoapCall
{
// Holds Body of request.
String body;
// Holds Envelope Header attributes.
StringBuffer sh;
// Holds complete request (Header + Body).
StringBuffer req;
// Constructor with boolean argument
// for old @1999 SOAP Schema enviornment
public SoapCall (boolean schema99 )
{
req = new StringBuffer();
sh = new StringBuffer();
sh.append
("<?xml version=\'1.0\' " +
"encoding=\'UTF-8\'?>\r\n");
sh.append("<SOAP-ENV:Envelope");
sh.append("\r\n");
sh.append
(" xmlns:xsi=\"+
""http://www.w3.org/1999/XMLSchema-instance\" ");
sh.append("\r\n");
sh.append(" xmlns:SOAP-ENV=\" +
""http://schemas.xmlsoap.org/soap/envelope/\" ");
sh.append("\r\n");
sh.append(" " +
"xmlns:xsd=\"http://www.w3.org/1999/XMLSchema\">");
sh.append("\r\n");
sh.append(" SOAP-ENV:encodingStyle=\" + ""http://schemas.xmlsoap.org/soap/encoding\">");
sh.append("\r\n");
sh.append(" <SOAP-ENV:Body>");
sh.append("\r\n");
req.append(sh.toString());
}//soapCall().
// Constructor without argument
// for new @2001 SOAP Schema enviornment
public SoapCall()
{
req = new StringBuffer();
sh = new StringBuffer();
sh.append("<?xml version=\'1.0\' " +
"encoding=\'UTF-8\'?>\r\n");
sh.append("<SOAP-ENV:Envelope");
sh.append("\r\n");
sh.append(" xmlns:xsi=\" +
""http://www.w3.org/2001/XMLSchema-instance\" ");
sh.append("\r\n");
sh.append(" " +
"xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" ");
sh.append("\r\n");
sh.append(" " +
"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">");
sh.append("\r\n");
sh.append(" SOAP-ENV:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding\">");
sh.append("\r\n");
sh.append(" <SOAP-ENV:Body>");
sh.append("\r\n");
req.append(sh.toString());
}//soapcall()
// Returns complete SOAP Envelope along with body.
public String getCompleteSOAPRequest()
{
req.append(body);
writeTail();
return req.toString();
}//write()
// Sets SOAP Envelope body.
public void setBody (String body)
{
this.body=body;
}//setBody()
// Returns SOAP Envelope body.
public String getBody()
{
return this.body;
}//getBody()
// Writes tail of SOAP Envelope.
private void writeTail()
{
String tail;
sh = new StringBuffer();
sh.append(" </SOAP-ENV:Body>\r\n");
sh.append("</SOAP-ENV:Envelope>\r\n");
tail = sh.toString();
req.append(tail);
}//writeTail()
}//class
|