Forum Discussion

Yggdrasill's avatar
Yggdrasill
Responsive Resident
7 years ago
Solved

SOAP web services XML

Hello

 

I'm having issues getting data from a SOAP WS XML. The source uses Preemptive basic HTTP authentication with user/pass which I've already received.

 

 

let
    Source = Xml.Tables(Web.Contents("URL"))
in
    Source

This returns attribute names and such but no data at all. I'm not prompted for authentication by the way.

 

 

I've tried to manipulate the headers 

 

 

let
    Source = Web.Contents("wsdl", 
[Headers=[Authorization="user pass"]]), Xml = Xml.Tables(Source) in Xml

 

 

 

Does anyone have any idea how to actually get data from this ?

  • Anonymous's avatar
    Anonymous
    7 years ago

    Yggdrasill,

    Please change your code to the following and check if you get data.

    let
    Source = Xml.Tables(Web.Contents("xxxxxxxxxxxx"
    ,[Content=File.Contents("xxxxxxx\post.xml"),Headers=[Authorization="Basic xxxxxxxxxxx" ,#"Accept-Encoding"="gzip,deflate", #"Content-Type"="text/xml;charset=UTF-8"]]))
    in
    Source


    There is a disscussion in the following similar thread, you can check JasonL's reply and erickfranz's reply to get details.
    https://community.powerbi.com/t5/Desktop/How-to-get-data-from-a-SOAP-WS-with-Power-BI/td-p/29040

    Regards,
    Lydia

  • Thanks Lydia. I got it to work with a lot of help with the thread you listed.

    First of all to list my setup and envorinment

     

    • Host uses SOAP web services with preemptive authentication in HTTP header.
    • My IP is allowed to pass through my source which as well have given me a username and a password.

    With a little tweak this is my solution.

    let
    SourceURL = "wsdl-URL", //host provides this address. Url ends often with "wsdl"
    
    options = [ #"Authorization" ="Basic USER:PASS=", //User:pass decoded with SOAP UI
                #"Accept-Encoding"= "gzip,deflate",
               // SOAPAction="", 
                #"Content-Type"="text/xml;charset=UTF-8",
                #"Connection"="Keep-Alive"
              ],
    WebContent = Web.Contents(SourceURL, 
    // Content options in Web.Contents() requires you to authenticate anonymously ! [Content=Text.ToBinary(" --Xml text pasted from wordpad (which I created with SOAPUI open source program)-- "), Headers=options]) , XmlContent = Xml.Tables(WebContent), in XmlContent


    References used to create this code:

    This thread (Jasons solution and juliovidigal alterations)
    This video (on how to use SOAP UI to create the XML file/text)
    This program (Download the freeware SOAP UI to create the Xml which is pasted in the "Xml text" Section. Paste the Xml text to wordpad and replace all " with #(0022) and then paste from wordpad to the "Xml text" section the advanced editor in power query.

    Host actually blocked my IP for a mistake so I blame them for few of those hours of my life. However this took some time and I hope this helps someone

    Edit: Funny how the "Code window" changes ":" and "P" to a smiley ass

     

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Yggdrasill,

    Please change your code to the following and check if you get data.

    let
    Source = Xml.Tables(Web.Contents("xxxxxxxxxxxx"
    ,[Content=File.Contents("xxxxxxx\post.xml"),Headers=[Authorization="Basic xxxxxxxxxxx" ,#"Accept-Encoding"="gzip,deflate", #"Content-Type"="text/xml;charset=UTF-8"]]))
    in
    Source


    There is a disscussion in the following similar thread, you can check JasonL's reply and erickfranz's reply to get details.
    https://community.powerbi.com/t5/Desktop/How-to-get-data-from-a-SOAP-WS-with-Power-BI/td-p/29040

    Regards,
    Lydia

    • Yggdrasill's avatar
      Yggdrasill
      Responsive Resident

      Thanks Lydia. I got it to work with a lot of help with the thread you listed.

      First of all to list my setup and envorinment

       

      • Host uses SOAP web services with preemptive authentication in HTTP header.
      • My IP is allowed to pass through my source which as well have given me a username and a password.

      With a little tweak this is my solution.

      let
      SourceURL = "wsdl-URL", //host provides this address. Url ends often with "wsdl"
      
      options = [ #"Authorization" ="Basic USER:PASS=", //User:pass decoded with SOAP UI
                  #"Accept-Encoding"= "gzip,deflate",
                 // SOAPAction="", 
                  #"Content-Type"="text/xml;charset=UTF-8",
                  #"Connection"="Keep-Alive"
                ],
      WebContent = Web.Contents(SourceURL, 
      // Content options in Web.Contents() requires you to authenticate anonymously ! [Content=Text.ToBinary(" --Xml text pasted from wordpad (which I created with SOAPUI open source program)-- "), Headers=options]) , XmlContent = Xml.Tables(WebContent), in XmlContent


      References used to create this code:

      This thread (Jasons solution and juliovidigal alterations)
      This video (on how to use SOAP UI to create the XML file/text)
      This program (Download the freeware SOAP UI to create the Xml which is pasted in the "Xml text" Section. Paste the Xml text to wordpad and replace all " with #(0022) and then paste from wordpad to the "Xml text" section the advanced editor in power query.

      Host actually blocked my IP for a mistake so I blame them for few of those hours of my life. However this took some time and I hope this helps someone

      Edit: Funny how the "Code window" changes ":" and "P" to a smiley ass