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

SOAP Server mixed with standard CGI

Expand Messages
  • Trevor Phillips
    I have an application which is an existing standard CGI app, but I wish to also support SOAP requests for the same application. The submitted headers and POST
    Message 1 of 4 , Feb 8, 2010
    • 0 Attachment
      I have an application which is an existing standard CGI app, but I wish to
      also support SOAP requests for the same application.

      The submitted headers and POST content are already handled by CGI
      (technically CGI::Fast), but all of the SOAP Server examples seem to assume
      nothing has read the POST data yet.

      Is there any easy way to dispatch, passing in headers & envelope data manually?

      Here's snippets of what I have (assuming $CGI is the CGI object):

      {
      my $sSOAP = $CGI->http('HTTP_SOAPACTION');

      if ($CGI->request_method eq 'POST' && $CGI->content_type =~ /text\/xml;/
      && $sSOAP)
      {
      $sEnvelope = $CGI->param('POSTDATA');
      ... SOAP Handling Code ...
      }
      else
      {
      ... CGI-style handlers ...
      }
      }

      BEGIN
      {
      package MySoapMethods;

      use vars qw(@ISA);
      @ISA = qw(Exporter SOAP::Server::Parameters);

      use SOAP::Lite;

      sub myMethod
      {
      etc...
      }
      }

      For the "SOAP Handling Code", I have tried:
      SOAP::Transport::HTTP::CGI->dispatch_to('SOAPCallback')->handle;
      ...but this fails as the headers & post data have already been processed by CGI.

      --
      Trevor Phillips - T.Phillips@...
      Senior Web Analyst Programmer - IT Services, Murdoch University
      "On nights such as this, evil deeds are done. And good deeds, of course.
      But mostly evil, on the whole." -- (Terry Pratchett, Wyrd Sisters)
    • Dave Howorth
      ... Just use a different URL for the SOAP requests, then your problem goes away. Cheers, Dave
      Message 2 of 4 , Feb 8, 2010
      • 0 Attachment
        Trevor Phillips wrote:
        > I have an application which is an existing standard CGI app, but I wish to
        > also support SOAP requests for the same application.
        >
        > The submitted headers and POST content are already handled by CGI
        > (technically CGI::Fast), but all of the SOAP Server examples seem to assume
        > nothing has read the POST data yet.

        Just use a different URL for the SOAP requests, then your problem goes away.

        Cheers, Dave
      • Chris Woodfield
        I ll add that different URL can mean simply adding something like ? querytype=soap11 to the end of it... -Chris On Feb 8, 2010, at 11:03, Dave Howorth
        Message 3 of 4 , Feb 8, 2010
        • 0 Attachment
          I'll add that "different URL" can mean simply adding something like "?querytype=soap11" to the end of it...

          -Chris



          On Feb 8, 2010, at 11:03, Dave Howorth <dhoworth@...> wrote:

           

          Trevor Phillips wrote:
          > I have an application which is an existing standard CGI app, but I wish to
          > also support SOAP requests for the same application.
          >
          > The submitted headers and POST content are already handled by CGI
          > (technically CGI::Fast), but all of the SOAP Server examples seem to assume
          > nothing has read the POST data yet.

          Just use a different URL for the SOAP requests, then your problem goes away.

          Cheers, Dave

        • Dave Howorth
          ... It can but that opens a philosophically-RESTless can of worms :) Plus it s shorter to just say: http://www.domain.com/my/url/soap or even
          Message 4 of 4 , Feb 8, 2010
          • 0 Attachment
            Chris Woodfield wrote:
            >
            >
            > I'll add that "different URL" can mean simply adding something like
            > "?querytype=soap11" to the end of it...

            It can but that opens a philosophically-RESTless can of worms :) Plus
            it's shorter to just say:

            http://www.domain.com/my/url/soap

            or even

            http://soap.domain.com/my/url

            Cheers, Dave

            > -Chris
            >
            >
            >
            > On Feb 8, 2010, at 11:03, Dave Howorth <dhoworth@...
            > <mailto:dhoworth@...>> wrote:
            >
            >>
            >>
            >> Trevor Phillips wrote:
            >> > I have an application which is an existing standard CGI app, but I
            >> wish to
            >> > also support SOAP requests for the same application.
            >> >
            >> > The submitted headers and POST content are already handled by CGI
            >> > (technically CGI::Fast), but all of the SOAP Server examples seem to
            >> assume
            >> > nothing has read the POST data yet.
            >>
            >> Just use a different URL for the SOAP requests, then your problem goes
            >> away.
            >>
            >> Cheers, Dave
          Your message has been successfully submitted and would be delivered to recipients shortly.