Here is a simple script example to send XML request to app server.
Action()
{
web_set_sockets_option("INITIAL_BASIC_AUTH",
"1");
// send request
lr_start_transaction("post_xml");
web_custom_request("SOAP_RetrieveMSISDN",
"URL=your-endpoint",
"Method=POST",
"TargetFrame=_SELF",
"Resource=0",
"Referer=",
"Body=<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sch=your-xml-request",
LAST);
lr_end_transaction("post_xml", LR_AUTO);
return 0;
}
Action()
{
web_set_sockets_option("INITIAL_BASIC_AUTH",
"1");
// send request
lr_start_transaction("post_xml");
web_custom_request("SOAP_RetrieveMSISDN",
"URL=your-endpoint",
"Method=POST",
"TargetFrame=_SELF",
"Resource=0",
"Referer=",
"Body=<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:sch=your-xml-request",
LAST);
lr_end_transaction("post_xml", LR_AUTO);
return 0;
}
This comment has been removed by the author.
ReplyDeleteYou can also read the content of the response by making use of lr_xml_extract function.
ReplyDeleteTo do this first get the response into variable by adding following block just before the web_custom_request
web_reg_save_param("ResponseBody",
"LB=",
"RB=",
"Search=Body",
"IgnoreRedirections=Yes",
LAST);
Then just after the web_custom request put following block (do not forget to change xpath value that is rightside of the Query parameter). Your MessageID is now assigned to {messageID} variable
lr_xml_extract("XML={ResponseBody}",
"Query=/soapenv:Envelope/env:Header/wsa:MessageID",
"XMLFragmentParam=messageID",
LAST);