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

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

Expand Messages
  • Ski Kacoroski
    Jay, Thanks for your reply. ... Ok, This makes sense. ... Yes. So now I have changed the server to be: #!/usr/bin/perl -w use SOAP::Transport::HTTP; use
    Message 1 of 3 , Aug 3, 2006

      Thanks for your reply.
      >> 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
      > server.

      Ok, This makes sense.

      >> 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 ?

      Yes. So now I have changed the server to be:

      #!/usr/bin/perl -w

      use SOAP::Transport::HTTP;
      use Net::LDAP;
      use Net::LDAPS;
      use Net::LDAP::Util qw(ldap_error_name);

      -> dispatch_to('/usr/local/lib')
      -> handle;

      /usr/local/lib/LDAPSOAP is:

      package LDAPSOAP;

      use strict;
      use vars qw($VERSION);
      require Exporter;
      our @ISA = qw(Exporter);
      our @EXPORT = qw(school2Server);
      use Net::LDAP;
      use Net::LDAPS;
      use Net::LDAP::Util qw(ldap_error_name);

      our $VERSION = 0.5;

      # evaluate the perl code from the config filei
      our %nsdconf;
      do "/tmp/nsdconf.pl" or die
      "ERROR: could not read nsd config file $!\n";

      # Function to return the server given a school code
      sub school2Server {
      my ($school_code) = @_;
      return ($nsdconf{site_server}{$school_code});

      The problem I am having is that it is not reading in the nsdconf.pl file
      which is where $nsdconf{site_server} is defined. Other than that it
      works. Is there a best practice on how to handle a configuration file
      for a module with Soap.

      >> 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.

      I meant softlinks in the file system. If I replace the softlinks with
      the file it works. I think it may be because the softlink points into a
      directory that the apache web server does not have access to (even
      though the file is 644).

      Thanks for your help.


      "When we try to pick out anything by itself, we find it
      connected to the entire universe" John Muir

      Chris "Ski" Kacoroski, kacoroski@..., 206-501-9803
    Your message has been successfully submitted and would be delivered to recipients shortly.