You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@xml.apache.org by Vuko Brigljevic <vu...@cern.ch> on 2003/01/17 17:42:38 UTC

SOAP classpath

Hello,

Just trying my first steps in SOAP land... I am
using it with tomcat 4.1.12.

Two probably related questions about the classpath
of SOAP applications:

1) I am deploying a SOAP method from some directory ~/XX/ :

~/XX >  java org.apache.soap.server.ServiceManagerClient \   
    http://localhost:8080/soap/servlet/rpcrouter deploy deploy.xml

  It exposes the method HelloSoapServer.getMessage(...).
  The source code HelloSoapServer.java is in that directory.

  Where does tomcat get the byte code from when it responds
  to a SOAP message for that method? I don't see the byte
  code for the HelloSoapServer class anywhere in the tomcat
  directory tree? Actually, I don't even need to have the 
  class compiled anywhere and it still works.

2) In the class whose method I want to expose to SOAP,
   I want to use a reference to a class located in a 
   different tomcat webapp directory. How do I set up
   things so SOAP finds that class, i.e how do I set up
   the classpath SOAP is using to find this class
   (located, say, in 
  $CATALINA_HOME/webapps/<myotherapp/WEB-INF/classes/)

Thanks,

Vuko
   

===========================================================|
 Vuko Brigljevic,    EP Research Fellow                    |
 CERN - European Laboratory for Particle Physics           |
===========================================================|

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: SOAP classpath

Posted by Scott Nichol <sn...@scottnichol.com>.
See my comments below.

On 21 Jan 2003 at 12:18, Vuko Brigljevic wrote:

> Hi Scott,
> 
> Thanks for your help!
> 
> Scott Nichol wrote:
> 
> > 1) Clearly, for any service method that is executed, the byte code
> > must be loadable, which means it must be somewhere that a Tomcat
> > class loader can access it.  If the code cannot be found, Apache SOAP
> > would return a SOAP Fault to the client.
> 
> O.K, that seems obvious; agreed.
> 
> > Almost always, the classes implementing services should be in the
> > Apache SOAP webapp.  Depending on what dependencies the service
> > classes have, they may also work from $CATALINA_HOME/lib or
> > $CATALINA_HOME/classes.
> 
> so you mean the class implementing a SOAP service has in
> principle to be in the directory $CATALINA_HOME/webapps/soap
> (or $CATALINA_HOME/{lib|classes}).
> Do I understand this right?

Yes.

> I was able to get it working differently for a simple testing
> purpose: the byte code of the class implementing a SOAP service
> was in the ~/soap-example directory, and I added by hand that
> directory to the tomcat classpath in the script 
> $CATALINA_HOME/bin/catalina.sh

You would find that the Tomcat docs discourage you from doing this.  
With your custom code, you can get away with this if the code does 
not have dependencies on other classes used by Tomcat (such as XML 
parser).

> I guess that's not really the way you're supposed to be doing
> it, so my question:
> 
> - I have a full web applications, let's call it <mywebapp>
>   with its WEB-INF/ directory and classes/ and lib/ subdirectories,
>   a deployment descriptor web.xml. It contains as well servlet
>   as other Java classes.
> - I want to expose some methods of some of these classes (in principle
>   not servlet classes) as SOAP services, and I have written the
>   deployment descriptor for these.
> - What is the correct way to deploy <mywebapp>? Put it in the
>   $CATALINA_HOME/webapp/soap/ subdirectory? And so merge my 
>   web.xml file with the soap/WEB-INF/web.xml file? I would 
>   honestly prefer to have <mywebapp> in a subdirectory on 
>   its own. In that case I wouldn't have to care about the stuff
>   not regarding <mywebapp> in web.xml for example.

You have <mywebapp> and also a webapp for Apache SOAP, and you want 
some classes used by <mywebapp> to also be available as services 
under Apache SOAP.  One alternative is to have duplicate copies of 
the classes in each webapp.  That may be a configuration management 
nightmare.  Another alternative is to put the "shared" classes in 
$CATALINA_HOME/[lib|classes].  The remainder of your <mywebapp> 
classes go in the <mywebapp> directory tree.

> - I actually tried to have it in a directory on its own and added
>   a special context for that $CATALINA_HOME/conf/server.xml:
> 
> 	<Context path="/quotation"
>                  docBase="/home/vuko/soap/soapuser-1.0/web"
>                  crossContext="true"
>                  debug="0"
>                  reloadable="true"
>                  trusted="false">
>         </Context>
>   (I am actually trying to run the example found at:
>    http://www.soapuser.com/server4.html  but without
>    IDE: I am compiling and moving files "by hand" and 
>    that's where I am failing)
> 
>   but that seems not to work: when I try to make a client 
>   call to the service, tomcat does find the service but 
>   cannot resolve a class located in the same package (and
>   directory) as the service:
> 
> Generated fault:
>   Fault Code   = SOAP-ENV:Client
>   Fault String = Deployment error in SOAP service
> 'urn:QuotationService': class name
> 'com.soapuser.soap.server.quotation.Quotation' could not be resolved:
> com.soapuser.soap.server.quotation.Quotation
> 
>   What am I doing wrong, how am I supposed to do it? Let me
>   know if you need further details to understand what I am 
>   trying to do.

I do not know exactly what is going wrong here, possibly because I do 
not have experience with crossContext="true".

> 
>   Vuko
> 
> -- 
> ===========================================================|
>  Vuko Brigljevic,    EP Research Fellow                    |
>  CERN - European Laboratory for Particle Physics           |
>  --------------------------------------------------------- |
>  Mail Address: CERN, Div. EP, 1211 Geneve 23 (Switzerland) |
>  Office      : B40-2B08                                    |
>  Phone       : +41-22-767 1662                             |
>  e-mail      : Vuko.Brigljevic@cern.ch                     |
>  www         : http://www.slac.stanford.edu/~vuko          |
> ===========================================================|
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 
> 


Scott Nichol


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: SOAP classpath

Posted by Scott Nichol <sn...@scottnichol.com>.
See my comments below.

On 21 Jan 2003 at 12:18, Vuko Brigljevic wrote:

> Hi Scott,
> 
> Thanks for your help!
> 
> Scott Nichol wrote:
> 
> > 1) Clearly, for any service method that is executed, the byte code
> > must be loadable, which means it must be somewhere that a Tomcat
> > class loader can access it.  If the code cannot be found, Apache SOAP
> > would return a SOAP Fault to the client.
> 
> O.K, that seems obvious; agreed.
> 
> > Almost always, the classes implementing services should be in the
> > Apache SOAP webapp.  Depending on what dependencies the service
> > classes have, they may also work from $CATALINA_HOME/lib or
> > $CATALINA_HOME/classes.
> 
> so you mean the class implementing a SOAP service has in
> principle to be in the directory $CATALINA_HOME/webapps/soap
> (or $CATALINA_HOME/{lib|classes}).
> Do I understand this right?

Yes.

> I was able to get it working differently for a simple testing
> purpose: the byte code of the class implementing a SOAP service
> was in the ~/soap-example directory, and I added by hand that
> directory to the tomcat classpath in the script 
> $CATALINA_HOME/bin/catalina.sh

You would find that the Tomcat docs discourage you from doing this.  
With your custom code, you can get away with this if the code does 
not have dependencies on other classes used by Tomcat (such as XML 
parser).

> I guess that's not really the way you're supposed to be doing
> it, so my question:
> 
> - I have a full web applications, let's call it <mywebapp>
>   with its WEB-INF/ directory and classes/ and lib/ subdirectories,
>   a deployment descriptor web.xml. It contains as well servlet
>   as other Java classes.
> - I want to expose some methods of some of these classes (in principle
>   not servlet classes) as SOAP services, and I have written the
>   deployment descriptor for these.
> - What is the correct way to deploy <mywebapp>? Put it in the
>   $CATALINA_HOME/webapp/soap/ subdirectory? And so merge my 
>   web.xml file with the soap/WEB-INF/web.xml file? I would 
>   honestly prefer to have <mywebapp> in a subdirectory on 
>   its own. In that case I wouldn't have to care about the stuff
>   not regarding <mywebapp> in web.xml for example.

You have <mywebapp> and also a webapp for Apache SOAP, and you want 
some classes used by <mywebapp> to also be available as services 
under Apache SOAP.  One alternative is to have duplicate copies of 
the classes in each webapp.  That may be a configuration management 
nightmare.  Another alternative is to put the "shared" classes in 
$CATALINA_HOME/[lib|classes].  The remainder of your <mywebapp> 
classes go in the <mywebapp> directory tree.

> - I actually tried to have it in a directory on its own and added
>   a special context for that $CATALINA_HOME/conf/server.xml:
> 
> 	<Context path="/quotation"
>                  docBase="/home/vuko/soap/soapuser-1.0/web"
>                  crossContext="true"
>                  debug="0"
>                  reloadable="true"
>                  trusted="false">
>         </Context>
>   (I am actually trying to run the example found at:
>    http://www.soapuser.com/server4.html  but without
>    IDE: I am compiling and moving files "by hand" and 
>    that's where I am failing)
> 
>   but that seems not to work: when I try to make a client 
>   call to the service, tomcat does find the service but 
>   cannot resolve a class located in the same package (and
>   directory) as the service:
> 
> Generated fault:
>   Fault Code   = SOAP-ENV:Client
>   Fault String = Deployment error in SOAP service
> 'urn:QuotationService': class name
> 'com.soapuser.soap.server.quotation.Quotation' could not be resolved:
> com.soapuser.soap.server.quotation.Quotation
> 
>   What am I doing wrong, how am I supposed to do it? Let me
>   know if you need further details to understand what I am 
>   trying to do.

I do not know exactly what is going wrong here, possibly because I do 
not have experience with crossContext="true".

> 
>   Vuko
> 
> -- 
> ===========================================================|
>  Vuko Brigljevic,    EP Research Fellow                    |
>  CERN - European Laboratory for Particle Physics           |
>  --------------------------------------------------------- |
>  Mail Address: CERN, Div. EP, 1211 Geneve 23 (Switzerland) |
>  Office      : B40-2B08                                    |
>  Phone       : +41-22-767 1662                             |
>  e-mail      : Vuko.Brigljevic@cern.ch                     |
>  www         : http://www.slac.stanford.edu/~vuko          |
> ===========================================================|
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 
> 


Scott Nichol


Re: SOAP classpath

Posted by Vuko Brigljevic <vu...@cern.ch>.
Hi Scott,

Thanks for your help!

Scott Nichol wrote:

> 1) Clearly, for any service method that is executed, the byte code
> must be loadable, which means it must be somewhere that a Tomcat
> class loader can access it.  If the code cannot be found, Apache SOAP
> would return a SOAP Fault to the client.

O.K, that seems obvious; agreed.

> Almost always, the classes implementing services should be in the
> Apache SOAP webapp.  Depending on what dependencies the service
> classes have, they may also work from $CATALINA_HOME/lib or
> $CATALINA_HOME/classes.

so you mean the class implementing a SOAP service has in
principle to be in the directory $CATALINA_HOME/webapps/soap
(or $CATALINA_HOME/{lib|classes}).
Do I understand this right?

I was able to get it working differently for a simple testing
purpose: the byte code of the class implementing a SOAP service
was in the ~/soap-example directory, and I added by hand that
directory to the tomcat classpath in the script 
$CATALINA_HOME/bin/catalina.sh
I guess that's not really the way you're supposed to be doing
it, so my question:

- I have a full web applications, let's call it <mywebapp>
  with its WEB-INF/ directory and classes/ and lib/ subdirectories,
  a deployment descriptor web.xml. It contains as well servlet
  as other Java classes.
- I want to expose some methods of some of these classes (in principle
  not servlet classes) as SOAP services, and I have written the
  deployment descriptor for these.
- What is the correct way to deploy <mywebapp>? Put it in the
  $CATALINA_HOME/webapp/soap/ subdirectory? And so merge my 
  web.xml file with the soap/WEB-INF/web.xml file? I would 
  honestly prefer to have <mywebapp> in a subdirectory on 
  its own. In that case I wouldn't have to care about the stuff
  not regarding <mywebapp> in web.xml for example.
- I actually tried to have it in a directory on its own and added
  a special context for that $CATALINA_HOME/conf/server.xml:

	<Context path="/quotation"
                 docBase="/home/vuko/soap/soapuser-1.0/web"
                 crossContext="true"
                 debug="0"
                 reloadable="true"
                 trusted="false">
        </Context>
  (I am actually trying to run the example found at:
   http://www.soapuser.com/server4.html  but without
   IDE: I am compiling and moving files "by hand" and 
   that's where I am failing)

  but that seems not to work: when I try to make a client 
  call to the service, tomcat does find the service but 
  cannot resolve a class located in the same package (and
  directory) as the service:

Generated fault:
  Fault Code   = SOAP-ENV:Client
  Fault String = Deployment error in SOAP service
'urn:QuotationService': class name
'com.soapuser.soap.server.quotation.Quotation' could not be resolved:
com.soapuser.soap.server.quotation.Quotation

  What am I doing wrong, how am I supposed to do it? Let me
  know if you need further details to understand what I am 
  trying to do.

  Vuko

-- 
===========================================================|
 Vuko Brigljevic,    EP Research Fellow                    |
 CERN - European Laboratory for Particle Physics           |
 --------------------------------------------------------- |
 Mail Address: CERN, Div. EP, 1211 Geneve 23 (Switzerland) |
 Office      : B40-2B08                                    |
 Phone       : +41-22-767 1662                             |
 e-mail      : Vuko.Brigljevic@cern.ch                     |
 www         : http://www.slac.stanford.edu/~vuko          |
===========================================================|

Re: SOAP classpath

Posted by Vuko Brigljevic <vu...@cern.ch>.
Hi Scott,

Thanks for your help!

Scott Nichol wrote:

> 1) Clearly, for any service method that is executed, the byte code
> must be loadable, which means it must be somewhere that a Tomcat
> class loader can access it.  If the code cannot be found, Apache SOAP
> would return a SOAP Fault to the client.

O.K, that seems obvious; agreed.

> Almost always, the classes implementing services should be in the
> Apache SOAP webapp.  Depending on what dependencies the service
> classes have, they may also work from $CATALINA_HOME/lib or
> $CATALINA_HOME/classes.

so you mean the class implementing a SOAP service has in
principle to be in the directory $CATALINA_HOME/webapps/soap
(or $CATALINA_HOME/{lib|classes}).
Do I understand this right?

I was able to get it working differently for a simple testing
purpose: the byte code of the class implementing a SOAP service
was in the ~/soap-example directory, and I added by hand that
directory to the tomcat classpath in the script 
$CATALINA_HOME/bin/catalina.sh
I guess that's not really the way you're supposed to be doing
it, so my question:

- I have a full web applications, let's call it <mywebapp>
  with its WEB-INF/ directory and classes/ and lib/ subdirectories,
  a deployment descriptor web.xml. It contains as well servlet
  as other Java classes.
- I want to expose some methods of some of these classes (in principle
  not servlet classes) as SOAP services, and I have written the
  deployment descriptor for these.
- What is the correct way to deploy <mywebapp>? Put it in the
  $CATALINA_HOME/webapp/soap/ subdirectory? And so merge my 
  web.xml file with the soap/WEB-INF/web.xml file? I would 
  honestly prefer to have <mywebapp> in a subdirectory on 
  its own. In that case I wouldn't have to care about the stuff
  not regarding <mywebapp> in web.xml for example.
- I actually tried to have it in a directory on its own and added
  a special context for that $CATALINA_HOME/conf/server.xml:

	<Context path="/quotation"
                 docBase="/home/vuko/soap/soapuser-1.0/web"
                 crossContext="true"
                 debug="0"
                 reloadable="true"
                 trusted="false">
        </Context>
  (I am actually trying to run the example found at:
   http://www.soapuser.com/server4.html  but without
   IDE: I am compiling and moving files "by hand" and 
   that's where I am failing)

  but that seems not to work: when I try to make a client 
  call to the service, tomcat does find the service but 
  cannot resolve a class located in the same package (and
  directory) as the service:

Generated fault:
  Fault Code   = SOAP-ENV:Client
  Fault String = Deployment error in SOAP service
'urn:QuotationService': class name
'com.soapuser.soap.server.quotation.Quotation' could not be resolved:
com.soapuser.soap.server.quotation.Quotation

  What am I doing wrong, how am I supposed to do it? Let me
  know if you need further details to understand what I am 
  trying to do.

  Vuko

-- 
===========================================================|
 Vuko Brigljevic,    EP Research Fellow                    |
 CERN - European Laboratory for Particle Physics           |
 --------------------------------------------------------- |
 Mail Address: CERN, Div. EP, 1211 Geneve 23 (Switzerland) |
 Office      : B40-2B08                                    |
 Phone       : +41-22-767 1662                             |
 e-mail      : Vuko.Brigljevic@cern.ch                     |
 www         : http://www.slac.stanford.edu/~vuko          |
===========================================================|

--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: SOAP classpath

Posted by Scott Nichol <sn...@scottnichol.com>.
1) Clearly, for any service method that is executed, the byte code 
must be loadable, which means it must be somewhere that a Tomcat 
class loader can access it.  If the code cannot be found, Apache SOAP 
would return a SOAP Fault to the client.

Almost always, the classes implementing services should be in the 
Apache SOAP webapp.  Depending on what dependencies the service 
classes have, they may also work from $CATALINA_HOME/lib or 
$CATALINA_HOME/classes.

2) Your Apache SOAP webapp can access classes in another webapp only 
through the sleeziest hack which may leave Tomcat unstable.  In 
particular, the webapps classes directory and/or jars from lib would 
need to be in the Tomcat system class loader path set in catalina.sh 
or catalina.bat.

If you have classes that must be shared between webapps and have no 
dependencies on the other classes in either webapp, you can put the 
classes in $CATALINA_HOME/lib or $CATALINA_HOME/classes.  Normally, I 
would recommend you simply have separate copies of the classes in 
each webapp.

For details on Tomcat's class loaders, see 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-
howto.html.

On 17 Jan 2003 at 17:42, Vuko Brigljevic wrote:

> Hello,
> 
> Just trying my first steps in SOAP land... I am
> using it with tomcat 4.1.12.
> 
> Two probably related questions about the classpath
> of SOAP applications:
> 
> 1) I am deploying a SOAP method from some directory ~/XX/ :
> 
> ~/XX >  java org.apache.soap.server.ServiceManagerClient \   
>     http://localhost:8080/soap/servlet/rpcrouter deploy deploy.xml
> 
>   It exposes the method HelloSoapServer.getMessage(...).
>   The source code HelloSoapServer.java is in that directory.
> 
>   Where does tomcat get the byte code from when it responds
>   to a SOAP message for that method? I don't see the byte
>   code for the HelloSoapServer class anywhere in the tomcat
>   directory tree? Actually, I don't even need to have the 
>   class compiled anywhere and it still works.
> 
> 2) In the class whose method I want to expose to SOAP,
>    I want to use a reference to a class located in a 
>    different tomcat webapp directory. How do I set up
>    things so SOAP finds that class, i.e how do I set up
>    the classpath SOAP is using to find this class
>    (located, say, in 
>   $CATALINA_HOME/webapps/<myotherapp/WEB-INF/classes/)
> 
> Thanks,
> 
> Vuko
>    
> 
> ===========================================================|
>  Vuko Brigljevic,    EP Research Fellow                    |
>  CERN - European Laboratory for Particle Physics           |
> ===========================================================|
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 
> 


Scott Nichol


--
To unsubscribe, e-mail:   <ma...@xml.apache.org>
For additional commands, e-mail: <ma...@xml.apache.org>


Re: SOAP classpath

Posted by Scott Nichol <sn...@scottnichol.com>.
1) Clearly, for any service method that is executed, the byte code 
must be loadable, which means it must be somewhere that a Tomcat 
class loader can access it.  If the code cannot be found, Apache SOAP 
would return a SOAP Fault to the client.

Almost always, the classes implementing services should be in the 
Apache SOAP webapp.  Depending on what dependencies the service 
classes have, they may also work from $CATALINA_HOME/lib or 
$CATALINA_HOME/classes.

2) Your Apache SOAP webapp can access classes in another webapp only 
through the sleeziest hack which may leave Tomcat unstable.  In 
particular, the webapps classes directory and/or jars from lib would 
need to be in the Tomcat system class loader path set in catalina.sh 
or catalina.bat.

If you have classes that must be shared between webapps and have no 
dependencies on the other classes in either webapp, you can put the 
classes in $CATALINA_HOME/lib or $CATALINA_HOME/classes.  Normally, I 
would recommend you simply have separate copies of the classes in 
each webapp.

For details on Tomcat's class loaders, see 
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-
howto.html.

On 17 Jan 2003 at 17:42, Vuko Brigljevic wrote:

> Hello,
> 
> Just trying my first steps in SOAP land... I am
> using it with tomcat 4.1.12.
> 
> Two probably related questions about the classpath
> of SOAP applications:
> 
> 1) I am deploying a SOAP method from some directory ~/XX/ :
> 
> ~/XX >  java org.apache.soap.server.ServiceManagerClient \   
>     http://localhost:8080/soap/servlet/rpcrouter deploy deploy.xml
> 
>   It exposes the method HelloSoapServer.getMessage(...).
>   The source code HelloSoapServer.java is in that directory.
> 
>   Where does tomcat get the byte code from when it responds
>   to a SOAP message for that method? I don't see the byte
>   code for the HelloSoapServer class anywhere in the tomcat
>   directory tree? Actually, I don't even need to have the 
>   class compiled anywhere and it still works.
> 
> 2) In the class whose method I want to expose to SOAP,
>    I want to use a reference to a class located in a 
>    different tomcat webapp directory. How do I set up
>    things so SOAP finds that class, i.e how do I set up
>    the classpath SOAP is using to find this class
>    (located, say, in 
>   $CATALINA_HOME/webapps/<myotherapp/WEB-INF/classes/)
> 
> Thanks,
> 
> Vuko
>    
> 
> ===========================================================|
>  Vuko Brigljevic,    EP Research Fellow                    |
>  CERN - European Laboratory for Particle Physics           |
> ===========================================================|
> 
> --
> To unsubscribe, e-mail:   <ma...@xml.apache.org>
> For additional commands, e-mail: <ma...@xml.apache.org>
> 
> 


Scott Nichol