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

Re: [soaplite] WSDL generation

Expand Messages
  • Mike Schroeder
    ... Great! for the YAML parser is simple, and I ve *started* on the WSDL generation. For me, the rest is the hard part -- sounds like a good partnership! ;)
    Message 1 of 8 , Nov 12, 2004
    • 0 Attachment
      Byrne Reese wrote:

      > Your understanding of the problem is spot on. In fact, implementing
      > just what you have specified would be a HUGE leap and would lay the
      > ground work for the complete implementation. The YAML parser, and
      > basic WSDL generation is the hard part. The rest are just details.

      Great! for the YAML parser is simple, and I've *started* on the WSDL
      generation. For me, the rest is the hard part -- sounds like a good
      partnership! ;)

      >
      > The only thing missing is how complex types are defined, and how to
      > address SOAP encoding vs. Literal encoding styles.
      >
      > I might suggest a mean for someone to declare an empty hash containing
      > all the element names (no support for attributes to start with) and
      > there parent/child relationships. One could easily crawl a HASH to
      > generate a complex type. All you would need to do is have somewhere in
      > your YAML to say "find the structure of COMPLEXTYPENAME in the hash
      > called $HASHVARNAME. Of course that is just an idea. Think along the
      > lines of:

      I don't believe this would work with the POD-YAML parser -- it is just
      reading in the file and parsing out the YAML, so in order for it be able
      see current values/structures concurrently might be a trick - I suspect
      it would come down to how the handler script maintained state during a
      WSDL call versus a method call.

      However, the YAML format is quite flexible, so we could store the
      complex types in YAML as well. However, the values would need to be
      static (just in case you were looking for dynamic values). For example:

      =begin wsdl_spec

      - module: WishListCustomer
      method: GetBook
      arguments:
      isbn: string
      returns:
      BookData:
      isbn: string
      title: string
      url: anyURI
      complextype:
      foo:
      bar: 123
      baz: abc
      service:
      location: http://localhost:9000

      =end wsdl_spec

      generates this:

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

      'baz' => 'abc',

      'bar' => 123
      }
      }
      }
      }
      }
      ];

      So you can make this as complex as you want.

      Alternatively, we might want a YAML structure like this:

      - module: WishListCustomer
      method: GetBook
      arguments:
      isbn: string
      returns:
      BookData:
      isbn: string
      title: string
      url: anyURI
      ComplexReturn: foo
      customtypes:
      foo:
      bar: 123
      baz: abc
      service:
      location: http://localhost:9000

      where we can define some custom types, and then use one of those custom
      types to define the <types> section of the YAML.

      Again, I think the YAML is flexible enough, the key is to:

      a) start with the WSDL spec,
      b) reverse engineer it back to a finite set of variables needed,
      c) create a YAML format the stores that finite set of variables
      d) write an interpolation routine to apply the YAML-specs to generate
      the WSDL.
      e) hook the resulting WSDL generater into the server handler()

      Steps B and E are where I need the most help. Once that is done, the
      WSDL generater is basically something like:

      my $wsdl = Load $wsdl_spec;
      print start_definitions( $wsdl->[0] );
      print types( $wsdl );
      print message( $wsdl );
      print portType( $wsdl );
      print binding( $wsdl );
      print service( $wsdl );
      print end_definitions( $wsdl );

      Another choice to make here is whether to use something like
      Template::Toolkit (just interpolate variables into predefined XML) or to
      use some XML module to generate the actual XML programmatically.

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