【发布时间】:2010-05-29 01:08:47
【问题描述】:
我正在尝试使用 suds,但到目前为止还没有成功。
这应该是我需要实现的原始肥皂消息:
<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>
}
}
究竟如何附加“条目”?
我试过这个:
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"
},
}
}
我如何做到这一点?
【问题讨论】: