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

5523Re: [soaplite] Newbie question on 'soapifying' existing modules

Expand Messages
  • Jay A. Kreibich
    Aug 3, 2006
      On Thu, Aug 03, 2006 at 06:11:15AM -0000, Chris Kacoroski scratched on the wall:
      > Hi,
      > I have it installed and the examples work great. I have a high level
      > module that uses Net::LDAP for account management that I want to turn
      > into a soap service. My simple soap server is:
      > #!/usr/bin/perl -w
      > use lib '/usr/local/lib'; # where I have the LDAPSOAP module
      > use SOAP::Transport::HTTP;
      > # the following are called from LDAPSOAP, why do I get an error
      > # unless then are here
      > use Net::LDAP;
      > use Net::LDAPS;
      > use Net::LDAP::Util qw(ldap_error_name);
      > SOAP::Transport::HTTP::CGI
      > -> dispatch_to('/usr/local/lib')
      > -> handle;
      > ------------------------------------------
      > The simple client is:
      > #!/usr/bin/perl -w
      > use SOAP::Lite;
      > $s = SOAP::Lite
      > -> uri('http://localhost/LDAPSOAP')
      > -> proxy('http://localhost/cgi-bin/ldap.cgi');
      > $r = $s->school2Server('fw');
      > $server = $r->result();
      > print "$server\n";
      > ---------------------------------------
      > The error I get is:
      > p $r->faultstring
      > Denied access to method (school2Server) in class (LDAPSOAP) at
      > /usr/local/share/perl/5.8.7/SOAP/Lite.pm line 2499, <DATA> line 225.

      > Questions:
      > 1. Why do I need the Net::XXXX calls in the soap server?

      When using "dispatch_to( <path> )" the @INC path is cleared for
      security/sandboxing reasons. This means the "use Net::..." calls
      inside your module will fail. The solution is to "use" them in the
      SOAP server itself. When the system loads your module through the
      "dispatch_to( <path> )" the "use" statements will be ignored because
      the modules will already be in memory.

      See the "Service dispatch" section here: http://guide.soaplite.com/
      for more information (especially the "Mixed" sub-section).

      Also, you don't need the "use lib '/usr/local/lib';" line in the

      > 2. Why am I getting method access denied.

      Not exactly sure, but for some reason the system is convinced this
      isn't a valid reference to something inside your dispatch path.
      I assume the LDAPSOAP package is defined inside
      /usr/local/lib/LDAPSOAP.pm ?

      > 3. I was not able to get the server to work with modules that were
      > linked into /usr/local/lib. I had to copy them this. Is this
      > expected behavior.

      I'm not sure what you mean by "linked". If you mean the modules were
      sym-linked in at a file system level into that directory, I'm
      surprised that's an issue. If you mean "linked" in the compile sense,
      and that there are modules (not in /usr/local/lib) "use"'d by stuff
      that is in /usr/local/lib, then the issue is the same one that was
      pointed out in the answer to your first question. You can either
      "use" *all* of these modules in your SOAP server, or you need to come
      up with a different dispatch system.


      Jay A. Kreibich | CommTech, Emrg Net Tech Svcs
      jak@... | Campus IT & Edu Svcs
      <http://www.uiuc.edu/~jak> | University of Illinois at U/C
    • Show all 3 messages in this topic