我正在使用soaplib (python) 来制作webservices 服务器。
我已经实现了一个方法并生成了一个 wsdl,以便任何肥皂客户端都可以轻松地使用 web 服务。
我正在使用soapUI 来验证我的网络服务,soapUI 说响应不正常。
我发现了 XML 中的问题,但无法让soapLib 以正确的方式使用......
这是我的 PythonClass:
class AgentSoapManager(SimpleWSGISoapApp):
""" Interface for web services """
@soapmethod(String, _returns = String)
def get_streaming_url(self, application_identifier):
returns "rtsp://192.168.10.224:51081/camera8"
我正在使用 WSGIServer。
这是我的电话(根据soapUI可以):
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agen="agent.soap.AgentSoapManager.AgentSoapManager">
<soapenv:Header/>
<soapenv:Body>
<agen:get_streaming_url>
<application_identifier>0800275ec350_jaguar_8</application_identifier>
</agen:get_streaming_url>
</soapenv:Body>
</soapenv:Envelope>
这是我的网络服务的错误响应
<SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<get_streaming_urlResponse>
<get_streaming_urlResult xsi:type="xs:string">
rtsp://192.168.10.224:51081/camera8
</get_streaming_urlResult>
</get_streaming_urlResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
这是错误:
line-1: Missing part with name [{agent.soap.AgentSoapManager.AgentSoapManager}get_streaming_urlResponse
这是我找到的响应,根据soapUI可以
<SOAP-ENV:Envelope xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:agen="agent.soap.AgentSoapManager.AgentSoapManager">
<SOAP-ENV:Body>
<agen:get_streaming_urlResponse>
<get_streaming_urlResult>
rtsp://192.168.10.224:51081/camera8
</get_streaming_urlResult>
</agen:get_streaming_urlResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>