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

RE: [soaplite] How to type DATE and INTEGER ARRAY / LIST for MS .NET

Expand Messages
  • Paul Kulchenko
    Hi, Chris! I don t think that you still need it, but since it could be useful here is overview. If you want to add handler to autotype you need to modify
    Message 1 of 4 , Mar 21, 2001
    • 0 Attachment
      Hi, Chris!

      I don't think that you still need it, but since it could be useful
      here is overview.

      If you want to add handler to autotype you need to modify typelookup
      hash in your serializer:

      $s->typelookup->{myNewDataType} =
      [11,
      sub { $_[0] =~ m!^\d{4}-\d\d-\d\d \d\d:\d\d:\d\d$! },
      'as_myNewDataType'];

      where: myNewDataType is datatype's name,
      - 11 is the number in which autotype checks will apply,
      - second element in array is check that returns true/false and "true"
      means that this is type you want to handle
      - third element is name of subroutine that will handle this type in
      serialization

      as_myNewDataType may look like:

      sub SOAP::Serializer::as_myNewDataType {
      my $self = shift;
      my($value, $name, $type, $attr) = @_;
      return [$name,
      {%{$attr || {}}, 'xsi:type' => 'xsd:myNewDataType'},
      $value];
      }

      you may add your namespace instead of xsd: and specify it explicitly,
      or use maptype() and use

      'xsi:type' => $self->maptypetouri('myNewDataType')

      and it'll create prefix for you if neccessary. It'll also add URI
      only once.

      Now you may say:

      SOAP::Data->type(myNewDataType => '2001-03-20 19:20:20')>

      or just

      '2001-03-20 19:20:20'

      and you should get it.

      Take a look into SOAP::Serializer topic in SOAP::Lite's documentation
      for more information.

      Best wishes, Paul.

      --- Chris Davies <Chris.Davies@...> wrote:
      > Thanks Paul
      >
      > Armed with this I was able to go back to the other company, and
      > they said
      > that you were quite right - the interface definition document was
      > incorrect,
      > and the SDL file was definitive!
      >
      > As far as dates go, we're moving towards an ISO standard date
      > string
      > ("yyyy-mm-dd hh:mm:ss" style with times in UTC) so I will be able
      > to code
      > this up in perl easily enough.
      >
      > I look forward to your autotyping example when you've got a sec.
      > Chris
      >
      >
      > ------------------------ Yahoo! Groups Sponsor
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Get email at your own domain with Yahoo! Mail.
      http://personal.mail.yahoo.com/
    Your message has been successfully submitted and would be delivered to recipients shortly.