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

Re: [soaplite] Totally unrelated note: TerraService

Expand Messages
  • Paul Kulchenko
    Hi, Ivan! This code works. If you get something else to work, let me know ;) use SOAP::Lite; # terraserver doesn t like charset in content-type
    Message 1 of 5 , Sep 19, 2001
      Hi, Ivan!

      This code works. If you get something else to work, let me know ;)

      use SOAP::Lite;

      # terraserver doesn't like charset in content-type
      $SOAP::Constants::DO_NOT_USE_CHARSET = 1;

      my $terra = SOAP::Lite
      ->proxy('http://terraserver.microsoft.net/TerraService.asmx')
      ->on_action(sub { join '', @_ })
      ->uri('http://tempuri.org/')
      ;

      my $response = $terra->GetTheme(SOAP::Data->name(theme => 'Photo'));

      die $response->faultstring if $response->fault;

      use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent =
      1;

      print "Here is what we got:\n", Dumper($response->result);

      __END__

      # returns error, which looks like some internal problem
      my $response = $terra->GetPlaceList(
      SOAP::Data->name(placeName => 'Kansas City'),
      SOAP::Data->name(MaxItems => 10),
      SOAP::Data->name(imagePresence => 1)->type('boolean'),
      );

      Best wishes, Paul.

      --- judson@... wrote:
      > Has anybody figured out how to get TerraService to work with
      > SOAP::Lite?
      >
      > The interesting (almost wsdl) part is at:
      >
      > http://terraserver.microsoft.net/TerraService.asmx?SDL
      >
      > more general information is at:
      >
      > http://terraserver.microsoft.net/
      >
      > --Ivan
      >
      >
      > To unsubscribe from this group, send an email to:
      > soaplite-unsubscribe@yahoogroups.com
      >
      >
      >
      > Your use of Yahoo! Groups is subject to
      > http://docs.yahoo.com/info/terms/
      >
      >


      __________________________________________________
      Terrorist Attacks on U.S. - How can you help?
      Donate cash, emergency relief information
      http://dailynews.yahoo.com/fc/US/Emergency_Information/
    • Ivan R. Judson
      Hey Paul, While waiting for backup stuff to finish on my home machine I just finished this modification: use SOAP::Lite debug ; use Data::Dumper;
      Message 2 of 5 , Oct 5, 2001
        Hey Paul,

        While waiting for backup stuff to finish on my home machine I just finished
        this modification:

        use SOAP::Lite 'debug';
        use Data::Dumper;

        $Data::Dumper::Terse = 1;
        $Data::Dumper::Indent = 1;

        # terraserver doesn't like charset in content-type
        $SOAP::Constants::DO_NOT_USE_CHARSET = 1;

        my $terra = SOAP::Lite
        ->proxy('http://terraserver.microsoft.net/TerraService.asmx')
        ->on_action(sub { join '', @_ })
        ->uri('http://tempuri.org/')
        ;

        my $response = $terra->GetTheme(SOAP::Data->name(theme => 'Photo'));

        if($response->fault) {
        die $response->faultstring;
        } else {
        print "Here is what we got:\n", Dumper($response->result);
        }

        my $method = SOAP::Data->name('GetPlaceList')
        ->attr({xmlns => 'http://tempuri.org/'});

        my @params = (
        SOAP::Data->name(placeName => 'Chicago'),
        SOAP::Data->name(MaxItems => 10),
        SOAP::Data->name(imagePresence => 'true')
        );

        my $response = $terra->call($method => @params);

        if($response->fault) {
        print $response->faultcode, " ", $response->faultstring, "\n";
        } else {
        print "Here is what we got:\n", Dumper($response->result);
        }

        Which works happily once I fixed the namespace stuff (I'm glad that
        documented in the ActiveState help :-). So now I get data, but there's a
        difference between what I see in the raw debug output and the printed
        output...any ideas?

        --Ivan

        > -----Original Message-----
        > From: Paul Kulchenko [mailto:paulclinger@...]
        > Sent: Wednesday, September 19, 2001 9:25 PM
        > To: soaplite@yahoogroups.com
        > Subject: Re: [soaplite] Totally unrelated note: TerraService
        >
        >
        > Hi, Ivan!
        >
        > This code works. If you get something else to work, let me know ;)
        >
        > use SOAP::Lite;
        >
        > # terraserver doesn't like charset in content-type
        > $SOAP::Constants::DO_NOT_USE_CHARSET = 1;
        >
        > my $terra = SOAP::Lite
        > ->proxy('http://terraserver.microsoft.net/TerraService.asmx')
        > ->on_action(sub { join '', @_ })
        > ->uri('http://tempuri.org/')
        > ;
        >
        > my $response = $terra->GetTheme(SOAP::Data->name(theme => 'Photo'));
        >
        > die $response->faultstring if $response->fault;
        >
        > use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent =
        > 1;
        >
        > print "Here is what we got:\n", Dumper($response->result);
        >
        > __END__
        >
        > # returns error, which looks like some internal problem
        > my $response = $terra->GetPlaceList(
        > SOAP::Data->name(placeName => 'Kansas City'),
        > SOAP::Data->name(MaxItems => 10),
        > SOAP::Data->name(imagePresence => 1)->type('boolean'),
        > );
        >
        > Best wishes, Paul.
        >
        > --- judson@... wrote:
        > > Has anybody figured out how to get TerraService to work with
        > > SOAP::Lite?
        > >
        > > The interesting (almost wsdl) part is at:
        > >
        > > http://terraserver.microsoft.net/TerraService.asmx?SDL
        > >
        > > more general information is at:
        > >
        > > http://terraserver.microsoft.net/
        > >
        > > --Ivan
        > >
        > >
        > > To unsubscribe from this group, send an email to:
        > > soaplite-unsubscribe@yahoogroups.com
        > >
        > >
        > >
        > > Your use of Yahoo! Groups is subject to
        > > http://docs.yahoo.com/info/terms/
        > >
        > >
        >
        >
        > __________________________________________________
        > Terrorist Attacks on U.S. - How can you help?
        > Donate cash, emergency relief information
        > http://dailynews.yahoo.com/fc/US/Emergency_Information/
        >
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
        >
        >
      • Paul Kulchenko
        Hi, Ivan! ... Yes, that s because you have a datastructure that can t be represented as hash or array. You either need to write a deserializer for this
        Message 3 of 5 , Oct 5, 2001
          Hi, Ivan!

          > documented in the ActiveState help :-). So now I get data, but
          > there's a
          > difference between what I see in the raw debug output and the
          > printed output...any ideas?

          Yes, that's because you have a datastructure that can't be
          represented as hash or array. You either need to write a deserializer
          for this datatype or navigate thru the envelope yourself. More
          details and examples are here:

          http://groups.yahoo.com/group/soaplite/message/550

          Best wishes, Paul.

          --- "Ivan R. Judson" <judson@...> wrote:
          >
          > Hey Paul,
          >
          > While waiting for backup stuff to finish on my home machine I just
          > finished
          > this modification:
          >
          > use SOAP::Lite 'debug';
          > use Data::Dumper;
          >
          > $Data::Dumper::Terse = 1;
          > $Data::Dumper::Indent = 1;
          >
          > # terraserver doesn't like charset in content-type
          > $SOAP::Constants::DO_NOT_USE_CHARSET = 1;
          >
          > my $terra = SOAP::Lite
          > ->proxy('http://terraserver.microsoft.net/TerraService.asmx')
          > ->on_action(sub { join '', @_ })
          > ->uri('http://tempuri.org/')
          > ;
          >
          > my $response = $terra->GetTheme(SOAP::Data->name(theme =>
          > 'Photo'));
          >
          > if($response->fault) {
          > die $response->faultstring;
          > } else {
          > print "Here is what we got:\n", Dumper($response->result);
          > }
          >
          > my $method = SOAP::Data->name('GetPlaceList')
          > ->attr({xmlns => 'http://tempuri.org/'});
          >
          > my @params = (
          > SOAP::Data->name(placeName => 'Chicago'),
          > SOAP::Data->name(MaxItems => 10),
          > SOAP::Data->name(imagePresence => 'true')
          > );
          >
          > my $response = $terra->call($method => @params);
          >
          > if($response->fault) {
          > print $response->faultcode, " ", $response->faultstring, "\n";
          > } else {
          > print "Here is what we got:\n", Dumper($response->result);
          > }
          >
          > Which works happily once I fixed the namespace stuff (I'm glad that
          > documented in the ActiveState help :-). So now I get data, but
          > there's a
          > difference between what I see in the raw debug output and the
          > printed
          > output...any ideas?
          >
          > --Ivan
          >
          > > -----Original Message-----
          > > From: Paul Kulchenko [mailto:paulclinger@...]
          > > Sent: Wednesday, September 19, 2001 9:25 PM
          > > To: soaplite@yahoogroups.com
          > > Subject: Re: [soaplite] Totally unrelated note: TerraService
          > >
          > >
          > > Hi, Ivan!
          > >
          > > This code works. If you get something else to work, let me know
          > ;)
          > >
          > > use SOAP::Lite;
          > >
          > > # terraserver doesn't like charset in content-type
          > > $SOAP::Constants::DO_NOT_USE_CHARSET = 1;
          > >
          > > my $terra = SOAP::Lite
          > > ->proxy('http://terraserver.microsoft.net/TerraService.asmx')
          > > ->on_action(sub { join '', @_ })
          > > ->uri('http://tempuri.org/')
          > > ;
          > >
          > > my $response = $terra->GetTheme(SOAP::Data->name(theme =>
          > 'Photo'));
          > >
          > > die $response->faultstring if $response->fault;
          > >
          > > use Data::Dumper; $Data::Dumper::Terse = 1; $Data::Dumper::Indent
          > =
          > > 1;
          > >
          > > print "Here is what we got:\n", Dumper($response->result);
          > >
          > > __END__
          > >
          > > # returns error, which looks like some internal problem
          > > my $response = $terra->GetPlaceList(
          > > SOAP::Data->name(placeName => 'Kansas City'),
          > > SOAP::Data->name(MaxItems => 10),
          > > SOAP::Data->name(imagePresence => 1)->type('boolean'),
          > > );
          > >
          > > Best wishes, Paul.
          > >
          > > --- judson@... wrote:
          > > > Has anybody figured out how to get TerraService to work with
          > > > SOAP::Lite?
          > > >
          > > > The interesting (almost wsdl) part is at:
          > > >
          > > > http://terraserver.microsoft.net/TerraService.asmx?SDL
          > > >
          > > > more general information is at:
          > > >
          > > > http://terraserver.microsoft.net/
          > > >
          > > > --Ivan
          > > >
          > > >
          > > > To unsubscribe from this group, send an email to:
          > > > soaplite-unsubscribe@yahoogroups.com
          > > >
          > > >
          > > >
          > > > Your use of Yahoo! Groups is subject to
          > > > http://docs.yahoo.com/info/terms/
          > > >
          > > >
          > >
          > >
          > > __________________________________________________
          > > Terrorist Attacks on U.S. - How can you help?
          > > Donate cash, emergency relief information
          > > http://dailynews.yahoo.com/fc/US/Emergency_Information/
          > >
          > >
          > > To unsubscribe from this group, send an email to:
          > > soaplite-unsubscribe@yahoogroups.com
          > >
          > >
          > >
          > > Your use of Yahoo! Groups is subject to
          > http://docs.yahoo.com/info/terms/
          > >
          > >
          >
          >
          > ------------------------ Yahoo! Groups Sponsor
          >
          > To unsubscribe from this group, send an email to:
          > soaplite-unsubscribe@yahoogroups.com
          >
          >
          >
          > Your use of Yahoo! Groups is subject to
          > http://docs.yahoo.com/info/terms/
          >
          >


          __________________________________________________
          Do You Yahoo!?
          NEW from Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
          http://geocities.yahoo.com/ps/info1
        • ericpromislow
          ... Excuse all the XML in this message -- I ve tried to edit it for relevance and brevity. I m able to generate SOAP::Lite client-side wrappers for most RPC,
          Message 4 of 5 , Jul 25, 2002
            Last October, 2001, --- In soaplite@y..., judson@m... wrote:
            > Has anybody figured out how to get TerraService to work with
            > SOAP::Lite?
            >

            Excuse all the XML in this message -- I've tried to edit it
            for relevance and brevity. I'm able to generate SOAP::Lite
            client-side wrappers for most RPC, but some doc/lit code
            still gives me problems. Here's an example using TerraService:

            The (edited) WSDL:

            <s:complexType name="Place">
            <s:sequence>
            <s:element 0..1 name="City" type="s:string" />
            <s:element 0..1 name="State" type="s:string" />
            <s:element 0..1 name="Country" type="s:string" />
            </s:sequence>
            ...

            <s:element name="GetPlaceFacts">
            <s:complexType>
            <s:sequence>
            <s:element 1..1 name="place" type="s0:Place" />
            </s:sequence>
            </s:complexType>
            </s:element>
            ...

            <message name="GetPlaceFactsSoapIn">
            <part name="parameters" element="s0:GetPlaceFacts" />
            </message>
            ...

            <operation name="GetPlaceFacts">
            <soap:operation
            soapAction="http://terraservice.net/terraserver/GetPlaceFacts"
            style="document" />
            <input>
            <soap:body use="literal" />
            </input>
            <output>
            <soap:body use="literal" />
            </output>
            </operation>


            Here's the code I'm generating from the WSDL:


            sub ComplexType_Place {
            my ($name, $param, $ns) = @_;
            return SOAP::Data->name($name)->type('')->uri($ns)->value
            (\SOAP::Data->value(
            SOAP::Data->name('City')->type('')->uri($ns)->value($param->
            {'City'}),
            SOAP::Data->name('State')->type('')->uri($ns)->value($param->
            {'State'}),
            SOAP::Data->name('Country')->type('')->uri($ns)->value($param-
            >{'Country'})));
            }


            sub GetPlaceFacts {
            my $place = {
            City => 'Blaine',
            State => 'Washington',
            Country => 'United States',
            };

            my $endpoint = 'http://terraservice.net/TerraService.asmx';
            my $uri = 'http://terraservice.net/terraserver/';
            my $soapObj = SOAP::Lite->new (
            'xmlschema' => '2001',
            'proxy' => $endpoint,
            'uri' => $uri,
            'serializer' =>
            My::Serializer->new('xmlschema' =>'2001'),
            );
            my $wrapped_place =
            ComplexType_Place_literal('place', $place, $uri);
            $soapObj = $soapObj ->
            on_action(sub { return
            '"http://terraservice.net/terraserver/GetPlaceFacts"';});
            my $res = $soapObj->call(SOAP::Data->name('GetPlaceFacts')
            -> attr({xmlns => $uri})->value([$wrapped_place]));
            if ($res->fault) {
            print 'GetPlaceList', $res2->faultstring, "\n";
            } else {
            print Dumper $res2->result;
            }
            }


            Here's the generated envelope:

            <?xml version='1.0'?>
            <SOAP-ENV:Envelope
            xmlns:namesp2="http://namespaces.soaplite.com/perl"
            xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
            xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
            <SOAP-ENV:Body>
            <GetPlaceFacts
            xmlns="http://terraservice.net/terraserver/"
            SOAP-ENC:arrayType="namesp2[1]"
            xsi:type="SOAP-ENC:Array">
            <namesp1:place
            xsi:type="namesp2" <!-- ******** -->
            xmlns:namesp1="http://terraservice.net/terraserver/">
            <namesp3:City
            xmlns:namesp3="http://terraservice.net/terraserver/"
            >Blaine</namesp3:City>
            <namesp4:State
            xmlns:namesp4="http://terraservice.net/terraserver/"
            >Washington</namesp4:State>
            <namesp5:Country
            xmlns:namesp5="http://terraservice.net/terraserver/"
            >United States</namesp5:Country>
            </namesp1:place>
            </GetPlaceFacts>
            </SOAP-ENV:Body>
            </SOAP-ENV:Envelope>

            ms.net complains about this:
            <faultstring>System.Web.Services.Protocols.SoapException:
            Server was unable to read request.
            System.InvalidOperationException:
            There is an error in XML document (1, 461).
            System.InvalidOperationException:
            The specified type was not recognized: name='namesp2',
            namespace='http://terraservice.net/terraserver/',
            at place xmlns='http://terraservice.net/terraserver/'

            If I manually remove 'xsi:type="namesp2"' from the
            place tag, it works. What do I need to tell SOAP::Lite
            to prevent this?


            Thanks.
          Your message has been successfully submitted and would be delivered to recipients shortly.