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

WSDL Troubles - HELP!

Expand Messages
  • the_quark1
    All, I m pulling my hair out, here. My long-term goal is to get an MSSoap 3.0 client connecting to my SOAP::Lite server. That isn t working, either, but I
    Message 1 of 2 , Nov 21, 2002
    • 0 Attachment
      All,

      I'm pulling my hair out, here. My long-term goal is to get an MSSoap
      3.0 client connecting to my SOAP::Lite server. That isn't working,
      either, but I thought as a first step, I thought I'd get a SOAP::Lite
      client working with WSDL.

      I have a very basic "Person" class I'm using for my testing. It's
      running under mod_perl, and looks like:

      [/var/www/html/quark/soap_person.pl]
      ---
      #!/usr/bin/perl -w

      use strict;

      use SOAP::Transport::HTTP;

      SOAP::Transport::HTTP::Apache
      -> dispatch_to('/var/www/html/quark', 'Person')
      -> handle;
      ---

      All the actual work is done by the Person.pm, at:
      [/var/www/html/quark/Person.pm]
      ---
      #!/usr/bin/perl -w

      use strict;

      package Person;

      sub new
      {
      my $proto = shift;
      my $class = ref($proto) || $proto;
      my $self = {};

      $self->{first} = undef;
      $self->{last} = undef;
      $self->{sex} = undef;

      my $args = shift;

      if(defined($args))
      {
      $self->{first} = $args->{first} || undef;
      $self->{'last'} = $args->{'last'} || undef;
      $self->{'sex'} = $args->{'sex'} || undef;
      }

      return(bless($self, $class));
      }

      sub version
      {
      return("0.1");
      }

      sub first
      {
      return(_access_val("first", @_));
      }

      sub last
      {
      return(_access_val("last", @_));
      }

      sub sex
      {
      return(_access_val("sex", @_));
      }

      sub info
      {
      my $self = shift;
      my $info = $self->first . " " . $self->last . " (" . $self->sex .
      ")";

      return($info);
      }
      ---
      If I run this client against it, with no WSDL, it works fine:

      [soap_test_ad]
      ---
      #!/usr/bin/perl -w

      use SOAP::Lite +autodispatch =>
      uri => 'http://www.baz.com/Person',
      proxy => 'http://kimura.baz.com/quark/soap_person.pl';


      my $Dude = Person->new({"first" => "John", "last" => "Doe", "sex" =>
      "M"});

      if($Dude->fault)
      {
      print join ', ',
      $Dude->faultcode,
      $Dude->faultstring,
      $Dude->faultdetail;
      }
      else
      {
      print STDOUT "Dude Version " . $Dude->version . "\n";
      print STDOUT $Dude->info . "\n";
      }
      ---

      So, that's all pretty straightforward. Now, on to WSDL. I'm
      generating my WSDL file with the following:

      [wsdl]
      ---
      #!/usr/bin/perl -w

      BEGIN{push(@INC, "/var/www/html/quark/")};

      use WSDL::Generator;

      $init = {'schema_namesp' => 'http://kimura.baz.com/quark/Person.xsd',
      'services' => 'http://www.baz.com/',
      'service_name' => 'Person',
      'target_namesp' => 'http://kimura.baz.com/quark/soap_person.pl',
      'documentation' => 'Stupid Example',
      'location' => 'http://kimura.baz.com/quark/soap_person.pl' };

      my $wsdl = WSDL::Generator->new($init);

      my $dude = Person->new({"first" => "John", "last" => "Doe", "sex" =>
      "M"});
      my $first = $dude->first("John");
      my $last = $dude->last("Doe");
      my $sex = $dude->sex("M");
      my $version = $dude->version();
      my $info = $dude->info();

      print $wsdl->get('Person');
      ---

      The output of that is rather long, but if anyone is interested, it's
      downloadable from

      http://www.baz.com/quark/Person.xsd

      Here's my WSDL test client:

      [soap_test_wsdl]
      --
      #!/usr/bin/perl -w

      use SOAP::Lite;

      my $service = SOAP::Lite
      -> service('http://kimura.baz.com/quark/Person.xsd');

      my $Dude = $service->new({"first" => "John", "last" => "Doe", "sex" =>
      "M"});

      if(defined($Dude))
      {
      if(!$Dude->fault)
      {
      print STDOUT $Dude->info . "\n";
      }
      else
      {
      print STDERR join ', ',
      $Dude->faultcode,
      $Dude->faultstring,
      $Dude->faultdetail
      }
      }
      else
      {
      print STDERR "NULL Dude!\n";
      }
      ---

      When I run this, I get:

      Deep recursion on anonymous subroutine at (eval 91) line 70.

      It then hangs.

      The proximate cause, as near as I can tell, is that, in this function
      in SOAP/Lite.pm, around line 2626:

      sub self {
      @_ > 1 ? $soap = $_[1] : $soap
      }

      That at this point, "$soap" is undefined, and it's causing an infinite
      loop.

      So, has anyone else seen this? I'd argue it's a bug in SOAP (in that
      it shouldn't be possible IMHO to give it a WSDL that will hang it),
      but beyond that, I guess the workaround is to learn about WSDL and
      figure out what might be wrong about WSDL::Generator's WSDL? Anyone
      have any suggestions? I've been googling and expermimenting on this
      for about six hours straight, now, and I'm at my wit's end...

      Thanks!

      Brett
    • the_quark1
      So, I ve now figured out that you can t have an operation named new in a WSDL you want to use with SOAP:Lite. When I changed the new to create, I got past
      Message 2 of 2 , Nov 22, 2002
      • 0 Attachment
        So, I've now figured out that you can't have an operation named new in
        a WSDL you want to use with SOAP:Lite. When I changed the "new" to
        "create," I got past my endless loop hump. Without really
        understanding what's going on, I suspect it's because of this line in
        Lite.pm:

        return (keys %services)[0]->new;

        I think there's a collision hapenning where %services[0] already has a
        member named "new" (my operation). But I'm not 100% sure, just
        thought I'd pass along the pointer in case someone who actually knows
        how this stuff works wanted to try to fix it.

        It still isn't quite working, at this point, but I'm still trying to
        work on it...

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