|
Posted by Christian Winter on April 4, 2008, 2:38 pm
Please log in for more thread options
Hi there,
for my current job, I've put together a module that
makes it easier to build basic web services around
SOAP::Transport::HTTP::CGI and that provides an
implicit functionality to generate the appropriate
WSDL file. It's still a bit of a hack, as it's simply
aimed to DWIM.
Basically, it consists of a module "WSDL::Easy" that's
used as the base class for all webservices, and a
submodule WSDL::Easy::Attribute that also employs
attribute magic and some TIE stuff. As a result, you
simply inherit from WSDL::Easy and declare your methods
like:
sub webmethod1
:in( "lala" => "string", "lolo" => "int" )
:out( "result" => "string" )
{
my( $class, $self ) = @_;
return [{ "result" => $self-> . $self-> }];
}
In the CGI service script you include your module,
instantiate it with the name and SOAP-URI for the service
and invoke it's dispatch() method. If called with a GET
parameter of "WSDL", it returns the WSDL definition file,
though currently only for RPC style formatting.
At the time being, the return value is always an array
with the first element containing all the parameters defined
in the :out attribute, as this was the quickest way to get
Perl and PHP5 (which currently makes up the client side) to agree
on how to handle it.
More complex types will follow, for the first part I'll
implement nesting via hash/array refs in the in/out attributes.
Later on, I also plan to make it possible to define own complex
types separately from the subroutine using it.
I'd like to know if you've got any thoughts on that, either
wishes you have for such a module, practical experience
from work or caveats to consider, as I'm planning on releasing
it to CPAN once it's reasonably stable and tested, and I'd
rather avoid adding just another hardly-used WSDL thingy to
the repository.
-Chris
|
| Similar Threads | Posted | | SOAP::Lite WSDL method with multiple soap:body parts | February 16, 2005, 3:32 pm |
| SOAP::Lite and WSDL namespace - please help | November 4, 2005, 10:43 am |
| SOAP::Lite and .wsdl files | April 7, 2006, 11:36 am |
| SOAP::Lite POD::WSDL and .NET clients | April 25, 2007, 12:41 pm |
| How to generate WSDL file from SOAP::Lite | May 25, 2007, 5:48 am |
| SOAP::WSDL error accessing remote site. | July 19, 2007, 3:14 am |
| Writing a HTML/ASP SOAP client for a SOAP::Lite destination | March 16, 2005, 5:19 pm |
| Net::LDAP makefile generation fails on ActiveState Perl 5.8.8 | June 23, 2006, 2:57 am |
| SOAP::Lite : Problem of # sign added by SOAP::Lite in the sent SOAPActionstring | November 5, 2004, 8:45 pm |
| Help with SOAP::Lite | January 19, 2005, 11:35 pm |
|