简体   繁体   中英

How to convert XML-string in column to Content for web request with Web.Contents in Power Query

Problem

I try get a response from a wsdl WebService and use therefore Web.Contents https://docs.microsoft.com/en-us/powerquery-m/web-contents in Power Query and need to post optional xml-content.


Use Case One

In my first Use-Case I included a local xml-file with File.Contents https://docs.microsoft.com/en-us/powerquery-m/file-contents to post it to the Service. This works very well.

=Xml.Tables(Web.Contents("http://10.3.3.33:18080/WebService?wsdl", 
[Content=File.Contents("E:\input.xml"),Headers=[#"Accept- 
Encoding"="gzip,deflate", SOAPAction="", #"Content- 
Type"="text/xml;charset=UTF-8"]]))

Use Case Two

In my seconde Use-Case I need to use the same Content of the xml-file out of a cell. With Text.FromBinary https://docs.microsoft.com/en-us/powerquery-m/text-frombinary I load the content to a new column called [XML_TEXT]. Edit it and convert it to a Binary with Text.ToBinary in a column called [Binary] in Power Query.

I do not know how to post [XML_TEXT] or [Binary] to the webservice!

= Table.AddColumn(PreviousStep, "UserDefined", each 
Xml.Tables(Web.Contents("http://10.3.3.33:18080/WebService?wsdl", 
[Content=[Binary],Headers=[#"Accept-Encoding"="gzip,deflate", 
SOAPAction="", #"Content-Type"="text/xml;charset=UTF-8"]])))

Result

I expect to get a XML back as in Use Case One. But I receive the following message:


DataSource.Error: Fehler beim Abrufen von Inhalten von 
"http://10.3.3.33:18080/WebService?wsdl" (500) durch "Web.Contents": 
Internal Server Error
Details:
DataSourceKind=Web
DataSourcePath=http://10.3.3.33:18080/WebService
Url=http://10.3.3.33:18080/WebService?wsdl

Problem solved.

There was an Error in [XML_TEXT] with was passed in Use Case Two to the WebService.

By converting from Float to String, "," was to be converted to "."

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM