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

How to type DATE and INTEGER ARRAY / LIST for MS .NET

Expand Messages
  • Chris Davies
    Hi folks I m developing a SOAP::Lite based client that needs to talk to an MS .NET server. The interface specification I ve been given by the other company
    Message 1 of 4 , Mar 19, 2001
    View Source
    • 0 Attachment
      Hi folks

      I'm developing a SOAP::Lite based client that needs to talk to an MS .NET
      server. The interface specification I've been given by "the other company"
      includes some reference to strings and integers, both of which I'm
      reasonably happy about.

      However, part of its interface definition includes one parameter that has
      been described as DATE format. Yet another function takes an "INTEGER ARRAY
      OR LIST".


      1. Do I need to explicitly type these items, or will the auto-typing code
      get it right? If so, how should I format a date for it to recognise one?

      2. Will the auto-typing code "get it right" for non-numeric strings, and
      integers?

      3. Can parameter names have spaces in them? I didn't think so, but the spec
      I've been given includes references to names such as "Customer Id".


      Many thanks,
      Chris
      --
      Chris Davies, Manheim Interactive (Europe)
      Tel. 0870 444-0450 Fax. 0870 444-0482 Email. MOL@...
    • Paul Kulchenko
      Hi, Chris! ... You may specify it explicitly, though you may add function to autotyping to get it right. I ll post the example later. ... yes. ... You re
      Message 2 of 4 , Mar 19, 2001
      View Source
      • 0 Attachment
        Hi, Chris!

        > 1. Do I need to explicitly type these items, or will the
        > auto-typing code
        > get it right? If so, how should I format a date for it to recognise
        > one?
        You may specify it explicitly, though you may add function to
        autotyping to get it right. I'll post the example later.

        > 2. Will the auto-typing code "get it right" for non-numeric
        > strings, and integers?
        yes.

        > 3. Can parameter names have spaces in them? I didn't think so, but
        > the spec
        > I've been given includes references to names such as "Customer Id".
        You're right, it shouldn't. Though SOAP::Lite could handle hashes
        with keys that have spaces (or binaries) in them, but it's done
        through Map type and as far as I know it's supported only by
        ApacheSOAp2.1 and SOAP::Lite, so you won't be able to use it with
        .Net. Either there is other options available (on their side) or
        something wrong with interface spec.

        Hope it helps. I'll post code next hour.

        Best wishes, Paul.

        --- Chris Davies <Chris.Davies@...> wrote:
        > I'm developing a SOAP::Lite based client that needs to talk to an
        > MS .NET
        > server. The interface specification I've been given by "the other
        > company"
        > includes some reference to strings and integers, both of which I'm
        > reasonably happy about.
        >
        > However, part of its interface definition includes one parameter
        > that has
        > been described as DATE format. Yet another function takes an
        > "INTEGER ARRAY
        > OR LIST".
        >
        >
        > 1. Do I need to explicitly type these items, or will the
        > auto-typing code
        > get it right? If so, how should I format a date for it to recognise
        > one?
        >
        > 2. Will the auto-typing code "get it right" for non-numeric
        > strings, and
        > integers?
        >
        > 3. Can parameter names have spaces in them? I didn't think so, but
        > the spec
        > I've been given includes references to names such as "Customer Id".
        >
        >
        > Many thanks,
        > Chris
        > --
        > Chris Davies, Manheim Interactive (Europe)
        > Tel. 0870 444-0450 Fax. 0870 444-0482 Email.
        > MOL@...
        >
        >
        > ------------------------ 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/
      • Chris Davies
        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
        Message 3 of 4 , Mar 21, 2001
        View Source
        • 0 Attachment
          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
        • 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 4 of 4 , Mar 21, 2001
          View Source
          • 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.