更改Zeep绑定

时间:2019-01-21 08:37:45

标签: soap binding zeep

我正在尝试连接到定义2个服务位置的soap端点,其中一个无效。如何更改绑定以使用其他服务。 我是SOAP的新手,并整理了文档says

dataframe.write.csv('/path/to/file.csv')

但是它没有提及论点是什么。

我的服务定义为:

from zeep import Client
from zeep import xsd

client = Client('http://my-endpoint.com/production.svc?wsdl')

service2 = client.bind('SecondService', 'Port12')
service2.someOperation(myArg=1)

我尝试了类似<wsdl:service name="PackageInq"> <wsdl:port name="BasicHttpBinding_IPackageInq" binding="tns:BasicHttpBinding_IPackageInq"> <soap:address location="http://invalid.local:8989/TopUp/PackageInq.svc"/> </wsdl:port> <wsdl:port name="BasicHttpsBinding_IPackageInq" binding="tns:BasicHttpsBinding_IPackageInq"> <soap:address location="https://valid.com/TopUp/PackageInq.svc"/> </wsdl:port> </wsdl:service> 的操作并得到:

client.bind('BasicHttpsBinding_IPackageInq')

如果您知道我可以阅读的任何优质文档,也很高兴提出您的建议。

更新 我找到了正确的语法

ValueError: Service not found

但在使用

时仍然
client.bind('PackageInq', 'BasicHttpsBinding_IPackageInq') 

再次击中无效端点

2 个答案:

答案 0 :(得分:0)

更仔细地阅读文档之后 def add_fast_rcnn_losses(model): """Add losses for RoI classification and bounding box regression.""" cls_prob, loss_cls = model.net.SoftmaxWithLoss( ['cls_score', 'labels_int32'], ['cls_prob', 'loss_cls'], scale=model.GetLossScale() ) loss_bbox = model.net.SmoothL1Loss( [ 'bbox_pred', 'bbox_targets', 'bbox_inside_weights', 'bbox_outside_weights' ], 'loss_bbox', scale=model.GetLossScale() ) loss_gradients = blob_utils.get_loss_gradients(model, [loss_cls, loss_bbox]) model.Accuracy(['cls_prob', 'labels_int32'], 'accuracy_cls') model.AddLosses(['loss_cls', 'loss_bbox']) model.AddMetrics('accuracy_cls') return loss_gradients 返回一个client.bind,您应该使用它而不是客户端。

所以应该是like

service

答案 1 :(得分:0)

zeep 4.0.0 版。

         <wsdl:service name="RiskAnalysis">
            <wsp:PolicyReference xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy" URI="#BasicPolicy"/>
            <wsdl:port name="RiskAnalysisHttpsSoap11Endpoint" binding="tns:RiskAnalysisSoap11Binding">
                <soap:address location="https://addreshere/"/>
            </wsdl:port>
            <wsdl:port name="RiskAnalysisHttpsSoap12Endpoint" binding="tns:RiskAnalysisSoap12Binding">
                <soap12:address location="https://addreshere/"/>
            </wsdl:port>
        </wsdl:service>


     from zeep import Client
        
     requestPayload = {'Attachment': inputQuery.encode() } 

     soapClient = Client('http://my-endpoint.com/production?wsdl', service_name=RiskAnalysis, port_name=RiskAnalysisHttpsSoap12Endpoint )
     soapClient.client.service.OPERATIONS(**requestPayload)