python - 无法从 Python 中的 SOAP 请求生成响应
问题描述
我正在使用本地 url 开发一个 API:http://localhost:8003/BioRad.PCR.CommandManager/SOCFXCommandService?wsdl 这需要打开 Bio-Rad CFX 应用程序才能访问该 url。
我使用以下代码使用 zeep 库创建了客户端:
client = Client(wsdl = 'http://localhost:8003/BioRad.PCR.CommandManager/SOCFXCommandService?wsdl')
API 服务XmlCommand
需要 xml 作为输入,因此我使用dicttoxml
库将我的 Python 对象转换为 xml
def Message2XML(message_type_object):
message = dicttoxml.dicttoxml(message_type_object, custom_root='Message')
return message
data = {'RegistrationID': "",
'RegisterService': ""}
xml = Message2XML(data)
python -mzeep http://localhost:8003/BioRad.PCR.CommandManager/SOCFXCommandService?wsdl
在控制台上运行会给出:
Service: SOCFXCommandService
Port: WSDualHttpBinding_ISOCFXCommandService (Soap12Binding: {http://tempuri.org/}WSDualHttpBinding_ISOCFXCommandService)
Operations:
OnServiceIsClosing(missing input message)
SubscribeToServiceIsClosing() ->
XmlCommand(xml: xsd:string) -> XmlCommandResult: xsd:string
输出控制台只是给出一个None
响应,即使它应该返回一个 xml 输出。以下是发送的消息和我得到的回复。
<?xml version="1.0" ?>
<Message>
<RegistrationID type="str"/>
<RegisterService type="str"/>
</Message>
None
解决方案
推荐阅读
- php - 此路由不支持 POST 方法。支持的方法: GET、HEAD 在 laravel 5.8
- javascript - 未定义错误窗口以在节点 js 中定义动态变量
- c++ - 遍历模板参数
- javascript - 将变量从函数传递到函数内的函数
- rabbitmq - 具有有效凭证的非来宾用户拒绝 RabbitMQ Web 管理控制台访问
- javascript - 如何将通过 AJAX 请求接收的 XML 文本转换为文件
- javascript - 从阵列深度检查中删除重复对象
- r - 如何创建具有特定数量的 TRUE / FALSE 条目的随机逻辑向量
- corda - 如何在 Corda 项目的 CLI 中传递对象
- angular - Angular 8 多个 mat-checkbox 需要验证