*/
public static MessageContext getMessageContext(
AsynchronousClient asyncClient)
throws AxisFault {
OMNamespace defNs;
OMElement operation;
MessageContext msgContext = null;
String str_ST_index = Integer.toString(asyncClient.getStartIndex());
defNs = OMAbstractFactory.getSOAP11Factory().createOMNamespace("", "");
SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope envelope = omFactory.getDefaultEnvelope();
envelope.declareNamespace("http://schemas.xmlsoap.org/soap/envelope/",
"soapenv");
envelope.declareNamespace("http://schemas.xmlsoap.org/soap/encoding/",
"SOAP-ENC");
envelope.declareNamespace("http://www.w3.org/2001/XMLSchema-instance",
"xsi");
envelope.declareNamespace("http://www.w3.org/2001/XMLSchema",
"xsd");
operation =
omFactory.createOMElement("doGoogleSearch",
"urn:GoogleSearch",
"ns1");
envelope.getBody().addChild(operation);
operation.addAttribute("soapenv:encordingStyle",
"http://schemas.xmlsoap.org/soap/encoding/", null);
operation.addChild(
getOMElement(omFactory,
defNs,
"key",
"xsd:string",
asyncClient.getKey()));
operation.addChild(
getOMElement(omFactory,
defNs,
"q",
"xsd:string",
asyncClient.getSearch()));
operation.addChild(
getOMElement(omFactory,
defNs,
"start",
"xsd:int",
str_ST_index));
operation.addChild(
getOMElement(omFactory,
defNs,
"maxResults",
"xsd:int",
asyncClient.getMaxResults()));
operation.addChild(
getOMElement(omFactory,
defNs,
"filter",
"xsd:boolean",
"true"));
operation.addChild(
getOMElement(omFactory, defNs, "restrict", "xsd:string", ""));
operation.addChild(
getOMElement(omFactory,
defNs,
"safeSearch",
"xsd:boolean",
"false"));
operation.addChild(
getOMElement(omFactory, defNs, "lr", "xsd:string", ""));
operation.addChild(
getOMElement(omFactory, defNs, "ie", "xsd:string", "latin1"));
operation.addChild(
getOMElement(omFactory, defNs, "oe", "xsd:string", "latin1"));
msgContext = new MessageContext();
msgContext.setEnvelope(envelope);
return msgContext;