3 Replies Latest reply on Nov 21, 2015 11:39 AM by chadha RSS
    avladescu Explorer

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