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

I've got a web services server implemented with SOAP::Lite over http and would like to publish a wsdl document so that the browser can return it as xml.

This is common for example with Axis.

If the service is available at 7777 port and host is myhost, calling

http://myhost:7777/mywsdl?WSDL

should render the document.

I am not sure where to start, if trim the serializer/http::response/request...

Replies are listed 'Best First'.
Re: publishing wsdl with soap::lite
by rahed (Scribe) on Dec 09, 2010 at 20:35 UTC
    To continue (and finish) I implemented the functionality like this:

    After the connection on a listening socket I have a connection object $c. With $c->get_request I have an HTTP::Request object $r.
    HTTP::Response object is $ref = $self->response ($self is listening socket)

    Then look for the requested wsdl document name:
    $r->uri =~ /\/(\w+)\?wsdl$/i<br. Name of wsdl document is in $1.

    Then set content-type of response to text/xml:
    $ref->header('Content-Type' => 'text/xml')
    Get wsdl document into a variable $content and encode in bytes.
    Set content of response: $ref->content($content)

    And send back to the client:
    $c->send_response($ref)