Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

WSDL generation for a SOAP::Lite server

by StoneTable (Beadle)
on Sep 16, 2004 at 21:10 UTC ( #391566=perlquestion: print w/replies, xml ) Need Help??

StoneTable has asked for the wisdom of the Perl Monks concerning the following question:

I've built a server with SOAP::Lite and it needs to be callable from a .NET client, which requires a WSDL.

From all of the reading I've done (Google, various Perl books from O'Reilly), the only thing I've seen to generate the WSDL is WSDL::Generator, which appears to be out of date (make test fails installing from CPAN).

It would seem to me it should be something easily generated by SOAP::Lite (in a perfect world).

Is there a way to generate the WSDL more or less automatically, or am I going to be stuck writing it by hand?

  • Comment on WSDL generation for a SOAP::Lite server

Replies are listed 'Best First'.
Re: WSDL generation for a SOAP::Lite server
by InfiniteSilence (Curate) on Sep 16, 2004 at 23:56 UTC
    The problem with WSDL::Generator is actually a class it uses, Class::Hook. The problem is specified in the Generator.pm perldoc:

    =head1 CAVEATS

    WSDL doesn't works only on perl 5.6 and not 5.8. UNIVERSAL::AUTOLOAD is broken in perl 5.8 and it is used by Class::Hook upon wich WSDL::Generator depends.

    So, you can get it to work, presumably, by switching to perl 5.6. There is a more specific explanation of the problem (and a possible solution here)

    Celebrate Intellectual Diversity

      I may have to give 5.6 a try. I applied the patch in the link, which fixes the segfault with Class::Hook, but the WSDL:Generator test fails.
Re: WSDL generation for a SOAP::Lite server
by Rhandom (Curate) on Sep 17, 2004 at 15:49 UTC
    I actually have been in the middle of this same thing for several weeks now and have some suggestions.

    WSDL::Generator is kind of neat - but it is also a pain. I skipped the tests and installed the module itself (there is no binary portion). I hooked it just fine and it spat out a WSDL that would probably work just fine - actually it would work just fine. But it was ugly.

    The solution I finally came down to was to hand code my own. I read about the WSDL spec. I also had recently been working the Net::Google which happens to have a WSDL document embedded in it. The Google WSDL is a good example of complex return types and various request data types. With this information in hand I coded my own WSDL.

    The next step is making sure that using SOAP::Lite, as the server, would return the appropriately formatted XML. To debug what was getting input and output for the XML, I added the following code segments to SOAP/Lite.pm.
    # inserted at line 2281 before the "my $result =" line my $file = "/tmp/soap.in.xml"; if (open (my $fh,">$file")) { print $fh $_[0]; warn $file; } else { die "Couldn't open: $file"; }

    And
    # inserted at line 2348 before the "return $t" line my $file = "/tmp/soap.out.xml"; if (open (my $fh,">$file")) { print $fh $t; warn $file; } else { die "Couldn't open: $file"; }

    With the XML in hand, I could now make sure that my return data was getting serialized correctly. I made a special class that I blessed the data into. I then had a custom serializer that would look for that data type and when it was found, would invoke a custom package that inherited SOAP::Data to encapsulate the data correctly and did any touch ups on the XML attributes.

    Phew...

    I found myself thinking that we really need a new WSDL generator (anybody with time is welcome). All it needs to do is take a data structure for the request, and a data structure for the response, and have a few extra fields for specifics, and spit out the WSDL. WSDL::Generator currently tries to use too much magic, and the resulting WSDL is not exactly easy to document. Maybe if I get some free cycles or some round toits I'll try and create the module.

    Hope this has helped.

    my @a=qw(random brilliant braindead); print $a[rand(@a)];

      Thanks, that got me on the right track. I found a simple example of a WSDL, looked at the SOAP::Lite trace, and used SOAP::Data::Builder to build my response.

      I agree that the current WSDL generator seems lacking. I don't have the time or understanding of SOAP::Lite (yet) to pull it off.

      Thanks for all the help.

        Hi, StoneTable. I am suffering same problem. I manually created a WSDL file, it doesn't give any error, just don't work. Would you mind sharing your WSDL example with me? thanks.
Re: WSDL generation for a SOAP::Lite server
by Discipulus (Abbot) on Sep 17, 2004 at 07:48 UTC
    Hi Stonetable

    I had your some problem (see 297255) but I have not solved it untill now.
    I had used th Generator module but I dont know nothing about wsdl and C# .NET.

    I hope to find out a solution (I have super searched the web for days..)but for now I ask to you to put your eventual solution in snippet section.

    I'll do the same. Have a good research
    Lor*

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://391566]
Front-paged by pikus
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2020-12-02 22:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How often do you use taint mode?





    Results (47 votes). Check out past polls.

    Notices?