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

Re: [soaplite] Document Literal Support

Expand Messages
  • Graham Irvine
    ... using the default methods unaltered with generate RPC encoded envelopes. However this is Perl so you can manipulate those pretty easily to get it to do
    Message 1 of 4 , Oct 15, 2007
    • 0 Attachment
      bolasnenhumda wrote:
      > Hi all,
      >
      > I've started to use SOAP::Lite, and I have a bunch of questions:
      >
      > 1 - The default style used by SOAP::Lite is RPC encoded. Is this the
      > only style available? Am I able to use, for example, Document/literal,
      > or document/literal encoded (Ok, this is hard to get knowing the
      > specification for this is not open -_-).
      >

      using the default methods unaltered with generate RPC encoded envelopes.
      However this is Perl so you can manipulate those pretty easily to get it
      to do whatever you want. Everything is available to be changed without
      too much difficulty . Yes you will have to learn SOAP literal styles
      more that just a point a clicker would have to but thats no bad thing.

      Check out the soaplite website (or many previous posts here) for basic
      examples that will get you started. There are basically two or three
      techniques to construct your data that you need to learn then you are
      in business.

      > In case we have only RPC encoded style, is there any way to access
      > .Net web services, for example? What I mean is: is there a way of
      > accessing services which are not available in RPC encoded?
      >

      yes . On the microssoft MSDN site there is help to work with SOAP::Lite.
      However it is a lot easier to get Perl to work with .net than .net to
      work with Perl as .net if very rigid in this as it is in everything.

      > 2 - Does SOAP::Lite generates automatically WSDL for us, based on our
      > available web services? I read that it doesn't, but the post was from
      > 2001 ^_^. If not, do you know any perl module capable of doing it?

      No you need to write or generate the WSDL yourself and get your soap
      server endpoint (ideally) to return it. Again not as "quick" as a wizard
      , but then you learn nothing by doing that and therefore dont understand
      when it goes wrong or needs to go outside the box and be complex.
      WSDL looks scarey but its really not when you simplify it and weed out
      the bloated things that point and click software like to develop.

      Once you have that done .. you just need to expose it to clients to
      discover.

      A simple technique is do this. is before dispatching to the soap
      services put some thing like this in.

      if ($ENV{REQUEST_METHOD} eq "GET") {
      if (lc($ENV{QUERY_STRING} || "") eq "wsdl")
      {
      # user asked for WSDL.
      serve_wsdl();
      }
      else {
      #anything else sent as a CGI GET
      serve_html();
      }
      }

      sub serve_html
      {
      require CGI;
      my $q = CGI->new();
      my $response = "You need to send me a SOAP request!";
      my $c = length($response);
      print $q->header(-type=>'text/plain',
      -'Content-length'=>$c);

      print "$response";
      }

      sub serve_wsdl
      {

      my $wsdlfile = $config{"WSDLFILE"};

      open (WSDL,$wsdlfile);
      read (WSDL,$wsdl,50000,0);
      close(WSDL);

      require CGI;
      my $q = CGI->new();

      my $c = length($wsdl);

      print $q->header(-type=>'text/xml',
      -'Content-length'=>$c);
      print "$wsdl";
      }


      Then if you service proxy is

      http://myserver/webservice/myservice

      You can return the wsdl to users when they request

      http://myserver/webservice/myserver?WSDL

      which sort of mimics what .net servers do I beleive.

      Make your WSDL by other means and store it to a file location which is
      found in above case on path set by $config{"WSDLFILE"}.



      >
      > And that's all (for now :p)
      >
      > Thanks in advance,
      > Mario
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.