2012-06-10 52 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「。

相關問題