Python Suds 凭证
我正在尝试在 python 中使用soap api,但是我似乎无法正确设置我的标头。这是架构,有什么想法如何在泡沫中实现这一点吗?
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://namespace.com">
<xs:complexType name="Credentials"><xs:sequence/>
<xs:attribute name="username" type="xs:string" use="required"/>
<xs:attribute name="password" type="xs:string" use="required"/>
<xs:attribute name="customerID" type="xs:int"/>
</xs:complexType>
<xs:element name="credentials" nillable="true" type="Credentials"/></xs:schema>
I am attempting to work with soap api in python however I cannot seem to get my headers properly set. Here is the schema, any ideas how to accomplish this in suds?
<xs:schema attributeFormDefault="unqualified" elementFormDefault="unqualified" targetNamespace="http://namespace.com">
<xs:complexType name="Credentials"><xs:sequence/>
<xs:attribute name="username" type="xs:string" use="required"/>
<xs:attribute name="password" type="xs:string" use="required"/>
<xs:attribute name="customerID" type="xs:int"/>
</xs:complexType>
<xs:element name="credentials" nillable="true" type="Credentials"/></xs:schema>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
好的,我成功了。看来你可以设置自定义 xml 节点,所以我们开始
-CG
Ok, I got it working. It seems you can set custom xml nodes so here we go
-CG
由于您要创建的元素是在 WSDL 中定义的,因此您可以使用客户端的工厂创建它的实例:
请注意每个属性名称之前的
_
。这将它们与类型中具有相同名称的非属性区分开来。Since the element you're creating is defined in your WSDL, you can create an instance of it using the client's factory:
Note the
_
before each of the attribute names. This distinguishes them from non-attributes in the type that have the same name.您使用的是哪个版本的肥皂水?
which version of suds are you using?
我只是想分享我可以连接我的凭据的方式,希望对您有所帮助:
I just want to share the way i could connect with my credentials, i hope it help you: