Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!

Nimish Patel

Ranch Hand
+ Follow
since Jun 29, 2005
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Nimish Patel

Hi,

I am confused that from where web service project is started in Axis I meant to say that wsdl, client code, provide code. Which code we need to write first and which one we need to generate using JAVA2WSDL and WSDL2JAVA.

Please help me. I have read many documents but still I was not able to clear this question.

Thank you for all your help.

Nimish
10 years ago
Hello,

How can we join the application with UNIX groups ?

suppose we want to access PVCS (used for version manager like VSS ),but only member of "xyz" UNIX groups has permission to access PVCS.

so how we can link both of them ? etc. PVCS and "xyz" UNIX group.

Thanks,
Nimish Patel
13 years ago
Thanks a lot for your giving valuable time.I will greatful for it.

I can access this site using browser.It is intranet site.It is working fine in browser.Other sites,It is working fine, but only one intranet site,It is giving this exception.Continue last three days I am trying,but I am not successful.I can't understand.

Thanks joe,

Regards
NIMISH PATEL
Please help me.What is cause of socket closed exception ???
Hi,
I am using HttpClient API.I have pasted part of some code below.
I am getting this SocketException:socket closed on "client.executeMethod(getMethod)".How can I handle this exception ? Could you please help me ?



HttpClient client = new HttpClient();
GetMethod getMethod = new GetMethod(url);
getMethod.setFollowRedirects(true);
startTime = System.currentTimeMillis();
byte[] responseBody = null;
String response = null;

try {
int statusCode = client.executeMethod(getMethod);
}
catch(Exception e) {
}

I would be really greatful for it.Thanks....


Regards
Nimish PATEL
Hi,

I am download online certificates (SSL -https) though code.code is given below.Its only working for "www.verisign.com".for other https site I am getting UnknownHostException.Might be It is proxy problem.

Could you please suggest me How to set proxy in this code ?


import java.net.*;
import java.security.Security;
import java.io.*;
import javax.net.ssl.*;
import com.sun.net.ssl.*;


public class AddServerCert {
public AddServerCert() {
}

public static void main(String[] args) throws Exception {
AddServerCert s = new AddServerCert();

// Define the connection for the Server we want
// to retrieve the certificates for
String site = "https://knetca1.place.lexmark.com/ca/lexcan.nsf";
int port = 443;

Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());

System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

// Configure our KeyStore/TrustManager/Certificate file
String keyStore = "d:/nim/LexmarkCertificates";
String keyStorePasswd = "";
String keyStoreAlias = "keystorealias";

// Without this we get
// "javax.net.ssl.SSLException: untrusted server cert chain"
//
// Creates a TrustManager that will allow us to
// connect to the site so we can download the
// Server's certificate
s.createTrustALLManager();

// Get the Server's certificate chain
javax.security.cert.X509Certificate[] xc =
s.getServerCert(site, port);

// Add the server's certificate chain to our
// certificate file
for (int i=0; i < xc.length; i++) {
s.addToKeyStore(
keyStore, (keyStorePasswd).toCharArray(),
keyStoreAlias, xc[i]);
}
}

/** This will create a TrustManager that will trust
* ALL certificates and install it as the default
* SSLSocketFactory TrustManager.
*
* <p>Use this function to replace the default
* TrustManager when you are connecting to an SSL
* site that the certificate is not trusted.
*/
public void createTrustALLManager() {
try {
SSLContext sc = SSLContext.getInstance("SSL");
sc.init(null,trustAllCerts,
new java.security.SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(
sc.getSocketFactory());
} catch (Exception e) {
}
}

/** The trust ALL TrustManager. Used by createALLTrustManager()
* to replace the default SSLSocketFactory TrustManager.
*/
private TrustManager[] trustAllCerts = new TrustManager[] {
new X509TrustManager() {
public java.security.cert.X509Certificate[]
getAcceptedIssuers() {
return null;
}
public boolean isClientTrusted(
java.security.cert.X509Certificate[] certs) {
return true;
}
public boolean isServerTrusted(
java.security.cert.X509Certificate[] certs) {
return true;
}
}
};


public javax.security.cert.X509Certificate[] getServerCert(
String hostname, int port) {
javax.security.cert.X509Certificate[] serverCerts = null;
try {
// Create client socket
SSLSocketFactory factory =
HttpsURLConnection.getDefaultSSLSocketFactory();


SSLSocket socket =
(SSLSocket)factory.createSocket(hostname,port);

// Without doing the handshake first we get
// "javax.net.ssl.SSLPeerUnverifiedException:
// peer not authenticated"
// Connect to the server
socket.startHandshake();

// Retrieve the server's certificate chain
serverCerts = socket.getSession().getPeerCertificateChain();

// Close the socket
socket.close();
} catch (Exception e) {
System.out.println("getServerCert(): Exception: "
+ e.toString() + "\n" + e.getMessage());
}
return serverCerts;
}



public boolean addToKeyStore(
String keystoreFile, char [] keystorePassword,
String alias, javax.security.cert.Certificate cert) {
try {
// Create an empty keystore
java.security.KeyStore keystore =
java.security.KeyStore.getInstance(
java.security.KeyStore.getDefaultType());

// Read in existing keystore data. This is need
// to initialize the KeyStore.
FileInputStream in = new FileInputStream(keystoreFile);
keystore.load(in, null);
in.close();


ByteArrayInputStream bais =
new ByteArrayInputStream(cert.getEncoded());
java.security.cert.CertificateFactory cf =
java.security.cert.CertificateFactory.getInstance(
"X.509");
java.security.cert.Certificate certP = null;
while (bais.available() > 0) {
certP = cf.generateCertificate(bais);
}

keystore.setCertificateEntry(
alias, certP);

// Save the new keystore contents
FileOutputStream out =
new FileOutputStream(keystoreFile);
keystore.store(out, keystorePassword);
out.close();
} catch (Exception e) {
System.out.println("addToKeyStore(): Exception: "
+ e.toString() + "\n" + e.getMessage());
return false;
}
return true;
}

}
Hi,

I am using HttpClient API for accesing web pages. I am able to access the content (html content)first page.Now I want to login from that page but problem is that there is java script function which is encrypting the password.so I am unable to go to next page and the programme is retriving the content of same page(html content of first page).

Please suggest me How to deal with this problem.

Thank you.

Nimish Patel
Hello,

I need to parse xml file using dom parser with jre 1.3.1.
In dom parser,I have to use "javax.xml.parsers.DocumentBuilderFactory" class.but I couldn't find this package in rt.jar of jre 1.3.1.

How can it possible ?

Could you please advise me ?

Thanks,
Nimish Patel
Hi,

Is there any facility to make EAR file using WSAD ?

How can we do that ?

Thanks,

Nimish Patel
14 years ago
Hi,

What is the diffrence between XMLHttpRequest and HttpRequest?

Thanks,


Nimish Patel
Hi,

I am using Ajax.I get responsetext in ajax in this format.
-----------------------------------------------------------
<html>
<form>

<input type="text" name="person" value="nimish" />

</html>
</form>
------------------------------------------------------------
now I want to get "nimish" in this html.
How can I parse this html?

Thanks,

Patel
Hi,

I have a check box in JSP page.When click on this checkbox, "knowlegecheck()" function is called in javascript.

This pages comes from action class(Struts).

I want to call this method "knowlegecheck()" in Action java class.so when this page loads, directely call this method.so no need to click on check box.

How can I call java script method in java class ?
Please help me.

Thanks,
Nimish
Hi,

I have two dropdown box(combo box) in one jsp.

In first combo box, I iterate one ArrayList comes from Action class.

In List , I set Property's name and ID.

Propertyname is displayed in combo box.

and propertyID is set in <option> tag's value attribute.

code for first combo box :-
--------------------------------------------------------------------------
<logic:iterate id="prop" name="lstprops">

<bean efine id="iptID" name="prop" property="PropertyID"/>

<option value='<%=String.valueOf(iptID)%>'><bean:write name="prop" property="name"/></option>

</logic:iterate>

----------------------------------------------------------------------
After select one propertyname in the first combo box, now I want to iterate same list in second combo box.

but In second combo box should not be contain "propertyname" which I have selected in first combo box.

How can I do that ?

can I use logic:equal tag ? but How ?

Please help me.

Thanks,
Nimish Patel
14 years ago