7 Replies Latest reply: Mar 16, 2017 3:56 PM by Gabriela Baldivia do Lago RSS

    REST connection POST method - QlikSense

    Gabriela Baldivia do Lago

      Hy everyone,

       

      I'm trying to do a REST connection through POST method to read a XML document, but I'm failling.

       

      I created the connection with the webservice using the QlikRESTConnector, passing the URL, method as post, user, password and the name of the connection. All the other settings was black or already filled as defaults values.

       

      Then I created the following code:

       

        Let vRequestBody ='';

        let vRequestBody = vRequestBody &'<?xml version="1.0" encoding="utf-8" ?>';

        let vRequestBody = vRequestBody &'<xDBCompanyNamex>';

        let vRequestBody = vRequestBody &'<Authentication user="xUserx" password="xPasswordx" />';

        let vRequestBody = vRequestBody &'<ResponseFormat>xml</ResponseFormat>';

        let vRequestBody = vRequestBody &'<Command><Name>xWebServiceMethodNamex</Name>';

        let vRequestBody = vRequestBody &'<Parameters>';

        let vRequestBody = vRequestBody &'<Parameter id="xParameter1x">xKEYx</Parameter>';

        let vRequestBody = vRequestBody &'<Parameter id="xParameter2x">xNamex</Parameter>';

        let vRequestBody = vRequestBody &'</Parameters>';

        let vRequestBody = vRequestBody &'</Command>';

        let vRequestBody = vRequestBody &'</xDBCompanyNamex>';

        let vRequestBody = replace(vRequestBody,'"', chr(34)&chr(34));

       

       

      So, the string connection is:

       

      <?xml version=""1.0"" encoding=""utf-8"" ?>

      <xDBCompanyNamex>

      <Authentication user=""xUserx"" password=""xPasswordx"" />

      <ResponseFormat>xml</ResponseFormat>

      <Command><Name>xWebServiceMethodNamex</Name>

          <Parameters>

          <Parameter id=""xParameter1x"">xKEYx</Parameter>

          <Parameter id=""xParameter2x"">xNamex</Parameter>

          </Parameters>

      </Command>

      </xDBCompanyNamex>

       

      This two quotation marks is weirdo to me, but the code that was working before have it and I just copied.

       

      I run the code above with one quotation mark in the GetPostman and I achieve the expected outcome, so I tried the code with just one quotation mark on Qlik too, but the result is the same:

       

      Root element is missing.

       

      Any ideas about how to resolve that?

       

      Thanks and sorry for the English.