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

Re: [soaplite] Re: Can anybody make a client for this un ?

Expand Messages
  • Byrne Reese
    There is currently an effort underway to rework a lot of SOAP::Lite, and I imagine supporting WSDL (and thus XML Schemas) more robustly will be a key objective
    Message 1 of 4 , Apr 22 2:24 PM
    • 0 Attachment
      There is currently an effort underway to rework a lot of SOAP::Lite, and
      I imagine supporting WSDL (and thus XML Schemas) more robustly will be a
      key objective for that project.

      In the meantime, you can find the same code posted here:
      http://www.majordojo.com/archives/cat_soaplite.html

      I will try and pick a problem from the SOAP::Lite message board about
      once a week or more and detail their solution here. Right now, it only
      has that one sample, but more will follow.

      On Tue, 2003-04-22 at 14:19, iluvperlalot wrote:
      > Wow thanks ! I'm sure this would clear up any issues I had earlier
      > using SOAP::Lite for other web services as well.
      >
      > Any chance of SOAP::Lite's WSDL/XML Schema capabilities improving in
      > the near future ?
      >
      >
      > --- In soaplite@yahoogroups.com, Byrne Reese <breese@g...> wrote:
      > > The multirefs are totally OK. That is part of the XML specification
      > and
      > > should not impact your SOAP client or server.
      > >
      > > The output you provided helps and it brings to light several issues
      > > across the board. But let me first give you the solution. A little
      > > disclaimer first: I could have cleaned up this code a lot, but I
      > don't
      > > think making the call in fewer number of lines of code would have
      > been
      > > illustrative of many of the facets of SOAP::Lite call API. So I
      > decided
      > > to leave my code as is:
      > >
      > > Here is the latest client that works:
      > >
      > > #!/usr/bin/perl
      > > #
      > > # airfare.pl
      > > # Author: breese at grandcentral.com
      > >
      > > # Location of the WSDL file
      > > my $WSDL
      > ="http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote?wsdl";
      > > my $NS = "urn:SBGAirFareQuotes.sbg.travel.ws.dsdata.co.uk";
      > > my $HOST =
      > "http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote";
      > >
      > > use strict;
      > > use SOAP::Lite +trace => qw (debug);
      > >
      > > my $search = SOAP::Lite
      > > ->readable(1)
      > > ->xmlschema('http://www.w3.org/2001/XMLSchema')
      > > ->on_action( sub { return '""';} )
      > > ->proxy($HOST)
      > > ->uri($NS);
      > >
      > > # CCYY-MM-DDThh:mm:ss
      > > my $outwardDate = "2003-04-28T08:00:00.000Z";
      > > my $returnDate = "2003-05-05T08:00:00.000Z";
      > > my $origin = "LAX";
      > > my $destination = "JFK";
      > >
      > > my $method = SOAP::Data->name('getAirFareQuote')
      > > ->prefix('air')
      > > ->uri($NS);
      > >
      > > my $params =
      > > SOAP::Data
      > > ->type('air:AirFareQuoteRequest')
      > > ->name('in0' =>
      > > \SOAP::Data->value(
      > > SOAP::Data->name('outwardDate' =>
      > $outwardDate)->type('xsd:dateTime'),
      > > SOAP::Data->name('returnDate' =>
      > $returnDate)->type('xsd:dateTime'),
      > > SOAP::Data->name('originAirport' => $origin),
      > > SOAP::Data->name('destinationAirport' =>
      > $destination)
      > > ));
      > >
      > > my $results = $search->call($method => $params);
      > >
      > > # Loop through the results
      > > foreach my $result (@{$results->{'result'}}) {
      > > print $result->{airlineName} . ": " . $result->{fare} . "\n";
      > > }
      > >
      > > 1;
      > >
      > > As for the issues this brings to light:
      > > * First, the SOAP Fault returned by Axis blows. Really blows. It
      > took me
      > > in a completely different direction. The *real* problem had to do
      > with
      > > the way the input was provided. I should have caught this by looking
      > at
      > > the WSDL, but totally neglected it.
      > > * Second, it illustrates again that SOAP::Lite's WSDL and XML Schema
      > > capabilities are very weak. :(
      > >
      > > Regardless. This should get you up and running. Enjoy.
      > >
      > > On Tue, 2003-04-22 at 12:05, iluvperlalot wrote:
      > > > Thanks for looking into it !
      > > >
      > > > As per your suggestion, i implemented the client using axis (well
      > > > actually i'm using a whole big ogsa/grid framework - which in turn
      > > > uses axis), and it works ! No surprise there :)
      > > >
      > > > This is the Packet that it (the axis client) sends ::
      > > >
      > > > POST / HTTP/1.0
      > > > Content-Type: text/xml; charset=utf-8
      > > > Accept: application/soap+xml, application/dime, multipart/related,
      > text/*
      > > > User-Agent: Axis/1.1RC1
      > > > Host: excalibur.isi.edu:9666
      > > > Cache-Control: no-cache
      > > > Pragma: no-cache
      > > > SOAPAction: ""
      > > > Content-Length: 1022
      > > >
      > > > <?xml version="1.0" encoding="UTF-8"?>
      > > > <soapenv:Envelope
      > > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
      > > > xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      > > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
      > > > <soapenv:Body>
      > > > <ns1:getAirFareQuote
      > > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > > > xmlns:ns1="urn:SBGAirFareQuotes.sbg.travel.ws.dsdata.co.uk">
      > > > <in0 href="#id0"/>
      > > > </ns1:getAirFareQuote>
      > > > <multiRef id="id0" soapenc:root="0"
      > > > soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      > > > xsi:type="ns2:AirFareQuoteRequest"
      > > > xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
      > > > xmlns:ns2="urn:SBGAirFareQuotes.sbg.travel.ws.dsdata.co.uk">
      > > > <outwardDate
      > > > xsi:type="xsd:dateTime">2003-04-28T08:00:00.000Z</outwardDate>
      > > > <returnDate
      > > > xsi:type="xsd:dateTime">2003-05-05T08:00:00.000Z</returnDate>
      > > > <originAirport xsi:type="xsd:string">LAX</originAirport>
      > > > <destinationAirport
      > xsi:type="xsd:string">JFK</destinationAirport>
      > > > </multiRef>
      > > > </soapenv:Body>
      > > >
      > > >
      > > > The href and multiRef stuff is mighty confusing to me ! Is this
      > > > axis/.NET specific ?
      > > >
      > > >
      > > >
      > > > --- In soaplite@yahoogroups.com, Byrne Reese <breese@g...> wrote:
      > > > > This is really really weird... and tricky. It exposes a lot of
      > the
      > > > > configurability of SOAP::Lite, but also a lot of its
      > shortcomings -
      > > > > especially in regard to WSDL support, and Schema support.
      > > > >
      > > > > Here is my code, and a discussion to follow:
      > > > > #!/usr/bin/perl
      > > > > #
      > > > > # airfare.pl
      > > > >
      > > > > # Location of the WSDL file
      > > > > my $WSDL
      > > >
      > ="http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote?wsdl";
      > > > > my $NS = "urn:SBGAirFareQuotes";
      > > > > #my $NS = "urn:SBGAirFareQuotes.sbg.travel.ws.dsdata.co.uk";
      > > > > #my $NS =
      > > >
      > "http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote";
      > > > >
      > > > > use strict;
      > > > > use SOAP::Lite +trace => qw (debug);
      > > > >
      > > > > my $search = SOAP::Lite
      > > > > ->readable(1)
      > > > > ->xmlschema('http://www.w3.org/2001/XMLSchema')
      > > > > ->on_action( sub { return '';} )
      > > > >
      > > >
      > ->proxy('http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote')
      > > > > ->uri($NS);
      > > > >
      > > > > # CCYY-MM-DDThh:mm:ss
      > > > > my $outwardDate = "2003-12-22T00:00:00";
      > > > > my $returnDate = "2003-12-30T00:00:00";
      > > > > my $origin = "SFO";
      > > > > my $destination = "LAX";
      > > > >
      > > > > my $results2 = $search->getAirlines();
      > > > >
      > > > > my $results =
      > > > > $search->getAirFareQuote(
      > > > > SOAP::Data->name('outwardDate' =>
      > > > $outwardDate)->type('xsd:dateTime'),
      > > > > SOAP::Data->name('returnDate' =>
      > > > $returnDate)->type('xsd:dateTime'),
      > > > > SOAP::Data->name('originAirport' =>
      > $origin),
      > > > > SOAP::Data->name('destinationAirport' =>
      > $destination)
      > > > > );
      > > > >
      > > > > # Loop through the results
      > > > > foreach my $result (@{$results->{'result'}}) {
      > > > > print $result->{airlineName} . ": " . $result->{fare} . "\n";
      > > > > }
      > > > >
      > > > > 1;
      > > > >
      > > > > #<?xml version="1.0" encoding="UTF-8"?>
      > > > > #<SOAP-ENV:Envelope
      > > > > # xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      > > > > # xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
      > > > > # xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
      > > > > # xmlns:xsd="http://www.w3.org/2001/XMLSchema"
      > > > > #
      > SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
      > > > > # <SOAP-ENV:Body>
      > > > > # <namesp1:getAirFareQuote
      > > > xmlns:namesp1="urn:SBGAirFareQuotes.sbg.travel.ws.dsdata.co.uk">
      > > > > # <outwardDate
      > > > xsi:type="xsd:dateTime">2003-12-22T00:00:00</outwardDate>
      > > > > # <returnDate
      > > > xsi:type="xsd:dateTime">2003-12-30T00:00:00</returnDate>
      > > > > # <originAirport xsi:type="xsd:string">SFO</originAirport>
      > > > > # <destinationAirport
      > > > xsi:type="xsd:string">LAX</destinationAirport>
      > > > > # </namesp1:getAirFareQuote>
      > > > > # </SOAP-ENV:Body>
      > > > > #</SOAP-ENV:Envelope>
      > > > >
      > > > > DISCUSSION:
      > > > >
      > > > > Here is what is weird. I did a lot of digging in the WSDL file
      > and found
      > > > > that if I called the service using the following method name
      > then I got
      > > > > different error messages: GetAirFareQuoteRequest(params). The
      > errors
      > > > > messages were around serialization and what not, which is why I
      > have all
      > > > > those tweak calls (i.e. $search->xmlschema, etc).
      > > > >
      > > > > However, once I fixed all those faults, then I got the same
      > result back:
      > > > > Operation not found for 'GetAirFareQuoteRequest'. So I switch
      > back to
      > > > > the proper operation name 'getAirFareQuote' which still throws
      > an error.
      > > > > Ironically, other calls to the service works, like
      > getAirlines().
      > > > >
      > > > > I would suspect the service, but I have a hard time believing
      > Axis is
      > > > > screwing up. But maybe I am too faithful. It is possible they
      > are
      > > > > running an older version of Axis. Maybe there is a bug in there.
      > > > > Otherwise, I have no friggin' clue, and I can't spend any more
      > time on
      > > > > this puppy.
      > > > >
      > > > > Please let me know if you resolve it.
      > > > >
      > > > > I might try consuming it with .NET or Axis and see if they
      > interact with
      > > > > it properly. If you can send me the HTTP/XML stream, I can
      > replicate it
      > > > > in SOAP::Lite.
      > > > >
      > > > >
      > > > > On Mon, 2003-04-21 at 16:31, iluvperlalot wrote:
      > > > > > WSDL :: ->
      > > > > >
      > > >
      > http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote?wsdl
      > > > > >
      > > > > > This is what i tried :
      > > > > >
      > > > > > --------- start code ----------
      > > > > > #!perl
      > > > > > use SOAP::Lite +trace => [debug => sub {print @_,"\n";}];
      > > > > > use Data::Dumper;
      > > > > >
      > > > > > my $service =
      > > > > >
      > > >
      > SOAP::Lite->service("http://wavendon.dsdata.co.uk:8080/axis/services/SBGGetAirFareQuote?wsdl");
      > > > > > my %request =
      > > > > >
      > > >
      > ("outwardDate"=>"12-22-2003","returnDate"=>"12-31-2003","originAirport"=>"LAX",
      > > > > > "destinationAirport"=>"JFK
      > > > > > ");
      > > > > > my $result = $service->getAirFareQuote(%request);
      > > > > >
      > > > > > print Dumper "$result\n";
      > > > > > if (!$result) {
      > > > > > print $service->call->faultstring,"\n";
      > > > > > }
      > > > > >
      > > > > > ------------end code------------
      > > > > >
      > > > > > and i this is what i got (error) ::
      > > > > > ... blah blah ..
      > > > > >
      > > > > > <soapenv:Fault>
      > > > > > <faultcode
      > > > > >
      > > >
      > xmlns:ns1="http://xml.apache.org/axis/">ns1:Server.userException</faultcode>
      > > > > > <faultstring>org.xml.sax.SAXException: No such operation
      > > > > > 'getAirFareQuote'</faultstring>
      > > > > > <detail>
      > > > > > <ns2:stackTrace
      > > > > >
      > xmlns:ns2="http://xml.apache.org/axis/">org.xml.sax.SAXException: No
      > > > > > such operation 'getAirFareQuote'
      > > > > > at
      > > > > >
      > > >
      > org.apache.axis.message.RPCElement.deserialize(RPCElement.java:224)
      > > > > > at
      > > > > >
      > org.apache.axis.message.RPCElement.getParams(RPCElement.java:265)
      > > > > > at
      > > > > >
      > > >
      > org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:190)
      > > > > > ....... blah ..blah..
      > > > > >
      > > > > >
      > > > > > Yahoo! Groups Sponsor
      > > > > > ADVERTISEMENT
      > > > > >
      > > > > >
      > > > > > To unsubscribe from this group, send an email to:
      > > > > > soaplite-unsubscribe@yahoogroups.com
      > > > > >
      > > > > >
      > > > > >
      > > > > > Your use of Yahoo! Groups is subject to the Yahoo! Terms of
      > Service.
      > > > > --
      > > > > Byrne Reese
      > > > > Developer Program Manager
      > > > > Grand Central Communications
      > > --
      > > Byrne Reese <breese@g...>
      > > Grand Central Communications
      >
      >
      > Yahoo! Groups Sponsor
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
      --
      Byrne Reese
      Developer Program Manager
      Grand Central Communications
    Your message has been successfully submitted and would be delivered to recipients shortly.