Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
Instead of hard coding <SystemName>844J</SystemName> something like <SystemName>myVariable</SystemName> should be used instead.
"<xml tag>"+ myVariable + " </XML tag>" isn't accepted as a valid syntax.
var c1=
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<ReadRecordMultipleValues xmlns="http://tempuri.org/">
<UserName>admin</UserName>
<Password></Password>
<GroupName></GroupName>
<ProjectName>844J Front End Loader</ProjectName>
<SystemName>844J</SystemName>
<Table>Problems</Table>;
<Identifier>Problem1</Identifier>
<!-- Optional -->
<FieldList>
<!-- Optional -->
<DataEngineField>
<FieldName>Problem Description</FieldName>
<TableName></TableName>
</DataEngineField>
<DataEngineField>
<FieldName>Owner of Problem</FieldName>
<TableName></TableName>
</DataEngineField>
<DataEngineField>
<FieldName>Action Taken</FieldName>
<TableName></TableName>
</DataEngineField> <DataEngineField>
<FieldName>Recommended Action</FieldName>
<TableName></TableName>
</DataEngineField>
<DataEngineField>
<FieldName>Problem #</FieldName>
<TableName></TableName>
</DataEngineField>
</FieldList>
</ReadRecordMultipleValues>
</Body>
</Envelope>;
var lengthC= String(c1).length;
logger.warn (" length "+ lengthC);
// var headers_action = new Object();
//headers_action.SOAPAction = "http://tempuri.org/ReadRecord";
//headers_actions.Content-Type="text/xml";
var headers={ "Content-Type": "text/xml","SOAPAction":"http://tempuri.org/ReadRecordMultipleValues"};
logger.warn ("HEADER"+ headers);
var params = {
headers: headers /* JSON */,
useProxy: undefined /* BOOLEAN */,
proxyHost: undefined /* STRING */,
useNTLM: undefined /* BOOLEAN */,
ignoreSSLErrors: true /* BOOLEAN */,
proxyPort: undefined /* INTEGER */,
withCookies: undefined /* BOOLEAN */,
password: undefined /* STRING */,
url: "http://icenterv01:81/PTCWindchillQualitySolutions10.2/DataEngine.asmx" /* STRING */,
workstation: undefined /* STRING */,
content: c1 /* XML */,
username: undefined /* STRING */,
proxyScheme: undefined /* STRING */,
domain: undefined /* STRING */,
timeout: 500 /* NUMBER */
};
var x=Resources["ContentLoaderFunctions"].PostXML(params);
Solved! Go to Solution.
You can do like so:
var myVar="123";
var xml = <password>{myVar}</password>;
and then xml will store <password>123</password>
if defining var myVar="123" and then passing it inside the xml tag like <Password>myVar</Password> it will use myVar instead of "123" as value.
not sure if this would work but
define the xml as string first so you can get the variable inserted properly using concatenation
then assign that string to an html variable, perhaps initially defined as var myxml = <xml></xml>
You can do like so:
var myVar="123";
var xml = <password>{myVar}</password>;
and then xml will store <password>123</password>