728x90 AdSpace

Friday, August 29, 2014

XML in Web Protocol

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;
}


  • Blogger Comments
  • Facebook Comments

2 comments :

  1. This comment has been removed by the author.

    ReplyDelete
  2. You can also read the content of the response by making use of lr_xml_extract function.
    To 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);

    ReplyDelete

Item Reviewed: XML in Web Protocol Rating: 5 Reviewed By: onurcelep