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

5083Re: [soaplite] v0.66: use_prefix deprecated and services via WSDL

Expand Messages
  • Byrne Reese
    Dec 29, 2005
      Damn. Ok. This could be a hack, but let's see if we can't nail this down:

      Do you see the following code in the stub?

      $self->endpoint($method{endpoint})
      ->uri($method{uri})
      ->on_action(sub{qq!"$method{soapaction}"!});

      Try saving the stub to disk and changing that to:

      $self->endpoint($method{endpoint})
      ->ns($method{uri})
      ->on_action(sub{qq!"$method{soapaction}"!});

      uri() might be making a call to use_prefix... but the use of uri() is
      deprecated as well. Hmmm.

      Dan Horne wrote:
      > Hi Byrne
      >
      > I'm afraid that I haven't been able to make much progress. The code
      > from the
      > generated stub makes no explicit reference to "use_prefix" (I've
      > pasted the
      > stub below). I tried following the SOAP::Lite code around to try and
      > figure
      > out where use_prefix may be called, but I got lost in all of the AUTOLOADs
      > and dynamic methods, I'm afraid.
      >
      > As a side note, following the POD doco for generating stubs doesn't work
      > (unless I've misunderstood the doco). SOAP Lite tries calling the stub
      > method on the remote web service:
      >
      > # ./stub.pl
      > Unrecognized method 'stub'. List of available method(s): getQuote
      >
      > stub.pl:
      >
      > #!/usr/local/bin/perl
      > use SOAP::Lite;
      > my $client = SOAP::Lite->new;
      > my $wsdl = 'http://www.xmethods.net/sd/StockQuoteService.wsdl';
      > <http://www.xmethods.net/sd/StockQuoteService.wsdl%27;>
      > my $code = $client->service($wsdl)->stub;
      >
      > This works:
      >
      > #!/usr/local/bin/perl
      > use SOAP::Lite;
      > my $wsdl = 'http://www.xmethods.net/sd/StockQuoteService.wsdl';
      > <http://www.xmethods.net/sd/StockQuoteService.wsdl%27;>
      > print SOAP::Schema->new->schema_url($wsdl)->parse->load->stub;
      >
      > The generated stub:
      >
      > package net_xmethods_services_stockquote_StockQuoteService;
      > # Generated by SOAP::Lite (v0.66) for Perl -- soaplite.com
      > # Copyright (C) 2000-2004 Paul Kulchenko
      > # -- generated at [Fri Dec 30 11:16:00 2005]
      > # -- generated from http://www.xmethods.net/sd/StockQuoteService.wsdl
      > my %methods = (
      > getQuote => {
      > endpoint => 'http://services.xmethods.net/soap',
      > <http://services.xmethods.net/soap%27,>
      > soapaction => 'urn:xmethods-delayed-quotes#getQuote',
      > uri => 'urn:xmethods-delayed-quotes',
      > parameters => [
      > SOAP::Data->new(name => 'symbol', type => 'xsd:string', attr => {}),
      > ], # end parameters
      > }, # end getQuote
      > ); # end my %methods
      >
      > use SOAP::Lite;
      > use Exporter;
      > use Carp ();
      >
      > use vars qw(@ISA $AUTOLOAD @EXPORT_OK %EXPORT_TAGS);
      > @ISA = qw(Exporter SOAP::Lite);
      > @EXPORT_OK = (keys %methods);
      > %EXPORT_TAGS = ('all' => [@EXPORT_OK]);
      >
      > sub _call {
      > my ($self, $method) = (shift, shift);
      > my $name = UNIVERSAL::isa($method => 'SOAP::Data') ? $method->name :
      > $method;
      > my %method = %{$methods{$name}};
      > $self->proxy($method{endpoint} || Carp::croak "No server address (proxy)
      > specified")
      > unless $self->proxy;
      > my @templates = @{$method{parameters}};
      > my @parameters = ();
      > foreach my $param (@_) {
      > if (@templates) {
      > my $template = shift @templates;
      > my ($prefix,$typename) = SOAP::Utils::splitqname($template->type);
      > my $method = 'as_'.$typename;
      > # TODO - if can('as_'.$typename) {...}
      > my $result = $self->serializer->$method($param, $template->name,
      > $template->type, $template->attr);
      > push(@parameters, $template->value($result->[2]));
      > } else {
      > push(@parameters, $param);
      > }
      > }
      > $self->endpoint($method{endpoint})
      > ->uri($method{uri})
      > ->on_action(sub{qq!"$method{soapaction}"!});
      >
      > $self->serializer->register_ns("http://www.themindelectric.com/","electric")
      > ;
      >
      > $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/soap/","soap
      > ");
      >
      > $self->serializer->register_ns("http://schemas.xmlsoap.org/wsdl/","wsdl");
      >
      > $self->serializer->register_ns("http://schemas.xmlsoap.org/soap/encoding/","
      > soapenc");
      >
      > $self->serializer->register_ns("http://www.themindelectric.com/wsdl/net.xmet
      > hods.services.stockquote.StockQuote/","tns");
      >
      > $self->serializer->register_ns("http://www.w3.org/2001/XMLSchema","xsd");
      > my $som = $self->SUPER::call($method => @parameters);
      > if ($self->want_som) {
      > return $som;
      > }
      > UNIVERSAL::isa($som => 'SOAP::SOM') ? wantarray ? $som->paramsall :
      > $som->result : $som;
      > }
      >
      > sub BEGIN {
      > no strict 'refs';
      > for my $method (qw(want_som)) {
      > my $field = '_' . $method;
      > *$method = sub {
      > my $self = shift->new;
      > @_ ? ($self->{$field} = shift, return $self) : return
      > $self->{$field};
      > }
      > }
      > }
      > no strict 'refs';
      > for my $method (@EXPORT_OK) {
      > my %method = %{$methods{$method}};
      > *$method = sub {
      > my $self = UNIVERSAL::isa($_[0] => __PACKAGE__)
      > ? ref $_[0] ? shift # OBJECT
      > # CLASS, either get self or create new and assign to
      > self
      > : (shift->self || __PACKAGE__->self(__PACKAGE__->new))
      > # function call, either get self or create new and assign to self
      > : (__PACKAGE__->self || __PACKAGE__->self(__PACKAGE__->new));
      > $self->_call($method, @_);
      > }
      > }
      >
      > sub AUTOLOAD {
      > my $method = substr($AUTOLOAD, rindex($AUTOLOAD, '::') + 2);
      > return if $method eq 'DESTROY' || $method eq 'want_som';
      > die "Unrecognized method '$method'. List of available method(s):
      > @EXPORT_OK\n";
      > }
      >
      > 1;
      >
      > Thanks
      >
      > Dan Horne
      > > -----Original Message-----
      > > From: Byrne Reese [mailto:byrne@...]
      > > Sent: Friday, 30 December 2005 04:58
      > > To: Eric Bridger
      > > Cc: Dan Horne; soaplite@yahoogroups.com
      > > Subject: Re: [soaplite] v0.66: use_prefix deprecated and
      > > services via WSDL
      > >
      > >
      > > I am sorry you guys are experiencing problems. I had a
      > > feeling this was
      > > going to trip people up, which is why I documented this change so
      > > thoroughly. The following blog post should hopefully clear
      > > things up --
      > > knock on wood.
      > >
      > > http://www.soaplite.com/2005/04/tturitt_and_ttu.html
      > >
      > > In summary, the autogenerated code stubs created by SOAP::Lite
      > > (actually) should not reference these deprecated methods. So
      > > if it is,
      > > then there is a problem that must be resolved. But please consult the
      > > following man page, which has more details about the latest
      > > changes to
      > > SOAP::Lite's APIs in regards to WSDL:
      > >
      > > http://www.majordojo.com/soaplite/docs/Schema.html
      > >
      > > You can actually cache, or save the generated code stubs - or
      > > print them
      > > to the screen. If you are having problems with a specific web
      > > service,
      > > by all means, forward your code to this mailing list, and I
      > > or someone
      > > else should be able to help.
      > >
      > > Byrne
      > > Lead Developer, SOAP::Lite
      > >
      > > Eric Bridger wrote:
      > > > Not really sure but you could try:
      > > >
      > > > SOAP::Lite->service(...)
      > > > ->use_prefix(0)
      > > >
      > > > Also see:
      > > >
      > > > SOAP::Lite->serializer->register_ns(namespace, prefix);
      > > >
      > > > Eric
      > > >
      > > > On Thu, 2005-12-29 at 01:03, Dan Horne wrote:
      > > > > Running the standard web service example from the doco:
      > > > >
      > > > > #!/usr/local/bin/perl
      > > > > use SOAP::Lite;
      > > > > print SOAP::Lite
      > > > > ->
      > service('http://www.xmethods.net/sd/StockQuoteService.wsdl')
      > <http://www.xmethods.net/sd/StockQuoteService.wsdl%27%29>
      > > > <http://www.xmethods.net/sd/StockQuoteService.wsdl%27%29>
      > > > > -> getQuote('MSFT');
      > > > >
      > > > > And the warnings return:
      > > > >
      > > > > use_prefix has been deprecated. if you wish to turn off or on the
      > > > use of a
      > > > > default namespace, then please use either ns(uri) or
      > > default_ns(uri)
      > > > > at /usr/local/lib/perl5/site_perl/5.8.7/SOAP/Lite.pm line 858.
      > > > >
      > > > > It's not clear to me how I use ns or default_ns in this instance.
      > > > >
      > > > > Regards
      > > > >
      > > > > Dan Horne
    • Show all 15 messages in this topic