2012-06-10 53 views
0

我正在尝试使用soap4r(来自https://github.com/mumboe/soap4r)为一个名为SysAid的产品编写SOAP客户端。Ruby的soap4r不提供名称空间?

我有一个在Java中的SOAP客户端的工作示例,对于大多数方法,我的Ruby客户端也可以工作。 Java客户端在确定Ruby版本的错误时非常有用。

当我使用特定的呼叫我收到一个错误:

SOAP::FaultError: prefix xs is not bound to a namespace 

下面是其产生的误差SOAP4R发送的消息,:

<?xml version="1.0" encoding="utf-8" ?> 
<env:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"> 
    <env:Body> 
    <n1:save xmlns:n1="http://api.ilient.com/"> 
     <sessionId>1339292997261</sessionId> 
     <apiSysObj xsi:type="n1:apiServiceRequest"> 
     <customDateFields></customDateFields> 
     <customFields> 
      <entry> 
      <key xsi:type="xs:string">sr_cust_dafis_fau</key> 
      <value xsi:type="xs:string"></value> 
      </entry> 
      <entry> 
      <key xsi:type="xs:string">sr_cust_activity</key> 
      </entry> 
     </customFields> 
     <description>This is the description of the ticket.</description> 
     </apiSysObj> 
    </n1:save> 
    </env:Body> 
</env:Envelope> 

,这里是什么样的Java发送了服务器做的相同的方法抱怨:

<?xml version="1.0" ?> 
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"> 
    <S:Body> 
    <ns2:save xmlns:ns2="http://api.ilient.com/"> 
     <sessionId>1339199684324</sessionId> 
     <apiSysObj xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns2:apiServiceRequest"> 
     <customDateFields/><customFields> 
     <entry> 
      <key xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">sr_cust_dafis_fau</key> 
      <value xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string"></value> 
     </entry> 
     <entry> 
      <key xmlns:xs="http://www.w3.org/2001/XMLSchema" xsi:type="xs:string">sr_cust_activity</key> 
     </entry> 
     </customFields> 
     <description>This is the description of the ticket.</description> 
    </apiSysObj> 
    </ns2:save> 
</S:Body> 
</S:Envelope> 

如您所见,错误来自customFields标记。 soap4r在关键标签上遗漏了xmlns:xs属性,而Java正在将其放入。

就我所知,soap4r在其他任何方法调用中都不会产生像这样的严重错误。

我如何获得soap4r将这个所需的属性添加到键标签?

回答

0

我认为命名空间“xmlns:xsd =”http://www.w3.org/2001/XMLSchema“已在”env:Envelope“中定义,问题是为什么在soap4r体中使用”xs :string“而不是”xsd:string“。

相关问题