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

DATA Confused

Expand Messages
  • jleone@notes.cc.sunysb.edu
    Hi All, Now that I got the stuff doing the basics, I m attempting to do something more complicated. My ultimate goal is to send several pieces of data in a
    Message 1 of 3 , Sep 5, 2001
    • 0 Attachment
      Hi All,

      Now that I got the stuff doing the basics, I'm attempting to do
      something more complicated. My ultimate goal is to send several
      pieces of data in a request and several pieces back.

      This is what I have on the server end.

      #!perl -w
      use SOAP::Transport::HTTP;
      SOAP::Transport::HTTP::CGI
      -> dispatch_to('Demo')
      -> handle ;
      package Demo;
      sub hi {
      return SOAP::Data->name('blah')->value(12);
      }

      Does this send <blah>12</blah> maybe with an xsd integer or something
      thrown in? If it does, then I've achieved step 1. Step 2, would be
      to parse this. The closest I've come is using the control from VB
      and in my result I get the 12, but for the life of me, I can't figure
      out how to reference it as 'blah' something or other. I want to
      achieve this in both Perl and VB on the client side. The examples
      I've seen parse an array of parameters, whereas I want to reference
      them by name. Is this possible?

      Any insights would be appreciated,

      John.
    • Paul Kulchenko
      Hi, John! ... yes. ... yes. here is the prototype: package ...; use vars @ISA ; @ISA = SOAP::Server::Parameters ; sub paramsByNameOrOrder { my $self = shift;
      Message 2 of 3 , Sep 5, 2001
      • 0 Attachment
        Hi, John!

        > Does this send <blah>12</blah> maybe with an xsd integer or
        > something thrown in?
        yes.

        > I've seen parse an array of parameters, whereas I want to reference
        > them by name. Is this possible?
        yes. here is the prototype:

        package ...;

        use vars '@ISA'; @ISA = 'SOAP::Server::Parameters';

        sub paramsByNameOrOrder {
        my $self = shift;
        my($a, $b, $c) = byNameOrOrder([qw(a b c)], @_);

        # ...
        }

        # -------------------------------------------------------------

        sub byNameOrOrder {
        my $params = pop->method;
        my @mandatory = @{shift()} if ref $_[0] eq 'ARRAY';
        my $byname = 0;
        my @res = map { $byname += exists $params->{$_}; $params->{$_} }
        @mandatory;
        return $byname ? @res : @_;
        }

        sub byName {
        return @{pop->method}{ref $_[0] eq 'ARRAY' ? @{shift()} : die "list
        of parameters expected as the first parameter for byName"};
        }

        similar methods will be available, so you can just use them. Take a
        look into SOAP::SOM section in documentation for more information.
        Hope it helps.

        Best wishes, Paul.

        --- jleone@... wrote:
        > Hi All,
        >
        > Now that I got the stuff doing the basics, I'm attempting to do
        > something more complicated. My ultimate goal is to send several
        > pieces of data in a request and several pieces back.
        >
        > This is what I have on the server end.
        >
        > #!perl -w
        > use SOAP::Transport::HTTP;
        > SOAP::Transport::HTTP::CGI
        > -> dispatch_to('Demo')
        > -> handle ;
        > package Demo;
        > sub hi {
        > return SOAP::Data->name('blah')->value(12);
        > }
        >
        > Does this send <blah>12</blah> maybe with an xsd integer or
        > something
        > thrown in? If it does, then I've achieved step 1. Step 2, would
        > be
        > to parse this. The closest I've come is using the control from VB
        > and in my result I get the 12, but for the life of me, I can't
        > figure
        > out how to reference it as 'blah' something or other. I want to
        > achieve this in both Perl and VB on the client side. The examples
        > I've seen parse an array of parameters, whereas I want to reference
        >
        > them by name. Is this possible?
        >
        > Any insights would be appreciated,
        >
        > John.
        >
        >
        > ------------------------ 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 alerts & NEW webcam video instant messaging with Yahoo! Messenger
        http://im.yahoo.com
      • jleone@notes.cc.sunysb.edu
        Hi Paul, Some of what you wrote went a little over my head, but I followed your lead to go read the SOM docs. From them I got dataof and valueof to work on
        Message 3 of 3 , Sep 6, 2001
        • 0 Attachment
          Hi Paul,

          Some of what you wrote went a little over my head, but I followed
          your lead to go read the SOM docs. From them I got dataof and
          valueof to work on the client. So, I got named parameters coming
          back in both VB and Perl!

          I'm going to ask the Perl guru's to go over the code you just
          supplied, is this for a client or a server? To me it looks like the
          source code of SOM, is that correct?

          Also, can you use the SOM code to parse the incoming data to the
          server. If I can get names in there then we wouldn't have to be
          concerned over what order the data is when it's passed. That may
          prove useful, because it's a cross platform development, with
          different developer's working on different parts.

          By the way, Thanks so much! Your advice is helping me get the SOAP
          part of the project off the ground.

          John.




          --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
          > Hi, John!
          >
          > > Does this send <blah>12</blah> maybe with an xsd integer or
          > > something thrown in?
          > yes.
          >
          > > I've seen parse an array of parameters, whereas I want to
          reference
          > > them by name. Is this possible?
          > yes. here is the prototype:
          >
          > package ...;
          >
          > use vars '@ISA'; @ISA = 'SOAP::Server::Parameters';
          >
          > sub paramsByNameOrOrder {
          > my $self = shift;
          > my($a, $b, $c) = byNameOrOrder([qw(a b c)], @_);
          >
          > # ...
          > }
          >
          > # -------------------------------------------------------------
          >
          > sub byNameOrOrder {
          > my $params = pop->method;
          > my @mandatory = @{shift()} if ref $_[0] eq 'ARRAY';
          > my $byname = 0;
          > my @res = map { $byname += exists $params->{$_}; $params->{$_} }
          > @mandatory;
          > return $byname ? @res : @_;
          > }
          >
          > sub byName {
          > return @{pop->method}{ref $_[0] eq 'ARRAY' ? @{shift()} :
          die "list
          > of parameters expected as the first parameter for byName"};
          > }
          >
          > similar methods will be available, so you can just use them. Take a
          > look into SOAP::SOM section in documentation for more information.
          > Hope it helps.
          >
          > Best wishes, Paul.
          >
          > --- jleone@n... wrote:
          > > Hi All,
          > >
          > > Now that I got the stuff doing the basics, I'm attempting to do
          > > something more complicated. My ultimate goal is to send several
          > > pieces of data in a request and several pieces back.
          > >
          > > This is what I have on the server end.
          > >
          > > #!perl -w
          > > use SOAP::Transport::HTTP;
          > > SOAP::Transport::HTTP::CGI
          > > -> dispatch_to('Demo')
          > > -> handle ;
          > > package Demo;
          > > sub hi {
          > > return SOAP::Data->name('blah')->value(12);
          > > }
          > >
          > > Does this send <blah>12</blah> maybe with an xsd integer or
          > > something
          > > thrown in? If it does, then I've achieved step 1. Step 2, would
          > > be
          > > to parse this. The closest I've come is using the control from
          VB
          > > and in my result I get the 12, but for the life of me, I can't
          > > figure
          > > out how to reference it as 'blah' something or other. I want to
          > > achieve this in both Perl and VB on the client side. The
          examples
          > > I've seen parse an array of parameters, whereas I want to
          reference
          > >
          > > them by name. Is this possible?
          > >
          > > Any insights would be appreciated,
          > >
          > > John.
          > >
          > >
          > > ------------------------ Yahoo! Groups Sponsor
          > >
          > > To unsubscribe from this group, send an email to:
          > > soaplite-unsubscribe@y...
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          > > http://docs.yahoo.com/info/terms/
          > >
          > >
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Get email alerts & NEW webcam video instant messaging with Yahoo!
          Messenger
          > http://im.yahoo.com
        Your message has been successfully submitted and would be delivered to recipients shortly.