You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Maximiliano Barone <mb...@tourch.com.ar> on 2004/02/02 18:27:57 UTC

Re: Server-Side as a Client of other Web Service

Scott:

It worked ok. Thanks a lot.
I use Tomcat and I would like to ask you another thing.

My Service dinamically invokes some other Services (as I told you :-) ),
so I get the URL of each of the Services dinamically (from my Database)
that I am going to call and send them some information.
The question is:

I want to test my application and, Is it possible tu run in the same
machine 2 Tomcats ?
If it is possible I could invoke each of those services just changing the
URL.
For example: I invoked the Listener over SOAP but this service is using
the same URL as my Service:
                    http://localhost:8080/soap/servlet/rpcrouter

Can I deploy another instance of Tomcat at the same time using a
different port number ? 
for example:  http://localhost:8010/soap/servlet/rpcrouter

Where Should I do ? Where Do I set the port number up ?

Thank you very much !!!

Max


 

On Mon, 2 Feb 2004 10:32:22 -0500, "Scott Nichol"
<sn...@scottnichol.com> said:
> How have you deployed Apache SOAP in your J2EE container?  Is it a
> webapp?  It should be.  With Tomcat, for example, you would probably have
> a directory
> 
>     $CATALINA_HOME/webapps/soap
> 
> for the webapp.  All of the Apache SOAP classes would be in
> 
>     $CATALINA_HOME/webapps/soap/WEB-INF/classes
> 
> Your service code should be deployed to that same directory (and its
> sub-directories to match your package declarations).  In your case,
> because you use Apache SOAP classes in your service, this is your only
> deployment option (on Tomcat, at least; I don't think you have ever said
> which container you are using).  For services that do not use Apache SOAP
> classes, another option (although definitely *not* recommended) is to put
> the service classes in $CATALINA_HOME/shared/classes.
> 
> Scott Nichol
> 
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message ----- 
> From: "Maximiliano Barone" <mb...@tourch.com.ar>
> To: <so...@ws.apache.org>
> Sent: Saturday, January 31, 2004 4:30 PM
> Subject: Re: Server-Side as a Client of other Web Service
> 
> 
> Scott:
> 
> Thank you very much for your answers.
> When my service dinamically tries to send the request (invoking) to other
> Web Services, it fails because it doesn´t find none of the following
> classes:
> 
> - Constants
> - Parameter
> - Fault
> - Call
> - Response
> 
> All of these classes belongs to org.apache.soap.rpc.*
> When I compile this in my IDE Java it works well, but when it is running
> in the Apache SOAP Server context (Server Side) it fails.
> I read the article that you told me about the classloaders, but what
> classes should I put in one of those directories ?
> 
> Thanks.
> 
> Max
> 
> 
> On Fri, 30 Jan 2004 11:25:59 -0500, "Scott Nichol"
> <sn...@scottnichol.com> said:
> > > 3) Could you please tell me how I can put the classes in the class loader
> > > of the server ?
> > 
> > Since you are making the Call from code that is running in the context of
> > an Apache SOAP service, the classes *should* be available, and the
> > instantiation of Call should work.
> > 
> > The exact set of classes available through class loaders depends on the
> > J2EE container you are using.  With Tomcat, for example, the class
> > loaders are documented (for version 4.1) at
> > http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html.
> > 
> > For Apache SOAP services deployed in Tomcat, the classes are under the
> > WEB-INF/classes directory for the soap webapp.  If that webapp was
> > deployed the "simplest" way, the full path to the classes is
> > $CATALINA_HOME/webapps/soap/WEB-INF/classes.
> > 
> > > I will explain you this interaction:
> > > 
> > > 1) A client sends some info (over Apache SOAP) to my Service.  (OK)
> > > 2) My Service receives this call and saves the data internally.      (OK)
> > > 3) My Service builds a new DOM Element and sends it to other services. 
> > > (ERROR !)
> > > 
> > > I can't see the ERROR of this third step because the Client (step 1) uses
> > > a servlet to invoke my 
> > > Service and it internally invokes the other services. I know that my code
> > > is not working well because I comment that line of the 
> > > new Call ("Call call = new Call();") and it works (without calling the
> > > services, of course).
> > > How can I see that error ? 
> > 
> > If your service code does nothing to trap an exception, an exception
> > thrown in the instantiation of Call will trace back on the stack into
> > Apache SOAP code (within RPCRouterServlet, I believe) that will catch it
> > and package it into a SOAP Fault that is returned to the client.  A
> > common client coding practice is to check for a Fault and display its
> > contents, which would have the info.
> > 
> > Further, the J2EE container will sometimes log Java exceptions, depending
> > on the container and possibly the configuration of the container.
> > 
> > Scott Nichol
> > 
> > Do not send e-mail directly to this e-mail address,
> > because it is filtered to accept only mail from
> > specific mail lists.
> > > 
> > > Thanks
> > > 
> > > Maxi
> > > 
> > > 
> > > 
> > > 
> > > On Fri, 30 Jan 2004 10:04:59 -0500, "Scott Nichol"
> > > <sn...@scottnichol.com> said:
> > > > Max: I am sending this directly to you as well as the list because my
> > > > e-mails to the list are not showing up.
> > > > 
> > > > I have a number of comments.
> > > > 
> > > > 1. You do not need to register anything to [de-]serialize a Vector.  In
> > > > fact, the BeanSerializer may do things you do not want it to do.
> > > > 
> > > > 2. Constants.NS_URI_LITERAL_XML is *not* the same as WSDL
> > > > document/literal.  It is a custom encoding supported by Apache SOAP.  It
> > > > will not allow you to use BeanSerializer, etc.  It only works with
> > > > parameters that are DOM Element.
> > > > 
> > > > 3. What error do you get when you try to instantiate a Call?  You should
> > > > be able to do this if you have the classes available in a class loader
> > > > available to the server.
> > > > 
> > > > Scott Nichol
> > > > 
> > > > Do not send e-mail directly to this e-mail address,
> > > > because it is filtered to accept only mail from
> > > > specific mail lists.
> > > > ----- Original Message ----- 
> > > > From: "Maximiliano Barone" <mb...@tourch.com.ar>
> > > > To: <so...@ws.apache.org>
> > > > Sent: Friday, January 30, 2004 9:51 AM
> > > > Subject: Server-Side as a Client of other Web Service
> > > > 
> > > > 
> > > > > Hi ! I am developing a Service that receives a call from a Client over
> > > > > Apache SOAP like this:
> > > > > 
> > > > > CLIENT:
> > > > > 
> > > > > // Mapping registry
> > > > >    SOAPMappingRegistry smr = new
> > > > >    SOAPMappingRegistry();
> > > > >    BeanSerializer beanSer = new BeanSerializer ();    
> > > > >       
> > > > >    smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("urn:UpdateUsrWS",
> > > > >    "UpdateUsr"), Vector.class, beanSer, beanSer);
> > > > >             
> > > > > // Build the call.
> > > > >    Call call = new Call();
> > > > >    call.setTargetObjectURI("urn:UpdateUsrWS");
> > > > >    call.setMethodName("main");
> > > > >    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
> > > > > 
> > > > > 
> > > > > The Server Side (MyService: UpdateUsrWS) receives some information from
> > > > > the Client and invokes other Services over Apache SOAP too, so my Service
> > > > > (Server-Side) acts as a client too.
> > > > > The problem is that I am trying to create a new Call from my class and it
> > > > > doesn't work.
> > > > > 
> > > > > 
> > > > > SERVER (As a Client of other Web Services)
> > > > > 
> > > > > Call call = new Call();
> > > > > 
> > > > > Do you know if the SOAP Server supports this ?
> > > > > Any suggestion ?
> > > > > 
> > > > > Thank you.
> > > > > 
> > > > > Max
> > > > > 
> > > > > 
> > > > > 
> > > > > -- 
> > > > > http://www.fastmail.fm - Sent 0.000002 seconds ago
> > > > >
> > > 
> > > -- 
> > > http://www.fastmail.fm - Choose from over 50 domains or use your own
> > >
> 
> -- 
> http://www.fastmail.fm - Or how I learned to stop worrying and
>                           love email again
> 

-- 
http://www.fastmail.fm - Consolidate POP email and Hotmail in one place

Re: Server-Side as a Client of other Web Service

Posted by Maximiliano Barone <mb...@tourch.com.ar>.
Scott:

In this case, I want to change the URL of each of the Listener's
Services, so I have one Listener (Listener.class) in my
TOMCAT_HOME/shared/classes path (in the same Tomcat instance of my
service). 

All of my listeners are going to use the same class and class' name.
How could I use another Listener (Listener.class) ? Where do I have to
put this class ?
If I call the Listener.class from my Service (Caller) , which of both
Listeners are going to receive it ?


Thank you very much.

Max.



On Mon, 2 Feb 2004 23:31:18 -0500, "Scott Nichol"
<sn...@scottnichol.com> said:
> Note: I am *not* a Tomcat expert.  The following represents what I would
> try, but I have *not* tried it, so follow the instructions at your own
> risk ;-).
> 
> In your Tomcat's server.xml, there is probably a Connector element that
> looks something like
> 
>     <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8080 -->
>     <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
>                port="8080" minProcessors="5" maxProcessors="100"
>                enableLookups="true" redirectPort="8443" acceptCount="100"
>                debug="0" connectionTimeout="20000" 
>                disableUploadTimeout="true" xpoweredBy="true"/>
> 
> This tell's Tomcat to start an HTTP server listening on port 8080.  To
> have another server listening on port 8081, just copy and paste this
> entry, then change 8080 to 8081
> 
>     <!-- Define a non-SSL Coyote HTTP/1.1 Connector on port 8081 -->
>     <Connector className="org.apache.coyote.tomcat5.CoyoteConnector"
>                port="8081" minProcessors="5" maxProcessors="100"
>                enableLookups="true" redirectPort="8443" acceptCount="100"
>                debug="0" connectionTimeout="20000" 
>                disableUploadTimeout="true" xpoweredBy="true"/>
> 
> Now you should have two connectors listening on ports 8080 and 8081. 
> They will both (I think) forward requests to your soap webapp based on
> them having the /soap URI stem.
> 
> (I continue to send e-mail directly to you, Max, because my posts to the
> list are timing out and being returned to me.)
> 
> Scott Nichol
> 
> Do not send e-mail directly to this e-mail address,
> because it is filtered to accept only mail from
> specific mail lists.
> ----- Original Message ----- 
> From: "Maximiliano Barone" <mb...@tourch.com.ar>
> To: "Scott Nichol" <sn...@scottnichol.com>;
> <so...@ws.apache.org>
> Sent: Monday, February 02, 2004 12:27 PM
> Subject: Re: Server-Side as a Client of other Web Service
> 
> 
> Scott:
> 
> It worked ok. Thanks a lot.
> I use Tomcat and I would like to ask you another thing.
> 
> My Service dinamically invokes some other Services (as I told you :-) ),
> so I get the URL of each of the Services dinamically (from my Database)
> that I am going to call and send them some information.
> The question is:
> 
> I want to test my application and, Is it possible tu run in the same
> machine 2 Tomcats ?
> If it is possible I could invoke each of those services just changing the
> URL.
> For example: I invoked the Listener over SOAP but this service is using
> the same URL as my Service:
>                     http://localhost:8080/soap/servlet/rpcrouter
> 
> Can I deploy another instance of Tomcat at the same time using a
> different port number ? 
> for example:  http://localhost:8010/soap/servlet/rpcrouter
> 
> Where Should I do ? Where Do I set the port number up ?
> 
> Thank you very much !!!
> 
> Max
> 
> 
>  
> 
> On Mon, 2 Feb 2004 10:32:22 -0500, "Scott Nichol"
> <sn...@scottnichol.com> said:
> > How have you deployed Apache SOAP in your J2EE container?  Is it a
> > webapp?  It should be.  With Tomcat, for example, you would probably have
> > a directory
> > 
> >     $CATALINA_HOME/webapps/soap
> > 
> > for the webapp.  All of the Apache SOAP classes would be in
> > 
> >     $CATALINA_HOME/webapps/soap/WEB-INF/classes
> > 
> > Your service code should be deployed to that same directory (and its
> > sub-directories to match your package declarations).  In your case,
> > because you use Apache SOAP classes in your service, this is your only
> > deployment option (on Tomcat, at least; I don't think you have ever said
> > which container you are using).  For services that do not use Apache SOAP
> > classes, another option (although definitely *not* recommended) is to put
> > the service classes in $CATALINA_HOME/shared/classes.
> > 
> > Scott Nichol
> > 
> > Do not send e-mail directly to this e-mail address,
> > because it is filtered to accept only mail from
> > specific mail lists.
> > ----- Original Message ----- 
> > From: "Maximiliano Barone" <mb...@tourch.com.ar>
> > To: <so...@ws.apache.org>
> > Sent: Saturday, January 31, 2004 4:30 PM
> > Subject: Re: Server-Side as a Client of other Web Service
> > 
> > 
> > Scott:
> > 
> > Thank you very much for your answers.
> > When my service dinamically tries to send the request (invoking) to other
> > Web Services, it fails because it doesn´t find none of the following
> > classes:
> > 
> > - Constants
> > - Parameter
> > - Fault
> > - Call
> > - Response
> > 
> > All of these classes belongs to org.apache.soap.rpc.*
> > When I compile this in my IDE Java it works well, but when it is running
> > in the Apache SOAP Server context (Server Side) it fails.
> > I read the article that you told me about the classloaders, but what
> > classes should I put in one of those directories ?
> > 
> > Thanks.
> > 
> > Max
> > 
> > 
> > On Fri, 30 Jan 2004 11:25:59 -0500, "Scott Nichol"
> > <sn...@scottnichol.com> said:
> > > > 3) Could you please tell me how I can put the classes in the class loader
> > > > of the server ?
> > > 
> > > Since you are making the Call from code that is running in the context of
> > > an Apache SOAP service, the classes *should* be available, and the
> > > instantiation of Call should work.
> > > 
> > > The exact set of classes available through class loaders depends on the
> > > J2EE container you are using.  With Tomcat, for example, the class
> > > loaders are documented (for version 4.1) at
> > > http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html.
> > > 
> > > For Apache SOAP services deployed in Tomcat, the classes are under the
> > > WEB-INF/classes directory for the soap webapp.  If that webapp was
> > > deployed the "simplest" way, the full path to the classes is
> > > $CATALINA_HOME/webapps/soap/WEB-INF/classes.
> > > 
> > > > I will explain you this interaction:
> > > > 
> > > > 1) A client sends some info (over Apache SOAP) to my Service.  (OK)
> > > > 2) My Service receives this call and saves the data internally.      (OK)
> > > > 3) My Service builds a new DOM Element and sends it to other services. 
> > > > (ERROR !)
> > > > 
> > > > I can't see the ERROR of this third step because the Client (step 1) uses
> > > > a servlet to invoke my 
> > > > Service and it internally invokes the other services. I know that my code
> > > > is not working well because I comment that line of the 
> > > > new Call ("Call call = new Call();") and it works (without calling the
> > > > services, of course).
> > > > How can I see that error ? 
> > > 
> > > If your service code does nothing to trap an exception, an exception
> > > thrown in the instantiation of Call will trace back on the stack into
> > > Apache SOAP code (within RPCRouterServlet, I believe) that will catch it
> > > and package it into a SOAP Fault that is returned to the client.  A
> > > common client coding practice is to check for a Fault and display its
> > > contents, which would have the info.
> > > 
> > > Further, the J2EE container will sometimes log Java exceptions, depending
> > > on the container and possibly the configuration of the container.
> > > 
> > > Scott Nichol
> > > 
> > > Do not send e-mail directly to this e-mail address,
> > > because it is filtered to accept only mail from
> > > specific mail lists.
> > > > 
> > > > Thanks
> > > > 
> > > > Maxi
> > > > 
> > > > 
> > > > 
> > > > 
> > > > On Fri, 30 Jan 2004 10:04:59 -0500, "Scott Nichol"
> > > > <sn...@scottnichol.com> said:
> > > > > Max: I am sending this directly to you as well as the list because my
> > > > > e-mails to the list are not showing up.
> > > > > 
> > > > > I have a number of comments.
> > > > > 
> > > > > 1. You do not need to register anything to [de-]serialize a Vector.  In
> > > > > fact, the BeanSerializer may do things you do not want it to do.
> > > > > 
> > > > > 2. Constants.NS_URI_LITERAL_XML is *not* the same as WSDL
> > > > > document/literal.  It is a custom encoding supported by Apache SOAP.  It
> > > > > will not allow you to use BeanSerializer, etc.  It only works with
> > > > > parameters that are DOM Element.
> > > > > 
> > > > > 3. What error do you get when you try to instantiate a Call?  You should
> > > > > be able to do this if you have the classes available in a class loader
> > > > > available to the server.
> > > > > 
> > > > > Scott Nichol
> > > > > 
> > > > > Do not send e-mail directly to this e-mail address,
> > > > > because it is filtered to accept only mail from
> > > > > specific mail lists.
> > > > > ----- Original Message ----- 
> > > > > From: "Maximiliano Barone" <mb...@tourch.com.ar>
> > > > > To: <so...@ws.apache.org>
> > > > > Sent: Friday, January 30, 2004 9:51 AM
> > > > > Subject: Server-Side as a Client of other Web Service
> > > > > 
> > > > > 
> > > > > > Hi ! I am developing a Service that receives a call from a Client over
> > > > > > Apache SOAP like this:
> > > > > > 
> > > > > > CLIENT:
> > > > > > 
> > > > > > // Mapping registry
> > > > > >    SOAPMappingRegistry smr = new
> > > > > >    SOAPMappingRegistry();
> > > > > >    BeanSerializer beanSer = new BeanSerializer ();    
> > > > > >       
> > > > > >    smr.mapTypes(Constants.NS_URI_SOAP_ENC, new QName("urn:UpdateUsrWS",
> > > > > >    "UpdateUsr"), Vector.class, beanSer, beanSer);
> > > > > >             
> > > > > > // Build the call.
> > > > > >    Call call = new Call();
> > > > > >    call.setTargetObjectURI("urn:UpdateUsrWS");
> > > > > >    call.setMethodName("main");
> > > > > >    call.setEncodingStyleURI(Constants.NS_URI_LITERAL_XML);
> > > > > > 
> > > > > > 
> > > > > > The Server Side (MyService: UpdateUsrWS) receives some information from
> > > > > > the Client and invokes other Services over Apache SOAP too, so my Service
> > > > > > (Server-Side) acts as a client too.
> > > > > > The problem is that I am trying to create a new Call from my class and it
> > > > > > doesn't work.
> > > > > > 
> > > > > > 
> > > > > > SERVER (As a Client of other Web Services)
> > > > > > 
> > > > > > Call call = new Call();
> > > > > > 
> > > > > > Do you know if the SOAP Server supports this ?
> > > > > > Any suggestion ?
> > > > > > 
> > > > > > Thank you.
> > > > > > 
> > > > > > Max
> > > > > > 
> > > > > > 
> > > > > > 
> > > > > > -- 
> > > > > > http://www.fastmail.fm - Sent 0.000002 seconds ago
> > > > > >
> > > > 
> > > > -- 
> > > > http://www.fastmail.fm - Choose from over 50 domains or use your own
> > > >
> > 
> > -- 
> > http://www.fastmail.fm - Or how I learned to stop worrying and
> >                           love email again
> > 
> 
> -- 
> http://www.fastmail.fm - Consolidate POP email and Hotmail in one place
> 

-- 
http://www.fastmail.fm - IMAP accessible web-mail