开发者

Consume SOAP webservices using escaped xml as attribute

I am using suds to consume SOAP web services like this way:

from suds.client import Client
url = "http://www.example.com?wsdl"
client = Client(url)
client.service.example(xml_argument)

If I call the method using this xml works:

<?xml version="1.0" encoding="UTF-8"?><a><b description="Foo Bar"></b></a>

But If I add a q开发者_StackOverflowuote (escaped) like this:

<?xml version="1.0" encoding="UTF-8"?><a><b description="Foo &quot; Bar"></b></a>

I get the following error (from the webservice):

Attribute name "Bar" associated with an element type "b" must be followed by the ' = ' character.

I am using version: 0.4 GA build: R699-20100913

Am I not using suds.client in the proper way? any suggestions?


UPDATE:

I have already contacted customer support, emailed them my escaped XML and they told me that it works for them, so probably is caused due a bad use from suds in my side. I'll give a try with PySimpleSOAP.


Mine is mostly a guess, but the error you are quoting seems to be generated from the XML well-formedness checker on the machine providing the service.

It seems that on that side of the cable they are getting something like:

<a><b description="Foo" Bar"></b></a>

(&quot; converted to ") and thus they are telling you that you should instead send something like:

<a><b description="Foo" Bar="..."></b></a>

which is clearly not what you want.

AFAIK your XML is well formed (just tested here for extra safety), so either there is a bug in suds (which would surprise me, given the magnitude of the bug and the maturity of the package) or there is a bug on the server providing the service (possibly a "too early conversion" from XML entities to regular chars).

Again: lot of speculation and few hard facts here, but I still HTH! :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜