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

Problem with arrays...

Expand Messages
  • eldoclimber
    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:
    Message 1 of 1 , Aug 5, 2004

      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"
      <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>
      <radius xsi:type="xsd:double">.05</radius>
      <radiusUnits xsi:type="xsd:string">decimal_degrees</radiusUnits>

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

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

      that results in xml like this:

      <circles SOAP-ENC:arrayType="xsd:ur-type[1]">

      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

      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,
    Your message has been successfully submitted and would be delivered to recipients shortly.