File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

proxy settings in servlet

 
dhaval.shah
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I have created war file for the project and it has been deployed on another server. i want to access it using the proxy settings like proxy url,name,port number, username, password . which i have stored in the proxy.properties file.

Even i have written a servlet that wil load a properties file in memory on start up. can anyone help me to how to create a some class that wil use the proxy settings and call the webservices on server on which it has been deployed ???
 
Vinod K Singh
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
See if this (Proxy authentication in Java) helps you in anyway.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not clear enough. Do you want to write a webservice client, to access the webservices exposed by the application deployed on the server?
 
dhaval.shah
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created a webservice client and i am calling the stub i have generated using the WSDL. But the webservices are located on some other server say internet. To access it i need to pass through the proxy authentications.
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have tried the suggestion, given by Vinod?
 
dhaval.shah
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes i tried. but i m getting following exception



*************************************************************

11:44:16,688 INFO [STDOUT] 2008-10-30 11:44:16,688 ERROR [HttpMethodDirector-authenticate-235]-Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials


org.apache.commons.httpclient.auth.InvalidCredentialsException: Credentials cannot be used for NTLM authentication: org.apache.commons.httpclient.UsernamePasswordCredentials


11:44:16,719 INFO [STDOUT] 2008-10-30 11:44:16,719 ERROR [searchTrip_jsp-_jspService-658]-Transport error: 407 Error: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )
org.apache.axis2.AxisFault: Transport error: 407 Error: Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy filter is denied. )




***************************************************************
 
Adeel Ansari
Ranch Hand
Posts: 2874
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, its NTLM. I would suggest you to read up a bit. Below are the related links.

Java 6 Http Authentication
NTLM Support in HttpClient
HttpClient NTLM Authentication

I hope it would help. Cheers.
 
dhaval.shah
Greenhorn
Posts: 7
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey thanks Adeel .. its working now.

I used the following code. if it could help you.
stub is the stub i have generated using WSDL file.

----------------------------------------------------------------------


HttpTransportProperties.ProxyProperties HTTPProxyProperties = new HttpTransportProperties.ProxyProperties();
HTTPProxyProperties.setProxyName("PROXY_NAME");
HTTPProxyProperties.setProxyPort("PROXY_PORT");
HTTPProxyProperties.setUserName("USER_NAME");HTTPProxyProperties.setPassWord(("PASSWORD"));HTTPProxyProperties.setDomain(("DOMAIN"));




Options options = stub._getServiceClient().getOptions();options.setProperty(MessageContextConstants.HTTP_PROTOCOL_VERSION,HTTPConstants.HEADER_PROTOCOL_10);options.setProperty(HTTPConstants.PROXY,HTTPProxyProperties);

----------------------------------------------------------------------

But the problem over here is that i had to use this lines of code everytime i make a call to stub when i am loading the HTTPProxyProperties object in servlet and loading into memory while calling stub. its not taking the proxy settings.
 
Amit Ghorpade
Bartender
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"dhaval.p. shah" please check your private messages for an important administrative matter.
Thanks.
 
Amit Ghorpade
Bartender
Posts: 2851
10
Fedora Firefox Browser Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"dhaval.shah" please check your private messages for an important administrative matter again.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic