Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: WSDL generation for a SOAP::Lite server

by Rhandom (Curate)
on Sep 17, 2004 at 15:49 UTC ( #391819=note: print w/replies, xml ) Need Help??


in reply to WSDL generation for a SOAP::Lite server

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)];

Replies are listed 'Best First'.
Re^2: WSDL generation for a SOAP::Lite server
by StoneTable (Beadle) on Sep 18, 2004 at 20:16 UTC

    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://391819]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2020-11-30 20:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?