• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Web Start client for two Web Services

Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 - everything works fine.

public static void main(String[] args) {
try {
String user = "test"; String pass ="test";
String host = "";

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";
boolean result = ws.makeRefund(officeid, operatorid, mct);

String suser = "test"; String spass ="test";
String shost = "";

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;

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
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!