cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Unable to invoke SOAP request when needing to have a variable in the content information

avladescu
7-Bedrock

Unable to invoke SOAP request when needing to have a variable in the content information

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

ACCEPTED SOLUTION

Accepted Solutions

You can do like so:

var myVar="123";

var xml = <password>{myVar}</password>;

and then xml will store <password>123</password>

View solution in original post

3 REPLIES 3

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.

paic
12-Amethyst
(To:avladescu)

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>

Announcements


Top Tags