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

Re: Newbie question

Expand Messages
  • Silly Yahoo Readers
    Since writing the below I found the SOAP::Data- type(...) thingy (attribute? directive?) and played around with a few settings. When I specify the default
    Message 1 of 9 , Oct 22, 2001
    • 0 Attachment
      Since writing the below I found the SOAP::Data->type(...) thingy
      (attribute? directive?) and played around with a few settings. When I
      specify the default (base64) my server finds and parses the message.
      When I specify 'xml' I get the following error:

      Fault: SOAP-ENV:Server, not well-formed (invalid token) at line 1,
      column 4, byte 4 at /usr/local/lib/perl5/site_perl/5.6.1/i686-
      linux/XML/Parser.pm line 185

      *Sigh* Help?

      --
      Robert Taylor

      --- In soaplite@y..., Robert Taylor <theonetowhommyrefers@y...> wrote:
      > I created my first data-based connected SOAP
      > client/server combination using SOAP-Lite. Now I want
      > my business partner to be able to use my HTTPS/CGI
      > SOAP server and have run into a problem.
      >
      > My goal is to receive an XML record for import into my
      > (MySQL) database. The partner defined the record but
      > I'm defining the SOAP service.
      >
      > A few questions:
      >
      > 1) If the @lines in "$soap->store(@lines)" contains a
      > well-formed and x-schema validated XML file, why is
      > the payload (right term?) serialized?
      >
      > 2) Related to (1) -- the data sent to the server is
      > encoded (base 64?). Must it be?
      >
      > 3) My partner is coding his own client (not using
      > SOAP::Lite, but something in C++ on an MS platform --
      > not using .NET tools either). He's sending basically
      > handcrafted SOAP messages with the Body a simple XML
      > file. When I showed him the output of my client.cgi
      > (below) using the "on_debug" method he balked at the
      > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
      > the XML file.
      >
      > Pretend my XML Data looks like this:
      >
      > <Test>
      > <Question id="1" type="short answer"><text>What is
      > the correct spelling of your name?</text></Question>
      > <Question id="2" type="multiple choice"><text>What
      > is your gender?</text>
      > <option id="A">Male</option>
      > <option id="B">Female</option>
      > <option id="C">Cowboy Neal</option>
      > </Question>
      > </Test>
      >
      >
      > Why is it encoded with the <c-gensym3...> tags?
      > (Dumped using on_debug)?
      >
      > POST https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi
      > Accept: text/xml
      > Accept: multipart/*
      > Content-Length: 1434
      > Content-Type: text/xml; charset=utf-8
      > SOAPAction: "https://xxx.xxx.xxx.xxx/ONE#store"
      >
      > <?xml version="1.0" encoding="UTF-8"?>
      > <SOAP-ENV:Envelope
      > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
      > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
      > >
      > <SOAP-ENV:Body
      > >
      > <namesp1:newrx
      > xmlns:namesp1="https://xxx.xxx.xxx.xxx/ONE"
      > >
      > <c-gensym3 xsi:type="xsd:string"
      > ><?xml version="1.0" encoding="UTF-8"?>
      > </c-gensym3>
      > <c-gensym5 xsi:type="xsd:string"
      > ><Test>
      > </c-gensym5>
      > <c-gensym7 xsi:type="xsd:string"
      > > <Question id="1" type="short
      > answer"><text>What is the correct spelling of your
      > name?</text></Question>
      > </c-gensym7>
      > <c-gensym9 xsi:type="xsd:string"
      > > <Question id="2" type="multiple
      > choice"><text>What is your gender?</text>
      > </c-gensym9>
      > <c-gensym11 xsi:type="xsd:string"
      > > <option id="A">Male</option>
      > </c-gensym11>
      > <c-gensym13 xsi:type="xsd:string"
      > > <option id="B">Female</option>
      > </c-gensym13>
      > <c-gensym15 xsi:type="xsd:string"
      > > <option id="C">Cowboy Neal</option>
      > </c-gensym15>
      > <c-gensym17 xsi:type="xsd:string"
      > > </Question>
      > </c-gensym17>
      > <c-gensym19 xsi:type="xsd:string"
      > ></Test>
      > </c-gensym19></namesp1:newrx></SOAP-ENV:Body></SOAP-ENV:Envelope>
      >
      > 4) What's the best way to send/receive a well-formed
      > and x-schema validating XML data record for import
      > into a local database?
      >
      > Here's my client:
      >
      > #!/usr/local/bin/perl -w
      > # SOAP Client -> simulates XML Data transfer via
      > # SOAP.
      > use SOAP::Lite;
      >
      > my $server =
      > 'https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi';
      >
      > #==========================
      > # Read in XML as if stream
      > #--------------------------
      > open (FILE, "<data.xml");
      > my @lines = <FILE>;
      > close(FILE);
      >
      > #--------------------------
      > # Setup call
      > #--------------------------
      > my $soap = SOAP::Lite
      > -> uri('https://xxx.xxx.xxx.xxx/ONE')
      > -> proxy($server)
      > ;
      > my $result = $soap->store(@lines);
      >
      > #processing of $result excluded
      >
      >
      > My server is simple:
      >
      > #!/usr/local/bin/perl -w
      > # SOAP Server - stores XML data in database
      > use SOAP::Transport::HTTP;
      >
      > SOAP::Transport::HTTP::CGI
      > -> dispatch_to('ONE')
      > -> handle;
      >
      > package ONE;
      >
      >
      > sub store {
      > my ($self, @passed) = @_;
      > use XML::EasyOBJ; # yep, I'm using this module
      > #=========================
      > # Force input to tmp file
      > #
      > # *Sigh* couldn't find a
      > # way to parse streamed
      > # data with EasyOBJ...
      > #-------------------------
      > use IO::File;
      > use POSIX qw(tmpnam);
      > use File::Copy;
      > use Time::HiRes qw(gettimeofday);
      >
      > my ($fname,$fh);
      > do { $fname = tmpnam() }
      > until $fh = IO::File->new($fname,
      > O_RDWR|O_CREAT|O_EXCL);
      >
      > foreach (@passed) {
      > print $fh $_;
      > }
      >
      > close($fh);
      >
      > my $bak_dir = '../backups/';
      > my $ext = gettimeofday;
      > copy ($fname,"${bak_dir}store.$ext")
      > || warn "Could not copy $fname: $!";
      > #=========================
      >
      >
      > #=========================
      > # Process XML with EasyOBJ
      > #-------------------------
      >
      > #-------------------------------------
      > # Use temp file for EasyOBJ processing
      > #-------------------------------------
      > my $doc = new XML::EasyOBJ($fname)
      > || die "XML::EasyOBJ error: $!";
      >
      > ## processing of $doc excluded. It just stores the
      > ## data in a MySQL table. Result of processing
      > ## stored in $result
      >
      > return $result;
      >
      > }
      >
      >
      > Thanks reading this far!
      >
      > --
      > Robert Taylor
      >
      >
      > __________________________________________________
      > Do You Yahoo!?
      > Make a great connection at Yahoo! Personals.
      > http://personals.yahoo.com
    • Paul Kulchenko
      Hi, Robert! SOAP::Data- type(xml = ...) is the way to send XML fragment that will look like XML on wire. SOAP::Lite doesn t do any validation in this case, so
      Message 2 of 9 , Oct 22, 2001
      • 0 Attachment
        Hi, Robert!

        SOAP::Data->type(xml => ...) is the way to send XML fragment that
        will look like XML on wire. SOAP::Lite doesn't do any validation in
        this case, so it's quite possible that generated XML (by itself or in
        combination with SOAP envelope) is invalid. ->type(base64 => ...)
        doesn't have this problem and always generate valid XML. You may see
        what do you have on wire if you switch on debug info on client side
        with ->on_debug(sub{print@_}).

        If you insert XML as a fragment I do not recommend you to use
        unqualified 'id' attributes, because they may interfere with 'id'
        attribute that is used by SOAP itself (yet you'll be able to access
        that attribute).

        > > 4) What's the best way to send/receive a well-formed
        > > and x-schema validating XML data record for import
        > > into a local database?
        I would say base64 is the best way to go (esp. if XML processing is
        required on another side anyway), because if you encode XML as a
        fragment you'll need to write custom deserializer to process your
        data. Let me know if you have any questions.

        Best wishes, Paul.

        --- Silly Yahoo Readers <theonetowhommyrefers@...> wrote:
        > Since writing the below I found the SOAP::Data->type(...) thingy
        > (attribute? directive?) and played around with a few settings. When
        > I
        > specify the default (base64) my server finds and parses the
        > message.
        > When I specify 'xml' I get the following error:
        >
        > Fault: SOAP-ENV:Server, not well-formed (invalid token) at line 1,
        > column 4, byte 4 at /usr/local/lib/perl5/site_perl/5.6.1/i686-
        > linux/XML/Parser.pm line 185
        >
        > *Sigh* Help?
        >
        > --
        > Robert Taylor
        >
        > --- In soaplite@y..., Robert Taylor <theonetowhommyrefers@y...>
        > wrote:
        > > I created my first data-based connected SOAP
        > > client/server combination using SOAP-Lite. Now I want
        > > my business partner to be able to use my HTTPS/CGI
        > > SOAP server and have run into a problem.
        > >
        > > My goal is to receive an XML record for import into my
        > > (MySQL) database. The partner defined the record but
        > > I'm defining the SOAP service.
        > >
        > > A few questions:
        > >
        > > 1) If the @lines in "$soap->store(@lines)" contains a
        > > well-formed and x-schema validated XML file, why is
        > > the payload (right term?) serialized?
        > >
        > > 2) Related to (1) -- the data sent to the server is
        > > encoded (base 64?). Must it be?
        > >
        > > 3) My partner is coding his own client (not using
        > > SOAP::Lite, but something in C++ on an MS platform --
        > > not using .NET tools either). He's sending basically
        > > handcrafted SOAP messages with the Body a simple XML
        > > file. When I showed him the output of my client.cgi
        > > (below) using the "on_debug" method he balked at the
        > > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
        > > the XML file.
        > >
        > > Pretend my XML Data looks like this:
        > >
        > > <Test>
        > > <Question id="1" type="short answer"><text>What is
        > > the correct spelling of your name?</text></Question>
        > > <Question id="2" type="multiple choice"><text>What
        > > is your gender?</text>
        > > <option id="A">Male</option>
        > > <option id="B">Female</option>
        > > <option id="C">Cowboy Neal</option>
        > > </Question>
        > > </Test>
        > >
        > >
        > > Why is it encoded with the <c-gensym3...> tags?
        > > (Dumped using on_debug)?
        > >
        > > POST https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi
        > > Accept: text/xml
        > > Accept: multipart/*
        > > Content-Length: 1434
        > > Content-Type: text/xml; charset=utf-8
        > > SOAPAction: "https://xxx.xxx.xxx.xxx/ONE#store"
        > >
        > > <?xml version="1.0" encoding="UTF-8"?>
        > > <SOAP-ENV:Envelope
        > > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
        > >
        > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
        > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
        > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
        > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
        > > >
        > > <SOAP-ENV:Body
        > > >
        > > <namesp1:newrx
        > > xmlns:namesp1="https://xxx.xxx.xxx.xxx/ONE"
        > > >
        > > <c-gensym3 xsi:type="xsd:string"
        > > ><?xml version="1.0" encoding="UTF-8"?>
        > > </c-gensym3>
        > > <c-gensym5 xsi:type="xsd:string"
        > > ><Test>
        > > </c-gensym5>
        > > <c-gensym7 xsi:type="xsd:string"
        > > > <Question id="1" type="short
        > > answer"><text>What is the correct spelling of your
        > > name?</text></Question>
        > > </c-gensym7>
        > > <c-gensym9 xsi:type="xsd:string"
        > > > <Question id="2" type="multiple
        > > choice"><text>What is your gender?</text>
        > > </c-gensym9>
        > > <c-gensym11 xsi:type="xsd:string"
        > > > <option id="A">Male</option>
        > > </c-gensym11>
        > > <c-gensym13 xsi:type="xsd:string"
        > > > <option id="B">Female</option>
        > > </c-gensym13>
        > > <c-gensym15 xsi:type="xsd:string"
        > > > <option id="C">Cowboy Neal</option>
        > > </c-gensym15>
        > > <c-gensym17 xsi:type="xsd:string"
        > > > </Question>
        > > </c-gensym17>
        > > <c-gensym19 xsi:type="xsd:string"
        > > ></Test>
        > > </c-gensym19></namesp1:newrx></SOAP-ENV:Body></SOAP-ENV:Envelope>
        > >
        > > 4) What's the best way to send/receive a well-formed
        > > and x-schema validating XML data record for import
        > > into a local database?
        > >
        > > Here's my client:
        > >
        > > #!/usr/local/bin/perl -w
        > > # SOAP Client -> simulates XML Data transfer via
        > > # SOAP.
        > > use SOAP::Lite;
        > >
        > > my $server =
        > > 'https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi';
        > >
        > > #==========================
        > > # Read in XML as if stream
        > > #--------------------------
        > > open (FILE, "<data.xml");
        > > my @lines = <FILE>;
        > > close(FILE);
        > >
        > > #--------------------------
        > > # Setup call
        > > #--------------------------
        > > my $soap = SOAP::Lite
        > > -> uri('https://xxx.xxx.xxx.xxx/ONE')
        > > -> proxy($server)
        > > ;
        > > my $result = $soap->store(@lines);
        > >
        > > #processing of $result excluded
        > >
        > >
        > > My server is simple:
        > >
        > > #!/usr/local/bin/perl -w
        > > # SOAP Server - stores XML data in database
        > > use SOAP::Transport::HTTP;
        > >
        > > SOAP::Transport::HTTP::CGI
        > > -> dispatch_to('ONE')
        > > -> handle;
        > >
        > > package ONE;
        > >
        > >
        > > sub store {
        > > my ($self, @passed) = @_;
        > > use XML::EasyOBJ; # yep, I'm using this module
        > > #=========================
        > > # Force input to tmp file
        > > #
        > > # *Sigh* couldn't find a
        > > # way to parse streamed
        > > # data with EasyOBJ...
        > > #-------------------------
        > > use IO::File;
        > > use POSIX qw(tmpnam);
        > > use File::Copy;
        > > use Time::HiRes qw(gettimeofday);
        > >
        > > my ($fname,$fh);
        > > do { $fname = tmpnam() }
        > > until $fh = IO::File->new($fname,
        > > O_RDWR|O_CREAT|O_EXCL);
        > >
        > > foreach (@passed) {
        > > print $fh $_;
        > > }
        > >
        > > close($fh);
        > >
        > > my $bak_dir = '../backups/';
        > > my $ext = gettimeofday;
        > > copy ($fname,"${bak_dir}store.$ext")
        > > || warn "Could not copy $fname: $!";
        > > #=========================
        > >
        > >
        > > #=========================
        > > # Process XML with EasyOBJ
        > > #-------------------------
        > >
        > > #-------------------------------------
        > > # Use temp file for EasyOBJ processing
        > > #-------------------------------------
        > > my $doc = new XML::EasyOBJ($fname)
        >
        === message truncated ===


        __________________________________________________
        Do You Yahoo!?
        Make a great connection at Yahoo! Personals.
        http://personals.yahoo.com
      • Silly Yahoo Readers
        Paul, Sometime around 3 AM I started getting it... ;-) Thanks for your input in this forum, etc. Now I m using type(xml = ...) and am able to get the elements
        Message 3 of 9 , Oct 22, 2001
        • 0 Attachment
          Paul,

          Sometime around 3 AM I started getting it... ;-) Thanks for your
          input in this forum, etc.

          Now I'm using type(xml =>...) and am able to get the elements (not
          the attributes) of the XML record. Is there a way to get the
          attributes, too? I can get at the elements with a simple

          return "root__child: $_[0]->{root}->{child}";

          How do I access the attributes in the XML Data?

          Here's my simple server:

          #!/usr/local/bin/perl -w
          use SOAP::Transport::HTTP;

          SOAP::Transport::HTTP::CGI
          -> dispatch_to('ONE')
          -> handle;

          package ONE;

          sub dump {
          my ($class, @params) = @_;
          use Data::Dumper;
          #return Dumper(@params); # Dumps DOM tree, no attributes
          return $params[0]->{ROOT}->{some}->{node}; # access elements
          }

          exit;

          --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
          > Hi, Robert!
          >
          > SOAP::Data->type(xml => ...) is the way to send XML fragment that
          > will look like XML on wire. SOAP::Lite doesn't do any validation in
          > this case, so it's quite possible that generated XML (by itself or
          in
          > combination with SOAP envelope) is invalid. ->type(base64 => ...)
          > doesn't have this problem and always generate valid XML. You may see
          > what do you have on wire if you switch on debug info on client side
          > with ->on_debug(sub{print@_}).
          >
          > If you insert XML as a fragment I do not recommend you to use
          > unqualified 'id' attributes, because they may interfere with 'id'
          > attribute that is used by SOAP itself (yet you'll be able to access
          > that attribute).
          >
          > > > 4) What's the best way to send/receive a well-formed
          > > > and x-schema validating XML data record for import
          > > > into a local database?
          > I would say base64 is the best way to go (esp. if XML processing is
          > required on another side anyway), because if you encode XML as a
          > fragment you'll need to write custom deserializer to process your
          > data. Let me know if you have any questions.
          >
          > Best wishes, Paul.
          >
          > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
          > > Since writing the below I found the SOAP::Data->type(...) thingy
          > > (attribute? directive?) and played around with a few settings.
          When
          > > I
          > > specify the default (base64) my server finds and parses the
          > > message.
          > > When I specify 'xml' I get the following error:
          > >
          > > Fault: SOAP-ENV:Server, not well-formed (invalid token) at line
          1,
          > > column 4, byte 4 at /usr/local/lib/perl5/site_perl/5.6.1/i686-
          > > linux/XML/Parser.pm line 185
          > >
          > > *Sigh* Help?
          > >
          > > --
          > > Robert Taylor
          > >
          > > --- In soaplite@y..., Robert Taylor <theonetowhommyrefers@y...>
          > > wrote:
          > > > I created my first data-based connected SOAP
          > > > client/server combination using SOAP-Lite. Now I want
          > > > my business partner to be able to use my HTTPS/CGI
          > > > SOAP server and have run into a problem.
          > > >
          > > > My goal is to receive an XML record for import into my
          > > > (MySQL) database. The partner defined the record but
          > > > I'm defining the SOAP service.
          > > >
          > > > A few questions:
          > > >
          > > > 1) If the @lines in "$soap->store(@lines)" contains a
          > > > well-formed and x-schema validated XML file, why is
          > > > the payload (right term?) serialized?
          > > >
          > > > 2) Related to (1) -- the data sent to the server is
          > > > encoded (base 64?). Must it be?
          > > >
          > > > 3) My partner is coding his own client (not using
          > > > SOAP::Lite, but something in C++ on an MS platform --
          > > > not using .NET tools either). He's sending basically
          > > > handcrafted SOAP messages with the Body a simple XML
          > > > file. When I showed him the output of my client.cgi
          > > > (below) using the "on_debug" method he balked at the
          > > > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
          > > > the XML file.
          > > >
          > > > Pretend my XML Data looks like this:
          > > >
          > > > <Test>
          > > > <Question id="1" type="short answer"><text>What is
          > > > the correct spelling of your name?</text></Question>
          > > > <Question id="2" type="multiple choice"><text>What
          > > > is your gender?</text>
          > > > <option id="A">Male</option>
          > > > <option id="B">Female</option>
          > > > <option id="C">Cowboy Neal</option>
          > > > </Question>
          > > > </Test>
          > > >
          > > >
          > > > Why is it encoded with the <c-gensym3...> tags?
          > > > (Dumped using on_debug)?
          > > >
          > > > POST https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi
          > > > Accept: text/xml
          > > > Accept: multipart/*
          > > > Content-Length: 1434
          > > > Content-Type: text/xml; charset=utf-8
          > > > SOAPAction: "https://xxx.xxx.xxx.xxx/ONE#store"
          > > >
          > > > <?xml version="1.0" encoding="UTF-8"?>
          > > > <SOAP-ENV:Envelope
          > > > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
          > > >
          > > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
          > > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
          > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
          > > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
          > > > >
          > > > <SOAP-ENV:Body
          > > > >
          > > > <namesp1:newrx
          > > > xmlns:namesp1="https://xxx.xxx.xxx.xxx/ONE"
          > > > >
          > > > <c-gensym3 xsi:type="xsd:string"
          > > > ><?xml version="1.0" encoding="UTF-8"?>
          > > > </c-gensym3>
          > > > <c-gensym5 xsi:type="xsd:string"
          > > > ><Test>
          > > > </c-gensym5>
          > > > <c-gensym7 xsi:type="xsd:string"
          > > > > <Question id="1" type="short
          > > > answer"><text>What is the correct spelling of your
          > > > name?</text></Question>
          > > > </c-gensym7>
          > > > <c-gensym9 xsi:type="xsd:string"
          > > > > <Question id="2" type="multiple
          > > > choice"><text>What is your gender?</text>
          > > > </c-gensym9>
          > > > <c-gensym11 xsi:type="xsd:string"
          > > > > <option id="A">Male</option>
          > > > </c-gensym11>
          > > > <c-gensym13 xsi:type="xsd:string"
          > > > > <option id="B">Female</option>
          > > > </c-gensym13>
          > > > <c-gensym15 xsi:type="xsd:string"
          > > > > <option id="C">Cowboy Neal</option>
          > > > </c-gensym15>
          > > > <c-gensym17 xsi:type="xsd:string"
          > > > > </Question>
          > > > </c-gensym17>
          > > > <c-gensym19 xsi:type="xsd:string"
          > > > ></Test>
          > > > </c-gensym19></namesp1:newrx></SOAP-ENV:Body></SOAP-
          ENV:Envelope>
          > > >
          > > > 4) What's the best way to send/receive a well-formed
          > > > and x-schema validating XML data record for import
          > > > into a local database?
          > > >
          > > > Here's my client:
          > > >
          > > > #!/usr/local/bin/perl -w
          > > > # SOAP Client -> simulates XML Data transfer via
          > > > # SOAP.
          > > > use SOAP::Lite;
          > > >
          > > > my $server =
          > > > 'https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi';
          > > >
          > > > #==========================
          > > > # Read in XML as if stream
          > > > #--------------------------
          > > > open (FILE, "<data.xml");
          > > > my @lines = <FILE>;
          > > > close(FILE);
          > > >
          > > > #--------------------------
          > > > # Setup call
          > > > #--------------------------
          > > > my $soap = SOAP::Lite
          > > > -> uri('https://xxx.xxx.xxx.xxx/ONE')
          > > > -> proxy($server)
          > > > ;
          > > > my $result = $soap->store(@lines);
          > > >
          > > > #processing of $result excluded
          > > >
          > > >
          > > > My server is simple:
          > > >
          > > > #!/usr/local/bin/perl -w
          > > > # SOAP Server - stores XML data in database
          > > > use SOAP::Transport::HTTP;
          > > >
          > > > SOAP::Transport::HTTP::CGI
          > > > -> dispatch_to('ONE')
          > > > -> handle;
          > > >
          > > > package ONE;
          > > >
          > > >
          > > > sub store {
          > > > my ($self, @passed) = @_;
          > > > use XML::EasyOBJ; # yep, I'm using this module
          > > > #=========================
          > > > # Force input to tmp file
          > > > #
          > > > # *Sigh* couldn't find a
          > > > # way to parse streamed
          > > > # data with EasyOBJ...
          > > > #-------------------------
          > > > use IO::File;
          > > > use POSIX qw(tmpnam);
          > > > use File::Copy;
          > > > use Time::HiRes qw(gettimeofday);
          > > >
          > > > my ($fname,$fh);
          > > > do { $fname = tmpnam() }
          > > > until $fh = IO::File->new($fname,
          > > > O_RDWR|O_CREAT|O_EXCL);
          > > >
          > > > foreach (@passed) {
          > > > print $fh $_;
          > > > }
          > > >
          > > > close($fh);
          > > >
          > > > my $bak_dir = '../backups/';
          > > > my $ext = gettimeofday;
          > > > copy ($fname,"${bak_dir}store.$ext")
          > > > || warn "Could not copy $fname: $!";
          > > > #=========================
          > > >
          > > >
          > > > #=========================
          > > > # Process XML with EasyOBJ
          > > > #-------------------------
          > > >
          > > > #-------------------------------------
          > > > # Use temp file for EasyOBJ processing
          > > > #-------------------------------------
          > > > my $doc = new XML::EasyOBJ($fname)
          > >
          > === message truncated ===
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Make a great connection at Yahoo! Personals.
          > http://personals.yahoo.com
        • Paul Kulchenko
          Hi, Robert! ... ;) ... you need to do something like this (you can find more details in docs ... @ONE::ISA = SOAP::Server::Parameters ; ... my $env = pop; ...
          Message 4 of 9 , Oct 22, 2001
          • 0 Attachment
            Hi, Robert!

            --- Silly Yahoo Readers <theonetowhommyrefers@...> wrote:
            > Sometime around 3 AM I started getting it... ;-) Thanks for your
            ;)

            > How do I access the attributes in the XML Data?
            you need to do something like this (you can find more details in docs
            and examples):

            > package ONE;
            @ONE::ISA = 'SOAP::Server::Parameters';
            >
            > sub dump {
            my $env = pop;
            > my ($class, @params) = @_;
            > use Data::Dumper;
            > #return Dumper(@params); # Dumps DOM tree, no attributes
            return $env->dataof('//Test/Question')->attr->{type}
            # should return "short answer"
            # dataof() returns SOAP::Data attribute that you can access
            # for attributes and other information
            > return $params[0]->{ROOT}->{some}->{node}; # access elements
            > }

            Best wishes, Paul.

            --- Silly Yahoo Readers <theonetowhommyrefers@...> wrote:
            > Paul,
            >
            > Sometime around 3 AM I started getting it... ;-) Thanks for your
            > input in this forum, etc.
            >
            > Now I'm using type(xml =>...) and am able to get the elements (not
            > the attributes) of the XML record. Is there a way to get the
            > attributes, too? I can get at the elements with a simple
            >
            > return "root__child: $_[0]->{root}->{child}";
            >
            > How do I access the attributes in the XML Data?
            >
            > Here's my simple server:
            >
            > #!/usr/local/bin/perl -w
            > use SOAP::Transport::HTTP;
            >
            > SOAP::Transport::HTTP::CGI
            > -> dispatch_to('ONE')
            > -> handle;
            >
            > package ONE;
            >
            > sub dump {
            > my ($class, @params) = @_;
            > use Data::Dumper;
            > #return Dumper(@params); # Dumps DOM tree, no attributes
            > return $params[0]->{ROOT}->{some}->{node}; # access elements
            > }
            >
            > exit;
            >
            > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
            > > Hi, Robert!
            > >
            > > SOAP::Data->type(xml => ...) is the way to send XML fragment that
            > > will look like XML on wire. SOAP::Lite doesn't do any validation
            > in
            > > this case, so it's quite possible that generated XML (by itself
            > or
            > in
            > > combination with SOAP envelope) is invalid. ->type(base64 => ...)
            > > doesn't have this problem and always generate valid XML. You may
            > see
            > > what do you have on wire if you switch on debug info on client
            > side
            > > with ->on_debug(sub{print@_}).
            > >
            > > If you insert XML as a fragment I do not recommend you to use
            > > unqualified 'id' attributes, because they may interfere with 'id'
            > > attribute that is used by SOAP itself (yet you'll be able to
            > access
            > > that attribute).
            > >
            > > > > 4) What's the best way to send/receive a well-formed
            > > > > and x-schema validating XML data record for import
            > > > > into a local database?
            > > I would say base64 is the best way to go (esp. if XML processing
            > is
            > > required on another side anyway), because if you encode XML as a
            > > fragment you'll need to write custom deserializer to process your
            > > data. Let me know if you have any questions.
            > >
            > > Best wishes, Paul.
            > >
            > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
            > > > Since writing the below I found the SOAP::Data->type(...)
            > thingy
            > > > (attribute? directive?) and played around with a few settings.
            > When
            > > > I
            > > > specify the default (base64) my server finds and parses the
            > > > message.
            > > > When I specify 'xml' I get the following error:
            > > >
            > > > Fault: SOAP-ENV:Server, not well-formed (invalid token) at line
            >
            > 1,
            > > > column 4, byte 4 at /usr/local/lib/perl5/site_perl/5.6.1/i686-
            > > > linux/XML/Parser.pm line 185
            > > >
            > > > *Sigh* Help?
            > > >
            > > > --
            > > > Robert Taylor
            > > >
            > > > --- In soaplite@y..., Robert Taylor <theonetowhommyrefers@y...>
            > > > wrote:
            > > > > I created my first data-based connected SOAP
            > > > > client/server combination using SOAP-Lite. Now I want
            > > > > my business partner to be able to use my HTTPS/CGI
            > > > > SOAP server and have run into a problem.
            > > > >
            > > > > My goal is to receive an XML record for import into my
            > > > > (MySQL) database. The partner defined the record but
            > > > > I'm defining the SOAP service.
            > > > >
            > > > > A few questions:
            > > > >
            > > > > 1) If the @lines in "$soap->store(@lines)" contains a
            > > > > well-formed and x-schema validated XML file, why is
            > > > > the payload (right term?) serialized?
            > > > >
            > > > > 2) Related to (1) -- the data sent to the server is
            > > > > encoded (base 64?). Must it be?
            > > > >
            > > > > 3) My partner is coding his own client (not using
            > > > > SOAP::Lite, but something in C++ on an MS platform --
            > > > > not using .NET tools either). He's sending basically
            > > > > handcrafted SOAP messages with the Body a simple XML
            > > > > file. When I showed him the output of my client.cgi
            > > > > (below) using the "on_debug" method he balked at the
            > > > > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
            > > > > the XML file.
            > > > >
            > > > > Pretend my XML Data looks like this:
            > > > >
            > > > > <Test>
            > > > > <Question id="1" type="short answer"><text>What is
            > > > > the correct spelling of your name?</text></Question>
            > > > > <Question id="2" type="multiple choice"><text>What
            > > > > is your gender?</text>
            > > > > <option id="A">Male</option>
            > > > > <option id="B">Female</option>
            > > > > <option id="C">Cowboy Neal</option>
            > > > > </Question>
            > > > > </Test>
            > > > >
            > > > >
            > > > > Why is it encoded with the <c-gensym3...> tags?
            > > > > (Dumped using on_debug)?
            > > > >
            > > > > POST https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi
            > > > > Accept: text/xml
            > > > > Accept: multipart/*
            > > > > Content-Length: 1434
            > > > > Content-Type: text/xml; charset=utf-8
            > > > > SOAPAction: "https://xxx.xxx.xxx.xxx/ONE#store"
            > > > >
            > > > > <?xml version="1.0" encoding="UTF-8"?>
            > > > > <SOAP-ENV:Envelope
            > > > > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
            > > > >
            > > >
            > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
            > > > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
            > > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
            > > > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
            > > > > >
            > > > > <SOAP-ENV:Body
            > > > > >
            > > > > <namesp1:newrx
            > > > > xmlns:namesp1="https://xxx.xxx.xxx.xxx/ONE"
            > > > > >
            > > > > <c-gensym3 xsi:type="xsd:string"
            > > > > ><?xml version="1.0" encoding="UTF-8"?>
            > > > > </c-gensym3>
            > > > > <c-gensym5 xsi:type="xsd:string"
            > > > > ><Test>
            > > > > </c-gensym5>
            > > > > <c-gensym7 xsi:type="xsd:string"
            > > > > > <Question id="1" type="short
            > > > > answer"><text>What is the correct spelling of your
            > > > > name?</text></Question>
            > > > > </c-gensym7>
            > > > > <c-gensym9 xsi:type="xsd:string"
            > > > > > <Question id="2" type="multiple
            > > > > choice"><text>What is your gender?</text>
            > > > > </c-gensym9>
            > > > > <c-gensym11 xsi:type="xsd:string"
            > > > > > <option id="A">Male</option>
            > > > > </c-gensym11>
            > > > > <c-gensym13 xsi:type="xsd:string"
            > > > > > <option id="B">Female</option>
            > > > > </c-gensym13>
            > > > > <c-gensym15 xsi:type="xsd:string"
            > > > > > <option id="C">Cowboy Neal</option>
            > > > > </c-gensym15>
            > > > > <c-gensym17 xsi:type="xsd:string"
            > > > > > </Question>
            > > > > </c-gensym17>
            > > > > <c-gensym19 xsi:type="xsd:string"
            > > > > ></Test>
            > > > > </c-gensym19></namesp1:newrx></SOAP-ENV:Body></SOAP-
            > ENV:Envelope>
            > > > >
            > > > > 4) What's the best way to send/receive a well-formed
            > > > > and x-schema validating XML data record for import
            > > > > into a local database?
            > > > >
            > > > > Here's my client:
            > > > >
            > > > > #!/usr/local/bin/perl -w
            > > > > # SOAP Client -> simulates XML Data transfer via
            > > > > # SOAP.
            > > > > use SOAP::Lite;
            > > > >
            > > > > my $server =
            > > > > 'https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi';
            > > > >
            >
            === message truncated ===


            __________________________________________________
            Do You Yahoo!?
            Make a great connection at Yahoo! Personals.
            http://personals.yahoo.com
          • Silly Yahoo Readers
            Quick follow-up... (I meet with the biz partner in an hour and have to sound smart...) I get this error: Fault: SOAP-ENV:Server, Can t call method dataof on
            Message 5 of 9 , Oct 22, 2001
            • 0 Attachment
              Quick follow-up... (I meet with the biz partner in an hour and have
              to sound smart...) I get this error:

              Fault: SOAP-ENV:Server, Can't call method "dataof" on unblessed
              reference at /www/one/cgi-bin/server.cgi line 17.

              Here's my updated server (not cleaned up):

              #!/usr/local/bin/perl -w
              use SOAP::Transport::HTTP;

              SOAP::Transport::HTTP::CGI
              -> dispatch_to('ONE')
              -> handle;

              package ONE;
              @ONE::ISA = 'SOAP::Server::Parameters';


              sub dump {
              my $env = pop;
              my ($class, @params) = @_;
              use Data::Dumper;
              #return Dumper(@params);
              return $env->dataof('//Test/Question')->attr->{type};
              }


              --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
              > Hi, Robert!
              >
              > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
              > > Sometime around 3 AM I started getting it... ;-) Thanks for your
              > ;)
              >
              > > How do I access the attributes in the XML Data?
              > you need to do something like this (you can find more details in
              docs
              > and examples):
              >
              > > package ONE;
              > @ONE::ISA = 'SOAP::Server::Parameters';
              > >
              > > sub dump {
              > my $env = pop;
              > > my ($class, @params) = @_;
              > > use Data::Dumper;
              > > #return Dumper(@params); # Dumps DOM tree, no attributes
              > return $env->dataof('//Test/Question')->attr->{type}
              > # should return "short answer"
              > # dataof() returns SOAP::Data attribute that you can access
              > # for attributes and other information
              > > return $params[0]->{ROOT}->{some}->{node}; # access elements
              > > }
              >
              > Best wishes, Paul.
              >
              > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
              > > Paul,
              > >
              > > Sometime around 3 AM I started getting it... ;-) Thanks for your
              > > input in this forum, etc.
              > >
              > > Now I'm using type(xml =>...) and am able to get the elements
              (not
              > > the attributes) of the XML record. Is there a way to get the
              > > attributes, too? I can get at the elements with a simple
              > >
              > > return "root__child: $_[0]->{root}->{child}";
              > >
              > > How do I access the attributes in the XML Data?
              > >
              > > Here's my simple server:
              > >
              > > #!/usr/local/bin/perl -w
              > > use SOAP::Transport::HTTP;
              > >
              > > SOAP::Transport::HTTP::CGI
              > > -> dispatch_to('ONE')
              > > -> handle;
              > >
              > > package ONE;
              > >
              > > sub dump {
              > > my ($class, @params) = @_;
              > > use Data::Dumper;
              > > #return Dumper(@params); # Dumps DOM tree, no attributes
              > > return $params[0]->{ROOT}->{some}->{node}; # access elements
              > > }
              > >
              > > exit;
              > >
              > > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
              > > > Hi, Robert!
              > > >
              > > > SOAP::Data->type(xml => ...) is the way to send XML fragment
              that
              > > > will look like XML on wire. SOAP::Lite doesn't do any validation
              > > in
              > > > this case, so it's quite possible that generated XML (by itself
              > > or
              > > in
              > > > combination with SOAP envelope) is invalid. ->type(base64
              => ...)
              > > > doesn't have this problem and always generate valid XML. You may
              > > see
              > > > what do you have on wire if you switch on debug info on client
              > > side
              > > > with ->on_debug(sub{print@_}).
              > > >
              > > > If you insert XML as a fragment I do not recommend you to use
              > > > unqualified 'id' attributes, because they may interfere
              with 'id'
              > > > attribute that is used by SOAP itself (yet you'll be able to
              > > access
              > > > that attribute).
              > > >
              > > > > > 4) What's the best way to send/receive a well-formed
              > > > > > and x-schema validating XML data record for import
              > > > > > into a local database?
              > > > I would say base64 is the best way to go (esp. if XML processing
              > > is
              > > > required on another side anyway), because if you encode XML as a
              > > > fragment you'll need to write custom deserializer to process
              your
              > > > data. Let me know if you have any questions.
              > > >
              > > > Best wishes, Paul.
              > > >
              > > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
              > > > > Since writing the below I found the SOAP::Data->type(...)
              > > thingy
              > > > > (attribute? directive?) and played around with a few
              settings.
              > > When
              > > > > I
              > > > > specify the default (base64) my server finds and parses the
              > > > > message.
              > > > > When I specify 'xml' I get the following error:
              > > > >
              > > > > Fault: SOAP-ENV:Server, not well-formed (invalid token) at
              line
              > >
              > > 1,
              > > > > column 4, byte 4 at /usr/local/lib/perl5/site_perl/5.6.1/i686-
              > > > > linux/XML/Parser.pm line 185
              > > > >
              > > > > *Sigh* Help?
              > > > >
              > > > > --
              > > > > Robert Taylor
              > > > >
              > > > > --- In soaplite@y..., Robert Taylor
              <theonetowhommyrefers@y...>
              > > > > wrote:
              > > > > > I created my first data-based connected SOAP
              > > > > > client/server combination using SOAP-Lite. Now I want
              > > > > > my business partner to be able to use my HTTPS/CGI
              > > > > > SOAP server and have run into a problem.
              > > > > >
              > > > > > My goal is to receive an XML record for import into my
              > > > > > (MySQL) database. The partner defined the record but
              > > > > > I'm defining the SOAP service.
              > > > > >
              > > > > > A few questions:
              > > > > >
              > > > > > 1) If the @lines in "$soap->store(@lines)" contains a
              > > > > > well-formed and x-schema validated XML file, why is
              > > > > > the payload (right term?) serialized?
              > > > > >
              > > > > > 2) Related to (1) -- the data sent to the server is
              > > > > > encoded (base 64?). Must it be?
              > > > > >
              > > > > > 3) My partner is coding his own client (not using
              > > > > > SOAP::Lite, but something in C++ on an MS platform --
              > > > > > not using .NET tools either). He's sending basically
              > > > > > handcrafted SOAP messages with the Body a simple XML
              > > > > > file. When I showed him the output of my client.cgi
              > > > > > (below) using the "on_debug" method he balked at the
              > > > > > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
              > > > > > the XML file.
              > > > > >
              > > > > > Pretend my XML Data looks like this:
              > > > > >
              > > > > > <Test>
              > > > > > <Question id="1" type="short answer"><text>What is
              > > > > > the correct spelling of your name?</text></Question>
              > > > > > <Question id="2" type="multiple choice"><text>What
              > > > > > is your gender?</text>
              > > > > > <option id="A">Male</option>
              > > > > > <option id="B">Female</option>
              > > > > > <option id="C">Cowboy Neal</option>
              > > > > > </Question>
              > > > > > </Test>
              > > > > >
              > > > > >
              > > > > > Why is it encoded with the <c-gensym3...> tags?
              > > > > > (Dumped using on_debug)?
              > > > > >
              > > > > > POST https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi
              > > > > > Accept: text/xml
              > > > > > Accept: multipart/*
              > > > > > Content-Length: 1434
              > > > > > Content-Type: text/xml; charset=utf-8
              > > > > > SOAPAction: "https://xxx.xxx.xxx.xxx/ONE#store"
              > > > > >
              > > > > > <?xml version="1.0" encoding="UTF-8"?>
              > > > > > <SOAP-ENV:Envelope
              > > > > > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
              > > > > >
              > > > >
              > > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
              > > > > > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
              > > > > > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
              > > > > > xmlns:xsd="http://www.w3.org/1999/XMLSchema"
              > > > > > >
              > > > > > <SOAP-ENV:Body
              > > > > > >
              > > > > > <namesp1:newrx
              > > > > > xmlns:namesp1="https://xxx.xxx.xxx.xxx/ONE"
              > > > > > >
              > > > > > <c-gensym3 xsi:type="xsd:string"
              > > > > > ><?xml version="1.0" encoding="UTF-8"?>
              > > > > > </c-gensym3>
              > > > > > <c-gensym5 xsi:type="xsd:string"
              > > > > > ><Test>
              > > > > > </c-gensym5>
              > > > > > <c-gensym7 xsi:type="xsd:string"
              > > > > > > <Question id="1" type="short
              > > > > > answer"><text>What is the correct spelling of your
              > > > > > name?</text></Question>
              > > > > > </c-gensym7>
              > > > > > <c-gensym9 xsi:type="xsd:string"
              > > > > > > <Question id="2" type="multiple
              > > > > > choice"><text>What is your gender?</text>
              > > > > > </c-gensym9>
              > > > > > <c-gensym11 xsi:type="xsd:string"
              > > > > > > <option id="A">Male</option>
              > > > > > </c-gensym11>
              > > > > > <c-gensym13 xsi:type="xsd:string"
              > > > > > > <option id="B">Female</option>
              > > > > > </c-gensym13>
              > > > > > <c-gensym15 xsi:type="xsd:string"
              > > > > > > <option id="C">Cowboy Neal</option>
              > > > > > </c-gensym15>
              > > > > > <c-gensym17 xsi:type="xsd:string"
              > > > > > > </Question>
              > > > > > </c-gensym17>
              > > > > > <c-gensym19 xsi:type="xsd:string"
              > > > > > ></Test>
              > > > > > </c-gensym19></namesp1:newrx></SOAP-ENV:Body></SOAP-
              > > ENV:Envelope>
              > > > > >
              > > > > > 4) What's the best way to send/receive a well-formed
              > > > > > and x-schema validating XML data record for import
              > > > > > into a local database?
              > > > > >
              > > > > > Here's my client:
              > > > > >
              > > > > > #!/usr/local/bin/perl -w
              > > > > > # SOAP Client -> simulates XML Data transfer via
              > > > > > # SOAP.
              > > > > > use SOAP::Lite;
              > > > > >
              > > > > > my $server =
              > > > > > 'https://xxx.xxx.xxx.xxx/cgi-bin/server.cgi';
              > > > > >
              > >
              > === message truncated ===
              >
              >
              > __________________________________________________
              > Do You Yahoo!?
              > Make a great connection at Yahoo! Personals.
              > http://personals.yahoo.com
            • Paul Kulchenko
              Hi, Robert! ... Oops, my fault. I didn t realize that package declaration is in the same file as your server code. That s Perl s feature. You need to wrap
              Message 6 of 9 , Oct 22, 2001
              • 0 Attachment
                Hi, Robert!

                > Fault: SOAP-ENV:Server, Can't call method "dataof" on unblessed
                > reference at /www/one/cgi-bin/server.cgi line 17.
                Oops, my fault. I didn't realize that 'package' declaration is in the
                same file as your server code. That's Perl's feature. You need to
                wrap "package ONE" and the rest into BEGIN block for @ISA declaration
                to be valid. Hope it helps.

                Best wishes, Paul.

                --- Silly Yahoo Readers <theonetowhommyrefers@...> wrote:
                > Quick follow-up... (I meet with the biz partner in an hour and have
                >
                > to sound smart...) I get this error:
                >
                > Fault: SOAP-ENV:Server, Can't call method "dataof" on unblessed
                > reference at /www/one/cgi-bin/server.cgi line 17.
                >
                > Here's my updated server (not cleaned up):
                >
                > #!/usr/local/bin/perl -w
                > use SOAP::Transport::HTTP;
                >
                > SOAP::Transport::HTTP::CGI
                > -> dispatch_to('ONE')
                > -> handle;
                >
                > package ONE;
                > @ONE::ISA = 'SOAP::Server::Parameters';
                >
                >
                > sub dump {
                > my $env = pop;
                > my ($class, @params) = @_;
                > use Data::Dumper;
                > #return Dumper(@params);
                > return $env->dataof('//Test/Question')->attr->{type};
                > }
                >
                >
                > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                > > Hi, Robert!
                > >
                > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                > > > Sometime around 3 AM I started getting it... ;-) Thanks for
                > your
                > > ;)
                > >
                > > > How do I access the attributes in the XML Data?
                > > you need to do something like this (you can find more details in
                > docs
                > > and examples):
                > >
                > > > package ONE;
                > > @ONE::ISA = 'SOAP::Server::Parameters';
                > > >
                > > > sub dump {
                > > my $env = pop;
                > > > my ($class, @params) = @_;
                > > > use Data::Dumper;
                > > > #return Dumper(@params); # Dumps DOM tree, no attributes
                > > return $env->dataof('//Test/Question')->attr->{type}
                > > # should return "short answer"
                > > # dataof() returns SOAP::Data attribute that you can access
                > > # for attributes and other information
                > > > return $params[0]->{ROOT}->{some}->{node}; # access elements
                > > > }
                > >
                > > Best wishes, Paul.
                > >
                > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                > > > Paul,
                > > >
                > > > Sometime around 3 AM I started getting it... ;-) Thanks for
                > your
                > > > input in this forum, etc.
                > > >
                > > > Now I'm using type(xml =>...) and am able to get the elements
                > (not
                > > > the attributes) of the XML record. Is there a way to get the
                > > > attributes, too? I can get at the elements with a simple
                > > >
                > > > return "root__child: $_[0]->{root}->{child}";
                > > >
                > > > How do I access the attributes in the XML Data?
                > > >
                > > > Here's my simple server:
                > > >
                > > > #!/usr/local/bin/perl -w
                > > > use SOAP::Transport::HTTP;
                > > >
                > > > SOAP::Transport::HTTP::CGI
                > > > -> dispatch_to('ONE')
                > > > -> handle;
                > > >
                > > > package ONE;
                > > >
                > > > sub dump {
                > > > my ($class, @params) = @_;
                > > > use Data::Dumper;
                > > > #return Dumper(@params); # Dumps DOM tree, no attributes
                > > > return $params[0]->{ROOT}->{some}->{node}; # access elements
                > > > }
                > > >
                > > > exit;
                > > >
                > > > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                > > > > Hi, Robert!
                > > > >
                > > > > SOAP::Data->type(xml => ...) is the way to send XML fragment
                > that
                > > > > will look like XML on wire. SOAP::Lite doesn't do any
                > validation
                > > > in
                > > > > this case, so it's quite possible that generated XML (by
                > itself
                > > > or
                > > > in
                > > > > combination with SOAP envelope) is invalid. ->type(base64
                > => ...)
                > > > > doesn't have this problem and always generate valid XML. You
                > may
                > > > see
                > > > > what do you have on wire if you switch on debug info on
                > client
                > > > side
                > > > > with ->on_debug(sub{print@_}).
                > > > >
                > > > > If you insert XML as a fragment I do not recommend you to use
                > > > > unqualified 'id' attributes, because they may interfere
                > with 'id'
                > > > > attribute that is used by SOAP itself (yet you'll be able to
                > > > access
                > > > > that attribute).
                > > > >
                > > > > > > 4) What's the best way to send/receive a well-formed
                > > > > > > and x-schema validating XML data record for import
                > > > > > > into a local database?
                > > > > I would say base64 is the best way to go (esp. if XML
                > processing
                > > > is
                > > > > required on another side anyway), because if you encode XML
                > as a
                > > > > fragment you'll need to write custom deserializer to process
                > your
                > > > > data. Let me know if you have any questions.
                > > > >
                > > > > Best wishes, Paul.
                > > > >
                > > > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                > > > > > Since writing the below I found the SOAP::Data->type(...)
                > > > thingy
                > > > > > (attribute? directive?) and played around with a few
                > settings.
                > > > When
                > > > > > I
                > > > > > specify the default (base64) my server finds and parses the
                > > > > > message.
                > > > > > When I specify 'xml' I get the following error:
                > > > > >
                > > > > > Fault: SOAP-ENV:Server, not well-formed (invalid token) at
                > line
                > > >
                > > > 1,
                > > > > > column 4, byte 4 at
                > /usr/local/lib/perl5/site_perl/5.6.1/i686-
                > > > > > linux/XML/Parser.pm line 185
                > > > > >
                > > > > > *Sigh* Help?
                > > > > >
                > > > > > --
                > > > > > Robert Taylor
                > > > > >
                > > > > > --- In soaplite@y..., Robert Taylor
                > <theonetowhommyrefers@y...>
                > > > > > wrote:
                > > > > > > I created my first data-based connected SOAP
                > > > > > > client/server combination using SOAP-Lite. Now I want
                > > > > > > my business partner to be able to use my HTTPS/CGI
                > > > > > > SOAP server and have run into a problem.
                > > > > > >
                > > > > > > My goal is to receive an XML record for import into my
                > > > > > > (MySQL) database. The partner defined the record but
                > > > > > > I'm defining the SOAP service.
                > > > > > >
                > > > > > > A few questions:
                > > > > > >
                > > > > > > 1) If the @lines in "$soap->store(@lines)" contains a
                > > > > > > well-formed and x-schema validated XML file, why is
                > > > > > > the payload (right term?) serialized?
                > > > > > >
                > > > > > > 2) Related to (1) -- the data sent to the server is
                > > > > > > encoded (base 64?). Must it be?
                > > > > > >
                > > > > > > 3) My partner is coding his own client (not using
                > > > > > > SOAP::Lite, but something in C++ on an MS platform --
                > > > > > > not using .NET tools either). He's sending basically
                > > > > > > handcrafted SOAP messages with the Body a simple XML
                > > > > > > file. When I showed him the output of my client.cgi
                > > > > > > (below) using the "on_debug" method he balked at the
                > > > > > > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
                > > > > > > the XML file.
                > > > > > >
                > > > > > > Pretend my XML Data looks like this:
                > > > > > >
                > > > > > > <Test>
                > > > > > > <Question id="1" type="short answer"><text>What is
                > > > > > > the correct spelling of your name?</text></Question>
                > > > > > > <Question id="2" type="multiple choice"><text>What
                > > > > > > is your gender?</text>
                > > > > > > <option id="A">Male</option>
                > > > > > > <option id="B">Female</option>
                >
                === message truncated ===


                __________________________________________________
                Do You Yahoo!?
                Make a great connection at Yahoo! Personals.
                http://personals.yahoo.com
              • Silly Yahoo Readers
                Works beautifully! Now i kan go bee smaRt n act learneded. (Later I make sure I really understand it!). Thanks. -- Robert Taylor ... the ... declaration ...
                Message 7 of 9 , Oct 22, 2001
                • 0 Attachment
                  Works beautifully! Now i kan go bee smaRt 'n act learneded. (Later I
                  make sure I really understand it!).

                  Thanks.

                  --
                  Robert Taylor


                  --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                  > Hi, Robert!
                  >
                  > > Fault: SOAP-ENV:Server, Can't call method "dataof" on unblessed
                  > > reference at /www/one/cgi-bin/server.cgi line 17.
                  > Oops, my fault. I didn't realize that 'package' declaration is in
                  the
                  > same file as your server code. That's Perl's feature. You need to
                  > wrap "package ONE" and the rest into BEGIN block for @ISA
                  declaration
                  > to be valid. Hope it helps.
                  >
                  > Best wishes, Paul.
                  >
                  > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                  > > Quick follow-up... (I meet with the biz partner in an hour and
                  have
                  > >
                  > > to sound smart...) I get this error:
                  > >
                  > > Fault: SOAP-ENV:Server, Can't call method "dataof" on unblessed
                  > > reference at /www/one/cgi-bin/server.cgi line 17.
                  > >
                  > > Here's my updated server (not cleaned up):
                  > >
                  > > #!/usr/local/bin/perl -w
                  > > use SOAP::Transport::HTTP;
                  > >
                  > > SOAP::Transport::HTTP::CGI
                  > > -> dispatch_to('ONE')
                  > > -> handle;
                  > >
                  > > package ONE;
                  > > @ONE::ISA = 'SOAP::Server::Parameters';
                  > >
                  > >
                  > > sub dump {
                  > > my $env = pop;
                  > > my ($class, @params) = @_;
                  > > use Data::Dumper;
                  > > #return Dumper(@params);
                  > > return $env->dataof('//Test/Question')->attr->{type};
                  > > }
                  > >
                  > >
                  > > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                  > > > Hi, Robert!
                  > > >
                  > > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                  > > > > Sometime around 3 AM I started getting it... ;-) Thanks for
                  > > your
                  > > > ;)
                  > > >
                  > > > > How do I access the attributes in the XML Data?
                  > > > you need to do something like this (you can find more details
                  in
                  > > docs
                  > > > and examples):
                  > > >
                  > > > > package ONE;
                  > > > @ONE::ISA = 'SOAP::Server::Parameters';
                  > > > >
                  > > > > sub dump {
                  > > > my $env = pop;
                  > > > > my ($class, @params) = @_;
                  > > > > use Data::Dumper;
                  > > > > #return Dumper(@params); # Dumps DOM tree, no attributes
                  > > > return $env->dataof('//Test/Question')->attr->{type}
                  > > > # should return "short answer"
                  > > > # dataof() returns SOAP::Data attribute that you can access
                  > > > # for attributes and other information
                  > > > > return $params[0]->{ROOT}->{some}->{node}; # access
                  elements
                  > > > > }
                  > > >
                  > > > Best wishes, Paul.
                  > > >
                  > > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                  > > > > Paul,
                  > > > >
                  > > > > Sometime around 3 AM I started getting it... ;-) Thanks for
                  > > your
                  > > > > input in this forum, etc.
                  > > > >
                  > > > > Now I'm using type(xml =>...) and am able to get the elements
                  > > (not
                  > > > > the attributes) of the XML record. Is there a way to get the
                  > > > > attributes, too? I can get at the elements with a simple
                  > > > >
                  > > > > return "root__child: $_[0]->{root}->{child}";
                  > > > >
                  > > > > How do I access the attributes in the XML Data?
                  > > > >
                  > > > > Here's my simple server:
                  > > > >
                  > > > > #!/usr/local/bin/perl -w
                  > > > > use SOAP::Transport::HTTP;
                  > > > >
                  > > > > SOAP::Transport::HTTP::CGI
                  > > > > -> dispatch_to('ONE')
                  > > > > -> handle;
                  > > > >
                  > > > > package ONE;
                  > > > >
                  > > > > sub dump {
                  > > > > my ($class, @params) = @_;
                  > > > > use Data::Dumper;
                  > > > > #return Dumper(@params); # Dumps DOM tree, no attributes
                  > > > > return $params[0]->{ROOT}->{some}->{node}; # access
                  elements
                  > > > > }
                  > > > >
                  > > > > exit;
                  > > > >
                  > > > > --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
                  > > > > > Hi, Robert!
                  > > > > >
                  > > > > > SOAP::Data->type(xml => ...) is the way to send XML
                  fragment
                  > > that
                  > > > > > will look like XML on wire. SOAP::Lite doesn't do any
                  > > validation
                  > > > > in
                  > > > > > this case, so it's quite possible that generated XML (by
                  > > itself
                  > > > > or
                  > > > > in
                  > > > > > combination with SOAP envelope) is invalid. ->type(base64
                  > > => ...)
                  > > > > > doesn't have this problem and always generate valid XML. You
                  > > may
                  > > > > see
                  > > > > > what do you have on wire if you switch on debug info on
                  > > client
                  > > > > side
                  > > > > > with ->on_debug(sub{print@_}).
                  > > > > >
                  > > > > > If you insert XML as a fragment I do not recommend you to
                  use
                  > > > > > unqualified 'id' attributes, because they may interfere
                  > > with 'id'
                  > > > > > attribute that is used by SOAP itself (yet you'll be able to
                  > > > > access
                  > > > > > that attribute).
                  > > > > >
                  > > > > > > > 4) What's the best way to send/receive a well-formed
                  > > > > > > > and x-schema validating XML data record for import
                  > > > > > > > into a local database?
                  > > > > > I would say base64 is the best way to go (esp. if XML
                  > > processing
                  > > > > is
                  > > > > > required on another side anyway), because if you encode XML
                  > > as a
                  > > > > > fragment you'll need to write custom deserializer to
                  process
                  > > your
                  > > > > > data. Let me know if you have any questions.
                  > > > > >
                  > > > > > Best wishes, Paul.
                  > > > > >
                  > > > > > --- Silly Yahoo Readers <theonetowhommyrefers@y...> wrote:
                  > > > > > > Since writing the below I found the SOAP::Data->type(...)
                  > > > > thingy
                  > > > > > > (attribute? directive?) and played around with a few
                  > > settings.
                  > > > > When
                  > > > > > > I
                  > > > > > > specify the default (base64) my server finds and parses
                  the
                  > > > > > > message.
                  > > > > > > When I specify 'xml' I get the following error:
                  > > > > > >
                  > > > > > > Fault: SOAP-ENV:Server, not well-formed (invalid token)
                  at
                  > > line
                  > > > >
                  > > > > 1,
                  > > > > > > column 4, byte 4 at
                  > > /usr/local/lib/perl5/site_perl/5.6.1/i686-
                  > > > > > > linux/XML/Parser.pm line 185
                  > > > > > >
                  > > > > > > *Sigh* Help?
                  > > > > > >
                  > > > > > > --
                  > > > > > > Robert Taylor
                  > > > > > >
                  > > > > > > --- In soaplite@y..., Robert Taylor
                  > > <theonetowhommyrefers@y...>
                  > > > > > > wrote:
                  > > > > > > > I created my first data-based connected SOAP
                  > > > > > > > client/server combination using SOAP-Lite. Now I want
                  > > > > > > > my business partner to be able to use my HTTPS/CGI
                  > > > > > > > SOAP server and have run into a problem.
                  > > > > > > >
                  > > > > > > > My goal is to receive an XML record for import into my
                  > > > > > > > (MySQL) database. The partner defined the record but
                  > > > > > > > I'm defining the SOAP service.
                  > > > > > > >
                  > > > > > > > A few questions:
                  > > > > > > >
                  > > > > > > > 1) If the @lines in "$soap->store(@lines)" contains a
                  > > > > > > > well-formed and x-schema validated XML file, why is
                  > > > > > > > the payload (right term?) serialized?
                  > > > > > > >
                  > > > > > > > 2) Related to (1) -- the data sent to the server is
                  > > > > > > > encoded (base 64?). Must it be?
                  > > > > > > >
                  > > > > > > > 3) My partner is coding his own client (not using
                  > > > > > > > SOAP::Lite, but something in C++ on an MS platform --
                  > > > > > > > not using .NET tools either). He's sending basically
                  > > > > > > > handcrafted SOAP messages with the Body a simple XML
                  > > > > > > > file. When I showed him the output of my client.cgi
                  > > > > > > > (below) using the "on_debug" method he balked at the
                  > > > > > > > Base64 and <c-gensym6 xsi:type="xsd:int"> wrappers on
                  > > > > > > > the XML file.
                  > > > > > > >
                  > > > > > > > Pretend my XML Data looks like this:
                  > > > > > > >
                  > > > > > > > <Test>
                  > > > > > > > <Question id="1" type="short answer"><text>What is
                  > > > > > > > the correct spelling of your name?</text></Question>
                  > > > > > > > <Question id="2" type="multiple choice"><text>What
                  > > > > > > > is your gender?</text>
                  > > > > > > > <option id="A">Male</option>
                  > > > > > > > <option id="B">Female</option>
                  > >
                  > === message truncated ===
                  >
                  >
                  > __________________________________________________
                  > Do You Yahoo!?
                  > Make a great connection at Yahoo! Personals.
                  > http://personals.yahoo.com
                • David Inglis
                  Could anybody please provide asssistance with the following, I have got to convert the following from a microsoft to perl what would I need to do with soap
                  Message 8 of 9 , Oct 24, 2004
                  • 0 Attachment
                    Could anybody please provide asssistance with the following, I have got to
                    convert the following from a microsoft to perl what would I need to do with
                    soap lite to achieve the following


                    There are three steps that need to be performed to invoke a web service function
                    these are:
                    1. Create the SOAP client object:
                    Set objSoapClient = Server.CreateObject("MSSOAP.SoapClient30")

                    2. Initialise the SOAP client using the Web Services Definition Language (WSDL)
                    file as input using the following code snippet.
                    Const WSDL_URL =
                    "http://national.atdw.com.au/soap/AustralianTourismWebService.asmx?WSDL"
                    objSoapClient.ClientProperty("ServerHTTPRequest") = True
                    objSoapClient.mssoapinit ( WSDL_URL )

                    3. Invoke the ATWS command function CommandHandler with the Distributor Key,
                    command name and command parameters.
                    strResult = ObjSoapClient.CommandHandler( strDistributorKey, _
                    strCommandName"), _
                    strCommandParameters )

                    The strDistributorKey is your unique Distributor Key value that you were
                    provided when you became an authorized ATDW Distributor.
                    The strCommandName is the name of the ATWS command Handler Command Function that
                    you wish to invoke, e.g. QueryProducts
                    The strCommandParameters are the xml formatted input command parameters specific
                    for the command function that is being invoked.




                    --
                    Regards


                    David Inglis

                    ideloveto.com.au ideloveto.com
                    reddunes.com.au reddunes.com
                    limpfrog.com.au limpfrog.com





                    ----------------------------------------------------------------
                    This message was sent using IMP, the Internet Messaging Program.
                  Your message has been successfully submitted and would be delivered to recipients shortly.