As written, my suspicion is, that you do not call your own server, but
another one. Do you checked this? In my work experience I ran in this
problem, if my architect hadn't stopped me. The reason was, that there
are a lot of OS machines on one physical machine.
Stephan
Bao,Sam schrieb:
No, the response entity, when it's deployed is null as I don't think the appropriate resource is not being used at all. When I run in eclipse locally, the response entity is valid with the correct reply content.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 20, 2008 1:52 PM
To: [email protected]
Subject: Re: Calling a resource from another resource
do you checked the response entity, if it is correct in both cases?
Bao,Sam schrieb:
Well, localhost, is what I'm running when I'm running tomcat locally. And I
can take what it logs out, throw it into my firefox, and it'll hit the
appropriate conditions resource.
When it's deployed on Websphere, it's actually something like
http://ipvmhewas13/hhmsvc-healthriskengine
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 20, 2008 1:44 PM
To: [email protected]
Subject: Re: Calling a resource from another resource
Could it be, that you request another server, because localhost means another
interface on your Websphere / tomcat machine?
Bao,Sam schrieb:
Yes, I checked the rootURL and it is exactly as I would enter in to firefox.
For example rootURL = http://localhost:8080/resources And the I
append "/conditions" onto it in firefox, and it returns me a list of conditions.
Has anyone had any experience with using Client to call another resource inside
the same application?
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 20, 2008 12:33 PM
To: [email protected]
Subject: Re: Calling a resource from another resource
Hi Sam,
I don't know. Do you checked the rootURL you request? Perhaps they differs.
Just log them. Perhaps this causes trouble. If I remeber right, a Router routes
to one of it's goals, but not require, that it consume the full remaining path.
best regards
Stephan
Bao,Sam schrieb:
Stephen,
Do you know why this would return a 200, but yet it doesn't actually make the
http call?
Request request = getRequest();
Reference rootRef = request.getRootRef();
String rootURL = rootRef.getHostIdentifier();
String rootPath = rootRef.getPath();
//produces "http://<hostname>:<port>/<path>
if (rootPath != null && rootPath.trim().length() > 0) {
rootURL = rootURL + rootPath;
}
Client c = new Client(Protocol.HTTP);
//test conditions resource
if (TRACER.isEnabled()) {
TRACER.trace("Test Conditions Resource");
}
c.start();
Response r = c.get(rootURL + "/conditions"); <-------Calling
another resource as if simulating a call from a client (ie firefox, ie, safari).
c.stop();
Status status = r.getStatus();
if (TRACER.isEnabled()) {
TRACER.trace("Status: " + status + ". Description: " +
status.getDescription());
}
if (!Status.SUCCESS_OK.equals(status)) {
throw new Exception("Conditions GET failed. Status: " + status + ".
Description: " + status.getDescription());
}
This code is inside a resource's GET, which then calls another resource in the
same application. When I run this piece locally in eclipse, alls fine, and the
call to '/conditions' resource runs. However, when I deployed this piece of
code to Tomcat or Websphere, I get back a status of 200 (and no exception is
thrown), but it doesn't appear that the '/conditions' resource actually gets
called. Anyone have a clue as to why?