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

Sending an empty integer array

Expand Messages
  • fairview902
    I have a perl soap::lite client that communicates with a java web service. The java web service is expecting an array of integers (int[]) as an argument.
    Message 1 of 2 , Jul 29, 2003
    • 0 Attachment
      I have a perl soap::lite client that communicates with a java
      web service. The java web service is expecting an array of integers
      (int[]) as an argument. However, for my purposes, I do not have
      anything to place in the argument. Therefore, I wish to send an
      empty or null array.
      The problem is that perl does not type variables or arrays
      unless something is in them. If I send a blank array:

      $soap->function([]); - soap::lite encodes the array as
      an "anytype" array. Since this does not match the java prototype, an
      exception is thrown. If I place anything in the array,
      $soap->function([0]); , then it sends and array of integers, but with
      one item. I cannot have any items sent. The array must be an
      integer array of size 0.

      I have tried many different approaches to this, but nothing has
      worked. Can someone please tell me how to send an empty integer
      array in soap::lite?

      Thank you very much...
    • jpeyser
      There are a couple of ways to do it. First, you can redefine the schema subroutine anyTypeValue so that the default will be integer sub
      Message 2 of 2 , Jul 30, 2003
      • 0 Attachment
        There are a couple of ways to do it.

        First, you can redefine the schema subroutine anyTypeValue so that
        the default will be integer

        sub SOAP::XMLSchema1999::Serializer::anyTypeValue {'int'};

        Or, you can 'hardcode' the type using the attr switch.

        -> createTR(SOAP::Data->value([])->attr({'SOAP-ENC:arrayType'
        => 'xsd:int[0]'}))

        Jonathan


        --- In soaplite@yahoogroups.com, "fairview902" <jakem01@a...> wrote:
        > I have a perl soap::lite client that communicates with a java
        > web service. The java web service is expecting an array of
        integers
        > (int[]) as an argument. However, for my purposes, I do not have
        > anything to place in the argument. Therefore, I wish to send an
        > empty or null array.
        > The problem is that perl does not type variables or arrays
        > unless something is in them. If I send a blank array:
        >
        > $soap->function([]); - soap::lite encodes the array as
        > an "anytype" array. Since this does not match the java prototype,
        an
        > exception is thrown. If I place anything in the array,
        > $soap->function([0]); , then it sends and array of integers, but
        with
        > one item. I cannot have any items sent. The array must be an
        > integer array of size 0.
        >
        > I have tried many different approaches to this, but nothing
        has
        > worked. Can someone please tell me how to send an empty integer
        > array in soap::lite?
        >
        > Thank you very much...
      Your message has been successfully submitted and would be delivered to recipients shortly.