2 Replies Latest reply on Jan 19, 2017 1:04 AM by xguo RSS
    xguo Explorer

    when parse xml with postxml(),how to make the content accept variable?

    hello,everyone.

    I encounter one question when parse xml, the webservice need input parameter, one is current system time,the format like "2017-01-18T00:02:00", the other one is two minutes before the current system time,like "2017-01-18T00:00:00".

     

    how should i make the input variable into the content?

     

     

    var url =  "https://companyurl.com/eProxy/service/MOSC_INI_SNA_SERVICE_Router";

     

    var content =

    <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://www.informatica.com/dis/ws/"  targetNamespace="http://www.informatica.com/dis/ws/">

      <soapenv:Body>

          <ws:Operation>

              <ws:SNA_SERVICE_INPUT>

                <ws:SGTIN>00300744339023</ws:SGTIN>

                <ws:LOT_NUMBER>23456AA</ws:LOT_NUMBER>

     

                <ws:EXPIRY_DATE>170630</ws:EXPIRY_DATE> // I hope here turn to some variable,for example,abc,out the content define the variable abc=170630;

     

                <ws:USER_ID></ws:USER_ID>

                <ws:USER_DEVICE_ID>65787656576787</ws:USER_DEVICE_ID>

                <ws:USER_GPS_LATITUDE>121</ws:USER_GPS_LATITUDE>

                <ws:USER_GPS_LONGITUDE>654</ws:USER_GPS_LONGITUDE>

                <ws:USER_GPS_ALTITUDE>56</ws:USER_GPS_ALTITUDE>

            </ws:SNA_SERVICE_INPUT>

          </ws:Operation>

      </soapenv:Body>

    </soapenv:Envelope>

     

     

    var headers={ "Content-Type": "text/xml","SOAPAction":"https://companyurl.com/eProxy/service/MOSC_INI_SNA_SERVICE_Router"};

    var params = {

    timeout : 60,

    headers : headers,

    ignoreSSLErrors : true,

    url : url,

    content : content

    };

    var returnContent = Resources['ContentLoaderFunctions'].PostXML(params);