0

I have a php client and a gsoap based (linux) service. When a call is made to one of the methods (services) I get the following exception:

Validation constraint violation: missing id for ref #ref1 in element 'env:Envelope'

The error revolves around a single argument in the call that represents a complex argument. The base of this argument is 'array-data' shown below in the wsdl.

Here is the relevant wsdl:

  <complexType name="data-elem">
   <sequence>
     <element name="name" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
     <element name="list" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
     <element name="length" type="xsd:int" minOccurs="1" maxOccurs="1"/>
     <element name="stype" type="xsd:int" minOccurs="1" maxOccurs="1"/>
     <element name="dtype" type="xsd:int" minOccurs="1" maxOccurs="1"/>
     <element name="permission" type="xsd:int" minOccurs="1" maxOccurs="1"/>
     <element name="message" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
    <choice>
     <element name="cdata" type="xsd:string" minOccurs="0" maxOccurs="1" nillable="true"/>
     <element name="idata" type="xsd:int" minOccurs="1" maxOccurs="1"/>
     <element name="fdata" type="xsd:float" minOccurs="1" maxOccurs="1"/>
     <element name="ddata" type="xsd:double" minOccurs="1" maxOccurs="1"/>
    </choice>
   </sequence>
  </complexType>
  <complexType name="data">
   <sequence>
     <element name="elems" type="ns:data-elem" minOccurs="0" maxOccurs="unbounded"/>
   </sequence>
  </complexType>
  <complexType name="array-data">
   <sequence>
     <element name="records" type="ns:data" minOccurs="0" maxOccurs="unbounded"/>
   </sequence>

Here is what the passed data looks like for this argument:

stdClass Object ( [records] => Array ( [0] => stdClass Object ( [elems] => Array ( [0] => stdClass Object ( [name] => SERVICE.d01 [list] => [length] => 15 [stype] => 1 [dtype] => 0 [permission] => 3 [message] => [cdata] => gerry@yohoo.com ) [1] => stdClass Object ( [name] => SERVICE.servdef [list] => [length] => 0 [stype] => 3 [dtype] => 0 [permission] => 1 [message] => [idata] => 3 ) ) ) [1] => stdClass Object ( [elems] => Array ( [0] => stdClass Object ( [name] => SERVICE.d01 [list] => [length] => 15 [stype] => 1 [dtype] => 0 [permission] => 3 [message] => [cdata] => gerry@yohoo.com ) [1] => stdClass Object ( [name] => SERVICE.servdef [list] => [length] => 0 [stype] => 3 [dtype] => 0 [permission] => 1 [message] => [idata] => 3 ) ) ) ) )

I'm not entirely certain that the passed data meets the schema but if I pass a single "records" array, the service call works without error.

The single array example looks like:

stdClass Object ( [records] => Array ( [0] => stdClass Object ( [elems] => Array ( [0] => stdClass Object ( [name] => SERVICE.d01 [list] => [length] => 15 [stype] => 1 [dtype] => 0 [permission] => 3 [message] => [cdata] => gerry@yohoo.com ) [1] => stdClass Object ( [name] => SERVICE.servdef [list] => [length] => 0 [stype] => 3 [dtype] => 0 [permission] => 1 [message] => [idata] => 2 ) ) ) ) )

The error is generated entirely from the php client validation. The server never gets called.

Anybody have any pointers or suggestions? What am I missing? What other data can I provide to help answer this? How to debug this?

Lucifer
  • 29,392
  • 25
  • 90
  • 143
user44021
  • 29
  • 7
  • Update on this. I created another service that returns the same object as the one the client is having trouble with and then compared the objects. The objects are exactly the same. So this looks like a bug in the php soap implementation. Any suggestions for getting around this? – user44021 Mar 13 '15 at 16:13
  • This turned out to be an issue with the same objects in two separate nodes being reference instead of duplicated in the xml. See [link](http://stackoverflow.com/questions/9744442/php-soapclient-creating-xml-references-for-identical-elements-makes-it-unaccept) – user44021 Mar 14 '15 at 04:36

0 Answers0