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

4168WSDL generation

Expand Messages
  • Mike Schroeder
    Nov 9, 2004
      Is anyone interested in collaborating on improving WSDL generation in

      Since Perl is dynamically typed, it makes a great SOAP client, but is
      kind of a pain as a SOAP server. As far as I can tell, to consistently
      generate a WSDL, we need some extra metadata that can not be easily
      discerned just from inspecting the code. The question is where to store
      that metadata.

      The idea I've been looking at is to embed YAML-based metadata in POD
      inside a module. Our company already does this for embedded YAML-based
      test definitions, and we can easily adapt it to defining the data needed
      for a WSDL. The issue for me is that I don't know enough about WSDLs to
      do this by myself. If someone could help me with defining what
      information is needed, and how to apply that information to a template,
      I think the rest is already in place.

      Here is an example of what I am thinking.

      1) In your module called by the handler(), you would have some POD that
      contains a YAML-based definition of your method (this example is loosely
      based on WSDL sample from the WSDL chapter in the O'Reilly Web Services
      with Perl book - my apologies for butchering it):

      <start sample of embedded YAML-based WSDL specs>

      =head2 GetBook()

      =begin wsdl_spec

      - method: GetBook
      action: WishListCustomer
      - isbn: string
      isbn: string
      title: string
      url: anyURI
      location: http://localhost:9000

      =end wsdl_spec

      sub some_method {

      # your actual code here

      <end sample of embedded YAML-based WSDL specs>

      2) we add a custom POD parser to SOAP::Lite based on Pod::Parser that
      can extract the YAML-spec and return the XML. Ideally, something could
      be done on handler() that checks for a WSDL request (looks for a "wsdl"
      ending?) and automagically calls the new WSDL method and returns the
      requested WDSL data rather than calling the given method. This would
      look *something* like:

      my $parser = new MyParser(); # subclassed from Pod::Parser
      $parser->parse_from_file( $filename );

      # let YAML convert to a Perl structure
      my $wsdl = Load $parser->{wsdl_spec};

      # apply the Perl struct to some template
      return generate_wsdl_from_specs( $wsdl); # where I need help

      The $wsdl variable should contain a ref to this structure:

      $VAR1 = [
      'arguments' => [
      'isbn' => 'string'
      'action' => 'WishListCustomer',
      'service' => {
      'location' => 'http://localhost:9000'
      'method' => 'GetBook',
      'returns' => {
      'BookData' => {
      'url' => 'anyURI',
      'title' => 'string',
      'isbn' => 'string'

      From that, using some templating tool or *something* we should be able
      to generate a compliant WSDL.

      If I am way off in left field, or this idea is fatally flawed, please
      let me know.

      Thanks in advance to wiser folks than me for any feedback...

    • Show all 8 messages in this topic