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

Stumbled...

Expand Messages
  • Bas A. Schulte
    Hi, I m trying to expose a little object model using SOAP. The code for the classes is physically located in /home/bas/model. I m using Apache::SOAP
    Message 1 of 2 , Apr 5, 2001
      Hi,

      I'm trying to expose a little object model using SOAP.

      The code for the classes is physically located in /home/bas/model.

      I'm using Apache::SOAP (Apache/mod_perl).

      In the 'model' directory, I want to call 'instance' from a module called
      Engine, then call 'getServer' on the returned object. 'getServer' returns an
      object of class Engine::ObjectServer. This all works fine.

      Then I want to call 'getSomeObject' on the Engine::ObjectServer object,
      which instantiates an object of class Model::SomeObject.

      The client code looks like this:

      use SOAP::Lite +autodispatch =>
      uri => 'http://www.soaplite.com/',
      proxy => 'http://blaah.nl:8080/soap';

      my $engine = Engine->instance();

      my $os = $engine->getServer();

      # $os's isa is Engine::Server

      # my $object = $os->getSomeObject(); <---- FAILS, $object is UNDEF

      My httpd.conf looks like this:

      <Location /soap>
      PerlSetVar dispatch_to "/home/bas/model, Engine, Engine::instance,
      Engine::getServer"
      PerlAddVar dispatch_to "/home/bas/model, Engine::Server,
      Engine::Server::getSomeObject"

      SetHandler perl-script
      PerlHandler Apache::SOAP
      </Location>

      I suspect Apache::SOAP does not know how to find classes in the 'Model'
      subdirectory; the 'dispatch_to' variable is probably wrong.

      How do I tell Apache::SOAP to use everything in my /home/bas/model
      directory? That means both the classes in the Engine subdirectory as well as
      the classes in the Model subdirectory?

      I've tried this as well: PerlSetVar dispatch_to "/home/bas/model".

      Sure hope someone sets my straight on this one!

      Bas.
    • Paul Kulchenko
      Hi, Bas! Actually you did almost everything right. I m not sure about PerlAddVar and rather do: PerlSetVar dispatch_to /home/bas/model,
      Message 2 of 2 , Apr 9, 2001
        Hi, Bas!

        Actually you did almost everything right. I'm not sure about
        PerlAddVar and rather do:

        <Location /soap>
        PerlSetVar dispatch_to "/home/bas/model, Engine, Engine::Server,
        Engine::ObjectServer
        SetHandler perl-script
        PerlHandler Apache::SOAP
        </Location>

        Basically, you need to specify classes you want to give access to and
        specify CLASS::method ONLY if you want to limit access to THIS
        particular method only (and close access to all other methods in this
        class). In configuration above you gave access to three classes and
        directory (they may be in this directory and may be not).

        This configuration should solve your problem. Also, you may see
        request/response information if you add debug:

        use SOAP::Lite +autodispatch =>
        uri => 'http://www.soaplite.com/',
        proxy => 'http://blaah.nl:8080/soap',
        on_debug => sub{print@_},
        ;

        In addition to that you may specify on_fault handler for faulted
        calls and next version will give you access to fault information for
        autodispatched call also. Hope it helps and let me know if you have
        any other questions. If it still doesn't work for any reason, send me
        request/response information (generated with on_debug).

        Best wishes, Paul.

        --- "Bas A. Schulte" <b.schulte@...> wrote:
        > Hi,
        >
        > I'm trying to expose a little object model using SOAP.
        >
        > The code for the classes is physically located in /home/bas/model.
        >
        > I'm using Apache::SOAP (Apache/mod_perl).
        >
        > In the 'model' directory, I want to call 'instance' from a module
        > called
        > Engine, then call 'getServer' on the returned object. 'getServer'
        > returns an
        > object of class Engine::ObjectServer. This all works fine.
        >
        > Then I want to call 'getSomeObject' on the Engine::ObjectServer
        > object,
        > which instantiates an object of class Model::SomeObject.
        >
        > The client code looks like this:
        >
        > use SOAP::Lite +autodispatch =>
        > uri => 'http://www.soaplite.com/',
        > proxy => 'http://blaah.nl:8080/soap';
        >
        > my $engine = Engine->instance();
        >
        > my $os = $engine->getServer();
        >
        > # $os's isa is Engine::Server
        >
        > # my $object = $os->getSomeObject(); <---- FAILS, $object is
        > UNDEF
        >
        > My httpd.conf looks like this:
        >
        > <Location /soap>
        > PerlSetVar dispatch_to "/home/bas/model, Engine,
        > Engine::instance,
        > Engine::getServer"
        > PerlAddVar dispatch_to "/home/bas/model, Engine::Server,
        > Engine::Server::getSomeObject"
        >
        > SetHandler perl-script
        > PerlHandler Apache::SOAP
        > </Location>
        >
        > I suspect Apache::SOAP does not know how to find classes in the
        > 'Model'
        > subdirectory; the 'dispatch_to' variable is probably wrong.
        >
        > How do I tell Apache::SOAP to use everything in my /home/bas/model
        > directory? That means both the classes in the Engine subdirectory
        > as well as
        > the classes in the Model subdirectory?
        >
        > I've tried this as well: PerlSetVar dispatch_to "/home/bas/model".
        >
        > Sure hope someone sets my straight on this one!
        >
        > Bas.
        >
        >
        > ------------------------ Yahoo! Groups Sponsor
        >
        > To unsubscribe from this group, send an email to:
        > soaplite-unsubscribe@yahoogroups.com
        >
        >
        >
        > Your use of Yahoo! Groups is subject to
        > http://docs.yahoo.com/info/terms/
        >
        >


        __________________________________________________
        Do You Yahoo!?
        Get email at your own domain with Yahoo! Mail.
        http://personal.mail.yahoo.com/
      Your message has been successfully submitted and would be delivered to recipients shortly.