web-services - 如何将 Power BI 连接到 Web 服务中的数据源
问题描述
我从 Power BI 开始,现在我面临着从 asmx 上创建的 WebService 连接到数据源的挑战,WebService 地址是:
http://www.testws.com:65/com_InfoListAll.asmx
从浏览器输入之前的地址时,我的Web Service包含的信息如下:
Com_InfoListAll
The following operations are supported. For a formal definition, please review the Service Description.
- InfoTravel
- ShowList
This web service is using http://tempuri.org/ as its default namespace.
Recommendation: Change the default namespace before the XML Web service is made public.
Each XML Web service needs a unique namespace in order for client applications to distinguish it from other services on the Web. http://tempuri.org/ is available for XML Web services that are under development, but published XML Web services should use a more permanent namespace.
Your XML Web service should be identified by a namespace that you control. For example, you can use your company's Internet domain name as part of the namespace. Although many XML Web service namespaces look like URLs, they need not point to actual resources on the Web. (XML Web service namespaces are URIs.)
For XML Web services creating using ASP.NET, the default namespace can be changed using the WebService attribute's Namespace property. The WebService attribute is an attribute applied to the class that contains the XML Web service methods. Below is a code example that sets the namespace to "http://microsoft.com/webservices/":
C#
[WebService(Namespace="http://microsoft.com/webservices/")]
public class MyWebService {
// implementation
}
Visual Basic
<WebService(Namespace:="http://microsoft.com/webservices/")> Public Class MyWebService
' implementation
End Class
C++
[WebService(Namespace="http://microsoft.com/webservices/")]
public ref class MyWebService {
// implementation
};
For more details on XML namespaces, see the W3C recommendation on Namespaces in XML.
For more details on WSDL, see the WSDL Specification.
For more details on URIs, see RFC 2396.
很明显,我使用了两种方法,它们是InfoTravel
和ShowList
该方法的方向InfoTravel
是:
http://www.testws.com:65/com_InfoListAll.asmx?op=InfoTravel
该方法的方向ShowList
是:
http://www.testws.com:65/com_InfoListAll.asmx?op=ShowList
InfoTravel
and方法的内容ShowList
是一样的,只是改变了参数,所以我只添加ShowList
方法中显示的内容。
Com_InfoListAll
Click here for a complete list of operations.
ShowList
Test
To test the operation using the HTTP POST protocol, click the 'Invoke' button.
Parameter Value
username:
password:
SOAP 1.1
The following is a sample SOAP 1.1 request and response. The placeholders shown need to be replaced with actual values.
POST /com_InfoListAll.asmx HTTP/1.1
Host: www.testws.com
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/ShowList"
<?xml version="1.0" encoding="utf-8"?>
<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/">
<soap:Body>
<ShowList xmlns="http://tempuri.org/">
<username>string</username>
<password>string</password>
</ShowList>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<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/">
<soap:Body>
<ShowListResponse xmlns="http://tempuri.org/">
<ShowListResult />
</ShowListResponse>
</soap:Body>
</soap:Envelope>
SOAP 1.2
The following is a sample SOAP 1.2 request and response. The placeholders shown need to be replaced with actual values.
POST /com_InfoListAll.asmx HTTP/1.1
Host: www.testws.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<ShowList xmlns="http://tempuri.org/">
<username>string</username>
<password>string</password>
</ShowList>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<ShowListResponse xmlns="http://tempuri.org/">
<ShowListResult />
</ShowListResponse>
</soap12:Body>
</soap12:Envelope>
HTTP GET
The following is a sample HTTP GET request and response. The placeholders shown need to be replaced with actual values.
GET /com_InfoListAll.asmx/ShowList?username=string&password=string HTTP/1.1
Host: www.testws.com
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<anyType xmlns="http://tempuri.org/" />
HTTP POST
The following is a sample HTTP POST request and response. The placeholders shown need to be replaced with actual values.
POST /com_InfoListAll.asmx/ShowList HTTP/1.1
Host: www.testws.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length
username=string&password=string
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<anyType xmlns="http://tempuri.org/" />
你如何可视化每个方法它需要一些参数
我正在连接的 Power BI 中的数据源是 Web,我通过在基本部分中添加我的 Web 服务的主 URL 来执行以下操作:
尝试以这种方式连接时,我收到以下错误消息:
还可以尝试从高级部分使用以下每种方法添加部分 URL:
如果建立连接但获得的数据与 HTML 中的参数相同,则使用此选项。
我不知道我是否必须在高级部分中对参数进行任何先前的配置,希望有人能给我一些指导。
更新 1:
我尝试通过空白查询数据源进行连接,如下所示:
我添加了以下查询:
let
Source = Web.Contents(
"http://www.testws.com:84/com_InfoListAll.asmx",
[
RelativePath = "InfoTravel",
Query=
[
username = "username",
password = "password",
Type = "99",
ID = "1001"
]
])
in
Source
连接到此数据源时,我得到如下二进制文件:
然后我单击它,它将所有信息加载到表的单个字段中,如下所示:
我想知道在加载数据之前是否有一个步骤,或者我加载不正确。
解决方案
推荐阅读
- mysql - Mysql server 5.7 - 无法使用 mysql shell 'cluster.addInstance()' 添加新的集群实例
- typescript - 如何使用过滤器进行类型缩小?
- sql-server - 如果 where 子句不返回任何记录,则返回所有值
- excel - 访问vba以将excel中的公式复制到最后一行
- wso2 - WSO2 contentType text/html 与 axis2.xml 中的 application/xml 重叠
- javascript - 应该怎么做才能确保密钥不会保留在内存中?节点 Js
- javascript - 如何让我的 .js 文件在 React 中呈现 .html 文件?
- python - 有没有办法像调用者所说的那样在被调用者中获取函数参数?
- python - 为什么我不能使用循环在列表中创建列表?
- webrtc - 涓流 ICE 和同一内部网络上的两个对等点