0

I'm attempting to use soap4r (from https://github.com/mumboe/soap4r) to write a SOAP Client for a product called SysAid.

I have a working example of the SOAP client in Java and, for most methods, my Ruby client works too. The Java client is useful in determining errors with the Ruby version.

I'm receiving an error when I use a particular call:

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

Here's the message that soap4r sent, which generated that error:

<?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>

And here is what Java sends for the same method, which the server does not complain about:

<?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>

As you can see, the error is coming from the customFields tag. soap4r is leaving out the xmlns:xs attribute on the key tag, while Java is putting it in.

soap4r does not make critical errors like this on any other method call as far as I can tell.

How can I get soap4r to add this needed attribute to the key tag?

pnuts
  • 58,317
  • 11
  • 87
  • 139
Christopher
  • 1,635
  • 5
  • 19
  • 30

1 Answers1

0

I think the namespace "xmlns:xsd="http://www.w3.org/2001/XMLSchema" has been defined in the "env:Envelope", the problem is why in the body soap4r uses "xs:string" instead of "xsd:string".