Trying to get data from ascii to a string

Spoke too soon. The soap is returning the right data but the function string isn't putting the SN in using. See the debug string has the variable name in the soap request instead of the actual Serial Number

thats strange .. .. i doubt that this would make a difference but

  1. first try to remove all white space between your xml tags in the template string
  2. then try to concatenate the string with + SN but now in single quotes
let SN = global.get("SN");
msg.payload = '<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><GetChargeRecipe xmlns="http://tempuri.org/"><serialNumber>' + SN + '</serialNumber><site>AC</site></GetChargeRecipe></soap:Body></soap:Envelope>'
//msg.topic = "";
delete msg.topic;
return msg;
1 Like

The only way it returns the envelope right so far from the soap is if I leave it all as one string.
When i try to break it up and use the + SN + or global.get("SN") it puts the serial number in right and the debug text is exactly the same but it doesnt get anything from SOAP

Going to start a new post as cleaned it up to be more clear between which two it works and doesn't work between

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.