public static MessageContext getMessageContext() throws AxisFault {
OMNamespace namespace, nulNS;
OMElement operation, value1, value2;
OMElement subValue1, subValue2, subValue3, subValue4, subValue5;
SOAPFactory omFactory = OMAbstractFactory.getSOAP11Factory();
SOAPEnvelope reqEnv = omFactory.getDefaultEnvelope();
namespace = reqEnv.declareNamespace(
"http://schemas.xmlsoap.org/soap/envelope/",
"SOAP-ENV");
namespace = reqEnv.declareNamespace(
"http://schemas.xmlsoap.org/soap/encoding/",
"SOAP-ENC");
namespace =
reqEnv.declareNamespace(
"http://www.w3.org/1999/XMLSchema-instance/", "xsi");
namespace =
reqEnv.declareNamespace("http://www.w3.org/2001/XMLSchema",
"xsd");
namespace = reqEnv.declareNamespace(
"http://schemas.xmlsoap.org/wsdl/soap/",
"soap");
namespace = reqEnv.declareNamespace("http://schemas.xmlsoap.org/wsdl/",
"wsdl");
namespace = reqEnv.declareNamespace(
"http://webservices.amazon.com/AWSAlexa/2005-02-01",
"tns");
nulNS = omFactory.createOMNamespace("", "");
operation =
omFactory.createOMElement("Search",
"http://webservices.amazon.com/AWSAlexa/2005-02-01",
"ns1");
reqEnv.getBody().addChild(operation);
operation.addAttribute("encordingStyle",
"http://schemas.xmlsoap.org/soap/encoding/",
null);
value1 = omFactory.createOMElement("SubscriptionId", nulNS);
value1.addChild(omFactory.createText(AsynchronousClient.amazonkey));
//this is a valid sample key :- "0Y6WJGPB6TW8AVAHGFR2"));
value2 = omFactory.createOMElement("Request", nulNS);
subValue1 = omFactory.createOMElement("ResponseGroup", nulNS);
subValue1.addChild(omFactory.createText("Web"));
subValue2 = omFactory.createOMElement("Query", nulNS);
subValue2.addChild(omFactory.createText(AsynchronousClient.search));
subValue3 = omFactory.createOMElement("Count", nulNS);
subValue3.addChild(omFactory.createText(AsynchronousClient.maxResults));
subValue4 = omFactory.createOMElement("IgnoreWords", nulNS);
subValue4.addChild(omFactory.createText("90"));
subValue5 = omFactory.createOMElement("AdultFilter", nulNS);
subValue5.addChild(omFactory.createText("yes"));
value2.addChild(subValue5);
value2.addChild(subValue4);
value2.addChild(subValue3);
value2.addChild(subValue2);