• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Web Start client for two Web Services

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic