Loading ...
Sorry, an error occurred while loading the content.

3815Problem with arrays...

Expand Messages
  • eldoclimber
    Aug 5, 2004
    • 0 Attachment
      Hello,

      I'm working with a wsdl service that expects one of the parameters to
      be an array.

      Here's what their sample looks like:

      <circles xsi:type="SOAP-ENC:Array"
      SOAP-ENC:arrayType="m2:CircleDescription[1]">a
      <m2:item0 xsi:type="m2:CircleDescription">
      <center xsi:type="m0:Point">
      <x xsi:type="xsd:double">-117.1773</x>
      <y xsi:type="xsd:double">34</y>
      </center>
      <radius xsi:type="xsd:double">.05</radius>
      <radiusUnits xsi:type="xsd:string">decimal_degrees</radiusUnits>
      </m2:item0>
      </circles>

      First, I tried putting square braces around the data to be in the
      array, like this:

      SOAP::Data->name("circles" => [
      \SOAP::Data->value(
      SOAP::Data->name("radius" => $rad),
      SOAP::Data->name("radiusUnits" => "miles"),
      SOAP::Data->name("center" =>
      \SOAP::Data->value(
      SOAP::Data->name("x" => $lng),
      SOAP::Data->name("y" => $lat),
      ),
      ),
      ),
      ]),

      that results in xml like this:

      <circles SOAP-ENC:arrayType="xsd:ur-type[1]">
      <item>
      <radius>10</radius>
      <radiusUnits>miles</radiusUnits>
      <center>
      <x>-104.99809</x>
      <y>39.752615</y>
      </center>
      </item>
      </circles>

      I can see two problems here:
      first, the <item> tag in the example has a 0 in the name <item0>
      second, the arrayType is not the same, of course.

      I tried solving the first problem by replacing the square braces with
      parens, to make it a list instead. This results in the <item> tags
      disappearing completely. I have no idea how to get the item number in
      the item tag.


      For the second problem, I tried explicitly setting the arrayType to
      what it is in the example:

      ])->attr({'SOAP-ENC:arrayType' => 'CircleDescription[]'}),

      With that in place, I get this error:
      SchemaException: could not find a type with qname CircleDescription

      Without it, this is what I get:
      SchemaException: could not find a type with qname
      http://www.w3.org/1999/XMLSchema:ur-type


      I think part of the problem is that the correct namespaces are not
      being imported from the wsdl.

      So, the questions:

      1. How do I get the array element number to show up in the item tag
      (i.e. <item0>) ?
      2. Do I need to set the arrayType, or will it be automatically set
      once the namespaces are properly set?
      3. How do I get SOAP::Lite to pickup the namespaces from the wsdl?

      I'm sure these are relatively simple things, but I've been struggling
      for a few days now and can't figure them out.

      Thanks for the help,
      Ross