File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JNLP and Web Start and the fly likes Web Start client for two Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JNLP and Web Start
Bookmark "Web Start client for two Web Services" Watch "Web Start client for two Web Services" New topic
Author

Web Start client for two Web Services

Dmitriy Fot
Greenhorn

Joined: Sep 13, 2005
Posts: 2
Hello.

I wrote a client application that uses two different web services.
Both web services are created using Basic Authentication. They have different user_names and passwords, but must be deployed on the same application server. I must invoked methods of these web services one after another.The problem occures when I invokes mehods of second web service. No matter which of service would be first or second. The problem occurs on second calling. I got this exception:

EXCEPTION: java.rmi.RemoteException: HTTP Status-Code 403: Access to the requested resource has been denied; nested exception is:
HTTP Status-Code 403: Access to the requested resource has been denied
at com.softlets.insurelet.security.InsureletSecurityServiceSEI_Stub.login(InsureletSecurityServiceSEI_Stub.java:89)
at com.softlets.insurelet.test.TestRefundPolicy.main(TestRefundPolicy.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
...........

IMPORTANT: Everything worked fine until I started to install this application using Java Web Start.

MY ASSUMPTION: It's likely to me that web start executes my application in some environment where it caches the first web service's username and password and applies it to the second web service. Because, if I run both web services on my local machine and set ENDPOINT_ADDRESS_PROPERTY to different values (first - localhost:8080, second - 192.168.0.21:8080) everything works fine.

CODE FRAGMENT:
public static void main(String[] args) {
try {
String user = "test"; String pass ="test";
String host = "http://192.168.0.21:8080/insurelet-p/insurelet_p";

Stub stub = (Stub)(new Insurelet_policies_Impl().getInsureletPoliciesServiceSEIPort()); stub1._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, host);
stub._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, user);
stub._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, pass);

InsureletPoliciesServiceSEI ws = (InsureletPoliciesServiceSEI)stub;

String officeid = "test1"; String operatorid = "test2"; String mct = "1";
// FIRST WEB SERVICE CALLING
boolean result = ws.makeRefund(officeid, operatorid, mct);

String suser = "test"; String spass ="test";
String shost = "http://192.168.0.21:8080/insurelet-s/insurelet_s";

Stub stub1 = (Stub)(new Insurelet_security_Impl()).getInsureletSecurityServiceSEIPort();
stub1._setProperty(javax.xml.rpc.Stub.USERNAME_PROPERTY, suser);
stub1._setProperty(javax.xml.rpc.Stub.PASSWORD_PROPERTY, spass);
stub1._setProperty(javax.xml.rpc.Stub.ENDPOINT_ADDRESS_PROPERTY, shost);

InsureletSecurityServiceSEI ws1 = (InsureletSecurityServiceSEI)stub1;

// SECOND WEB SERVICE CALLING
OperatorTO to = ws1.login("softlets", "admin", "admin"); // EXCEPTION
.............

ENVIRONMENT: Both web services are deployed in a single enterprise application on Sun Java System Application Server 8.1.
Java version: 1.5..0_02
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Web Start client for two Web Services