0 Replies Latest reply: Aug 27, 2013 10:01 AM by Rildomar Lucena RSS

    Problem with generate XML in QlikView

      Hi guys, i'm new in community, and new user in qlikview, and i need to answer a question:

       

      above all, i'm not know writing English.. i'm using Google Translate.

       

      well...

       

      i have this code:

       

      sub testeRildomar

        set val=ActiveDocument.Fields("Ticker").GetPossibleValues

          sStockID = val.Item(0).Text

       

       

        xmlToSend = ""

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

        xmlToSend = xmlToSend & "<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/'>"

        xmlToSend = xmlToSend & "<soap:Body>"

        xmlToSend = xmlToSend & "<Clientes xmlns='http://feixeweb.feixe.com.br/'>"

        xmlToSend = xmlToSend & "<login>administrator</login>"

        xmlToSend = xmlToSend & "<senha>mypassword</senha>"

        xmlToSend = xmlToSend & "</Clientes>"

        xmlToSend = xmlToSend & "</soap:Body>"

        xmlToSend = xmlToSend & "</soap:Envelope>"

       

       

        set txt1 = ActiveDocument.Variables("vXMLSent")

        txt1.setContent xmlToSend, true

       

       

        'Create xmlhttp opject

        Set xmlhttp = CreateObject("Microsoft.XMLHTTP")

        'xmlhttp.open "POST", "http://www.webservicex.net/stockquote.asmx?op=GetQuote", false

        xmlhttp.open "POST", "http://wfx2.feixe.com.br/Services/FeixeWeb.asmx?WSDL", false

        xmlhttp.setRequestHeader "Content-Type", "text/xml"

        xmlhttp.setRequestHeader "SOAPAction", "http://feixeweb.feixe.com.br/Clientes"

        xmlhttp.send xmlToSend

       

       

        result = xmlhttp.responseText

        result = replace(result, "&gt;", ">")

        result = replace(result, "&lt;", "<")

        set txt2 = ActiveDocument.Variables("vXMLReceived")

        txt2.setContent result, true

       

        set st = ActiveDocument.getSheetObject("CH01")

        File = activedocument.Evaluate("'Cliente.xml'")

        st.ExportEx File,1

       

       

      end sub

       

      this code is a simple query with a WebService and the result is displayed in a Document. okay.

       

       

      But when I try to record in XML using this piece of code:

       

      set st = ActiveDocument.getSheetObject("CH01")

        File = activedocument.Evaluate("'Cliente.xml'")

        st.ExportEx File,1

       

       

      it generates as follows:

       

      <!-- received -->

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

      <soap:Envelope xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"" xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><soap:Body>

           <ClientesResponse xmlns=""http://feixeweb.feixe.com.br/"">

                <ClientesResult>

                     <Cliente>

                          <CNPJ>54968573671234</CNPJ>

                          <RazãoSocial>Padaria do seu zé</RazãoSocial>

                          <NomeFantasia>Pão Doce</NomeFantasia>

                     </Cliente>

                </ClientesResult>

           </ClientesResponse>

      </soap:Body>

      </soap:Envelope>"        

       

      If we analyze, we will realize that it ta put "at the beginning, and everywhere we have." example:

       

      <? xml version = ""

       

      and everywhere .. How to solve?