首页 文章

如何使用ZEEP更改SOAP请求中的 endpoints 地址

提问于
浏览
1

我正在使用ZEEP来发出SOAP请求,它很简单,效果很好 .

问题是 endpoints URL(在WSDL中)不正确 .

我可以通过直接编辑WSDL来解决问题,但这不是可扩展的 .

我查看了有关创建服务代理的ZEEP文档,但我不理解它并且有错误 . 以下是包含错误URL的WSDL的一部分:

</binding>
<service name="DeviceConfigurationService">
    <port name="DeviceConfigurationPort" 
binding="xrx:DeviceConfigurationBinding">
        <soap:address 
location="http://localhost/webservices/office/device_configuration/1"/>
    </port>
    </service>

我需要改变的位置 . 我需要从“localhost”更改为LAN IP地址 . 此值可能会经常更改,因此我不希望每次都必须编辑WSDL .

有没有人知道如何用Zeep做到这一点?

任何帮助是极大的赞赏!

1 回答

  • 0
    client = Client('http://localhost/webservices/office/device_configuration/1?wsdl')
    
    service = client.create_service(
        '{http://path-to-xrx-namespace}DeviceConfigurationBinding',
        'http://127.0.0.1/webservices/office/device_configuration/1')
    
    service.submit('something')
    

相关问题