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

Re: deserializer

Expand Messages
  • stipe4246
    Hi Paul, Thanks for the response. It made some progress (defined as now giving a different error message) with the change you suggested. I reposted the code
    Message 1 of 3 , Nov 19, 2002
    • 0 Attachment
      Hi Paul,
      Thanks for the response. It made some progress (defined as now
      giving a different error message) with the change you suggested. I
      reposted the code just below with all the unnecessary bits stripped
      out for clarity. I added the line you suggested where you suggested
      it, but now the script returns this error:
      "not well-formed (invalid token) at line 1, column 13, byte 13
      at /usr/lib/perl5/vendor_perl/5.6.1/i386-linux/XML/Parser.pm line 185"
      Thanks for the patience with a newbie,
      Steve


      #!/usr/bin/perl
      package EncodedTypes;
      sub as_PhenomenonType { $_[1] }
      sub as_VisibilityQualifier { $_[1] }
      sub as_DirectionCompass { $_[1] }
      sub as_ExtremeType { $_[1] }

      package main;
      use SOAP::Lite;

      $d = SOAP::Deserializer->new;
      $d->xmlschemas->{'http://www.capeclear.com/GlobalWeather.xsd'}
      = 'EncodedTypes';
      my $wsdlfile = SOAP::Lite -> service
      ('http://live.capescience.com/wsdl/GlobalWeather.wsdl');
      $wsdlfile->deserializer($d);
      my $values = $wsdlfile -> getWeatherReport("JFK");
      $r = $d->deserialize($values)->result;

      print "temp=$r->{temperature}->{ambient}\n";


      --- In soaplite@y..., Paul Kulchenko <paulclinger@y...> wrote:
      > Hi Steve,
      >
      > > My guess is that I am making some sort of syntax error in trying
      to
      > > get the output of my SOAP request to go through the deserializer.
      > I've just created your deserializer, but you also need to register
      > it:
      >
      > > $d = SOAP::Deserializer->new;
      > > $d->xmlschemas->{'http://www.capeclear.com/GlobalWeather.xsd'}
      > > = 'EncodedTypes';
      > >
      > > my $wsdlfile = SOAP::Lite -> service("file:GlobalWeather.wsdl");
      > $wsdlfile->deserializer($d);
      >
      > ....
      >
      > Should be enough to get it done.
      >
      > Best wishes, Paul.
      >
      > --- stipe4246 <steve@i...> wrote:
      > > I'm just starting out using SOAP with Perl and have run into a
      road
      > >
      > > block on this script that I think is probably a simple fix, but
      I'm
      > >
      > > just not seeing what I'm missing.
      > >
      > > This is the code as is (a really simple and basic script):
      > > #_________________________________________#
      > > #!/usr/bin/perl
      > > package EncodedTypes;
      > > sub as_PhenomenonType { $_[1] }
      > > sub as_VisibilityQualifier { $_[1] }
      > > sub as_DirectionCompass { $_[1] }
      > >
      > > package main;
      > > use SOAP::Lite;
      > >
      > > $d = SOAP::Deserializer->new;
      > > $d->xmlschemas->{'http://www.capeclear.com/GlobalWeather.xsd'}
      > > = 'EncodedTypes';
      > >
      > > my $wsdlfile = SOAP::Lite -> service("file:GlobalWeather.wsdl");
      > > my $s_term = "JFK";
      > >
      > > my $values = $wsdlfile -> getWeatherReport("$s_term");
      > > $r = $d->deserialize($values)->result;
      > > print "temp=$r->{temperature}->{ambient}\n";
      > > #_________________________________________#
      > >
      > > When I run this from the command prompt, I get the error:
      > > Unrecognized type '{http://www.capeclear.com/GlobalWeather.xsd}
      > > PhenomenonType'
      > > followed by the entire contents of the returned xml file.
      > >
      > > However, if in the third to last line I manually set $values to
      be
      > > the sample SOAP response that this SOAP server defines at:
      > >
      >
      http://www.capescience.com/webservices/globalweather/GlobalWeatherResp
      > > onse.xml
      > >
      > > then the script works perfectly.
      > >
      > > My guess is that I am making some sort of syntax error in trying
      to
      > >
      > > get the output of my SOAP request to go through the deserializer.
      > >
      > > Any ideas?
      > >
      > > Thanks,
      > > Steve
      > >
      > >
      > >
      > > 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!?
      > Yahoo! Web Hosting - Let the expert host your site
      > http://webhosting.yahoo.com
    Your message has been successfully submitted and would be delivered to recipients shortly.