Zeep无法识别所有操作

时间:2018-10-26 15:56:49

标签: python soap zeep wsse

当我做python -mzeep https://testingapi.ercot.com/2007-08/Nodal/eEDS/EWS/?WSDL

操作为空白。当我在浏览器中找到它时,可以在<operation>标签下找到很多东西。我想念什么?

我不确定这是否相关,但我讨厌排除此信息。该站点有一个XSD和WSDL文件的zip文件,我不知道该如何处理here

2 个答案:

答案 0 :(得分:0)

您可以测试其他WS:ip2geo

zeep检查是否返回与Operations相关的Service。比较这两个WSDL,我发现标签非常不同,在使用zeep的工作WSDL中,操作以<wsdl:operation ...开头,而在其他WSDL中,则以不同的方式定义。

注意,它在python -mzeep https://testingapi.ercot.com/2007-08/Nodal/eEDS/EWS/?WSDL输出的开头显示了一些警告,提示invalid xsd type or elements和其他消息。

答案 1 :(得分:0)

您是否在这方面取得了一些进展?我还使用ERCOT SOAP API遇到了这个问题。我试图解决此问题的方法是用适合使用wsdl:前缀的本地文件替换WSDL。然后,您可以使用指向具有以下内容的MOTE.wsdl文件的本地路径的路径:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:ns0="http://www.ercot.com/schema/2007-06/nodal/ews/message"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:tns="http://www.ercot.com/wsdl/2007-06/nodal/ewsConcrete"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  targetNamespace="http://www.ercot.com/wsdl/2007-06/nodal/ewsConcrete">
                  xmlns:wsu="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:wsse="http://www.docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
                  xmlns:ns2="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns1="http://schemas.xmlsoap.org/wsdl/soap12/"
                  xmlns:ns4="http://www.w3.org/2006/05/addressing/wsdl"
                  xmlns:ns3="http://schemas.xmlsoap.org/wsdl/jms/">
    <wsp:UsingPolicy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" wsdl:Required="true"
                     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"/>
    <wsp:Policy xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
        <sp:SecurityHeader MustManifestEncryption="true" MustPrepend="true"
                           xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="SecurityTokens" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:SecurityToken xmlns:_ns1="http://www.actional.com"
                                  xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext">
                    <sp:TokenType>_ns1:SSLClientCertificate</sp:TokenType>
                </sp:SecurityToken>
            </wsp:All>
            <wsp:All>
                <sp:SecurityToken xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext">
                    <sp:TokenType>sp:X509v3</sp:TokenType>
                </sp:SecurityToken>
            </wsp:All>
            <wsp:All>
                <sp:SecurityToken xmlns:_ns1="http://www.actional.com"
                                  xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext">
                    <sp:TokenType>_ns1:SSLClientCertificate</sp:TokenType>
                </sp:SecurityToken>
                <sp:SecurityToken xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext">
                    <sp:TokenType>sp:X509v3</sp:TokenType>
                </sp:SecurityToken>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsp:Policy wsu:Id="SignedBody" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <sp:Integrity xmlns:sp="http://schemas.xmlsoap.org/ws/2002/12/secext">
            <sp:TokenInfo>
                <sp:SecurityToken>
                    <sp:TokenType>sp:X509v3</sp:TokenType>
                </sp:SecurityToken>
            </sp:TokenInfo>
            <sp:MessageParts>wsp:GetBody(.)</sp:MessageParts>
        </sp:Integrity>
    </wsp:Policy>
    <wsp:Policy wsu:Id="Alerts_input_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:PolicyReference URI="#SecurityTokens"/>
        <wsp:PolicyReference URI="#SignedBody"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="Alerts_output_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:PolicyReference URI="#SignedBody"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="MarketInfo_input_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:PolicyReference URI="#SecurityTokens"/>
        <wsp:PolicyReference URI="#SignedBody"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="MarketInfo_output_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:PolicyReference URI="#SignedBody"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="MarketTransactions_input_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:PolicyReference URI="#SecurityTokens"/>
        <wsp:PolicyReference URI="#SignedBody"/>
    </wsp:Policy>
    <wsp:Policy wsu:Id="MarketTransactions_output_policy" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
        <wsp:PolicyReference URI="#SignedBody"/>
    </wsp:Policy>
    <wsdl:types>
        <xs:schema targetNamespace="http://www.ercot.com/schema/2007-06/nodal/ews/message"
                   xml:lang="en"
                   xmlns:xs="http://www.w3.org/2001/XMLSchema">
            <xs:include schemaLocation="Message.xsd"/>
        </xs:schema>
    </wsdl:types>
    <wsdl:message name="EWSResponse">
        <wsdl:part name="output" element="ns0:ResponseMessage"/>
    </wsdl:message>
    <wsdl:message name="EWSFault">
        <wsdl:part name="fault" element="ns0:FaultMessage"/>
    </wsdl:message>
    <wsdl:message name="EWSRequest">
        <wsdl:part name="input" element="ns0:RequestMessage"/>
    </wsdl:message>
    <wsdl:portType name="Operations">
        <wsdl:operation name="MarketTransactions">
            <wsdl:input message="tns:EWSRequest"/>
            <wsdl:output message="tns:EWSResponse"/>
            <wsdl:fault name="fault1" message="tns:EWSFault"/>
        </wsdl:operation>
        <wsdl:operation name="Alerts">
            <wsdl:input message="tns:EWSRequest"/>
            <wsdl:output message="tns:EWSResponse"/>
            <wsdl:fault name="fault1" message="tns:EWSFault"/>
        </wsdl:operation>
        <wsdl:operation name="MarketInfo">
            <wsdl:input message="tns:EWSRequest"/>
            <wsdl:output message="tns:EWSResponse"/>
            <wsdl:fault name="fault1" message="tns:EWSFault"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="HttpEndPointBinding" type="tns:Operations">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="MarketTransactions">
            <soap:operation soapAction="/BusinessService/NodalService.serviceagent/HttpEndPoint/MarketTransactions"
                            style="document"/>
            <wsdl:input>
                <soap:body parts="input" use="literal"/>
                <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                     URI="#MarketTransactions_input_policy"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="output" use="literal"/>
                <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                     URI="#MarketTransactions_output_policy"/>
            </wsdl:output>
            <wsdl:fault name="fault1">
                <soap:fault name="fault1" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="MarketInfo">
            <soap:operation soapAction="/BusinessService/NodalService.serviceagent/HttpEndPoint/MarketInfo"
                            style="document"/>
            <wsdl:input>
                <soap:body parts="input" use="literal"/>
                <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                     URI="#MarketInfo_input_policy"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="output" use="literal"/>
                <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                     URI="#MarketInfo_output_policy"/>
            </wsdl:output>
            <wsdl:fault name="fault1">
                <soap:fault name="fault1" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
        <wsdl:operation name="Alerts">
            <soap:operation soapAction="/BusinessService/NodalService.serviceagent/HttpEndPoint/Alerts"
                            style="document"/>
            <wsdl:input>
                <soap:body parts="input" use="literal"/>
                <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                     URI="#Alerts_input_policy"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="output" use="literal"/>
                <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                                     URI="#Alerts_output_policy"/>
            </wsdl:output>
            <wsdl:fault name="fault1">
                <soap:fault name="fault1" use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="NodalService">
        <wsdl:port name="HttpEndPoint" binding="tns:HttpEndPointBinding">
            <soap:address location="https://mttlein0010.ercot.com:8090/sst/runtime.asvc/com.ercot.eip.EWSExtHTTP"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

您如何看待该解决方案?由于它现在可以识别所有操作,因此我取得了一些成功。但是不利的是,现在我正在处理连接问题:

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='mttlein0010.ercot.com', port=8090): Max retries exceeded with url: /sst/runtime.asvc/com.ercot.eip.EWSExtHTTP (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x00000169A3E64A00>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))