无法使用python suds摄取数据

时间:2011-11-21 04:21:44

标签: python suds attivio

我正在尝试使用python中的suds在Attivio(Active Intelligence Engine)中提取数据。文档ID,字段名称已成功摄取。但是fieldValue值没有填充。这是python代码:

from suds.client import Client
url = "http://localhost:17000/ws/bean.attivioIngestWebService/com.attivio.webservice.service.IngestApi?wsdl"
client = Client(url)
cfg = client.factory.create('sessionConfig')
cfg.commitInterval = 1
sessionId = client.service.connect(cfg)
doc = client.factory.create('attivioDocument')
doc._id = "Doc1"

text = client.factory.create('Field')
text._name = "text"
textval = client.factory.create('fieldValue')
textval.value = "Test document text"
text.values = [textval]

doc.fields = [text]
print doc
try:
    client.service.feed(sessionId, [doc])
    client.service.commit(sessionId)
except Exception as e:
  print e

更新: 请参阅下面的.net和python SOAP之间的区别。因为<value>被定义为anyType,所以suds不会在其上放置类型信息,并且AIE无法正确处理它。这可能是问题的根源。知道怎么解决吗?

达网络

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<feed xmlns="http://webservice.attivio.com/">
<sessionId xmlns="">704@10.7.3.7_r437gs-f879-4c58-9da5-45erf7as88ex</sessionId>
<docs readOnly="false" id="dotnet" xmlns="">
<fields name="title">
<values>
**<value xsi:type="xsd:string">Hello dot net</value>**
</values>
</fields>
</docs>
</feed>
</s:Body>
</s:Envelope>POST /ws/bean.attivioIngestWebService/com.attivio.webservice.service.IngestApi HTTP/1.1

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://webservice.attivio.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Header/>
   <ns0:Body>
      <ns1:feed>
         <sessionId>401@192.168.1.100_fnwsf5b5218-9159-4a8f-987a</sessionId>
         <docs id="Doc1">
            <fields name="text">
               <values>
                  **<value>Test document text</value>**
               </values>
               <metadata/>
            </fields>
            <mode/>
         </docs>
      </ns1:feed>
   </ns0:Body>
</SOAP-ENV:Envelope>

0 个答案:

没有答案