我试着用肥皂水,但到目前为止还没有找到答案。
这应该是我需要实现的原始soap消息:
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:api="http://api.service.apimember.soapservice.com/">
<soapenv:Header/>
<soapenv:Body>
<api:insertOrUpdateMemberByObj>
<token>t67GFCygjhkjyUy8y9hkjhlkjhuii</token>
<member>
<dynContent>
<entry>
<key>FIRSTNAME</key>
<value>hhhhbbbbb</value>
</entry>
</dynContent>
<email>test@test.com</email>
</member>
</api:insertOrUpdateMemberByObj>
</soapenv:Body>
</soapenv:Envelope>
因此,我使用suds创建成员对象:
member = client.factory.create('member')
产生:
(apiMember){
attributes =
(attributes){
entry[] = <empty>
}
}
如何添加“entry”?
我试过这个:
member.attributes.entry.append({'key':'FIRSTNAME','value':'test'})
由此产生:
(apiMember){
attributes =
(attributes){
entry[] =
{
value = "test"
key = "FIRSTNAME"
},
}
}
然而,我真正需要的是:
(apiMember){
attributes =
(attributes){
entry[] =
(entry) {
value = "test"
key = "FIRSTNAME"
},
}
}
我怎样才能做到这一点?
仍然需要使用factory创建对象:
在我的头顶上(所有的肥皂水都在工作)
这确实取决于定义SOAP连接的WSDL,但是
attributes
也应该是WSDL中定义的结构。当我试图创建“entry”时会发生这种情况:
相关问题 更多 >
编程相关推荐