使用python 2.7,django 1.6,spyne 2.11
我有这个xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE inquiry_A2 SYSTEM "inquiry_A2.dtd">
<!-- Optional -->
<inquiry_A2>
<!-- Optional -->
<Consignee>
<AgencyCode>123123</AgencyCode>
<PartyID>123123</PartyID>
</Consignee>
<SubstitutionIndicator>123123</SubstitutionIndicator>
<Campaign>123123</Campaign>
<DocumentID>1</DocumentID>
</inquiry_A2>
inquiry_A2是根元素 我想让间谍继续这个请求,但我无法弄清楚如何做到这一点? 问题是spyne rpc需要方法名和param,例如:
@rpc(RequestInquiry)
def inquiry_A2(ctx, inquiry_A2):
return True
但是使用这个例子,spyne生成的xml是:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE inquiry_A2 SYSTEM "inquiry_A2.dtd">
<!-- Optional -->
<inquiry_A2>
<inquiry_A2>
<!-- Optional -->
<Consignee>
<AgencyCode>123123</AgencyCode>
<PartyID>123123</PartyID>
</Consignee>
<SubstitutionIndicator>123123</SubstitutionIndicator>
<Campaign>123123</Campaign>
<DocumentID>1</DocumentID>
</inquiry_A2>
</inquiry_A2>
这可能与spyne有关吗?我无法更改传入的xml
答案 0 :(得分:0)
你需要:
@rpc(RequestInquiry, _body_style='bare')
def inquiry_A2(ctx, inquiry_A2):
return True