You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Santa <Sa...@gemplus.com> on 2003/08/13 15:58:27 UTC

Soap SSL Communication

Hello,

I am Santa, using the SOAP on WAS5.0 also testing on Tomcat 4.0. I would
like to know how to make SSL communication from the Java Soap Client. The
Server is configured for the SSL (HTTPS) communication.

I have written a SOAP Server (HelloSOAP) and deployed on the Tomcat4.0 as
well as WAS5.0.  The Soap Server  Code is -

public class HelloSOAP

	public String sayHello(String name){

		return " Hello From Soap -- > "+name;
	}
}

I am able to communicate with the HelloSOAP using normal HTTP protocol. The
Soap Client Code is -

public class SoapClient {
	private  void invokeSayHello(URL url) {
		Call call = new Call();
		call.setTargetObjectURI("urn:HelloSOAP");

		call.setMethodName("sayHello");
		call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

		String name = "SP Shukla";
		Vector params = new Vector();
		params.addElement(new Parameter("name", String.class, name, null));
		call.setParams(params);

		try {
			Response resp = call.invoke(url, "");
			if (!resp.generatedFault()) {
				Parameter result = resp.getReturnValue();
				System.out.println(result.getValue());
			} else {
				System.out.println("FAULT Returned");
				System.out.println(resp.getFault().getFaultString());
			}
		} catch (SOAPException e) {
			System.out.println("Code: "+e.getFaultCode()+ ", Msg:" + e.getMessage());
			soapE.printStackTrace();
		} catch (Exception e) {
			System.out.println("Caught Exception:" + e.getMessage());
			e.printStackTrace();
		}
	}

	public static void main(String[] args) {
		try {
			URL url = new URL("http://localhost:9080/SoapTest/servlet/rpcrouter");
			SoapClient soapClient = new SoapClient();
			soapClient.invokeSayHello(url);
		} catch (MalformedURLException mue) {
			mue.printStackTrace();
		}
	}
}


COULD ANYONE PLEASE HELP ME  FOR THE SSL COMMUNICATION FROM THE JAVA SOAP
CLIENT ????

Please give the web-link also (if possible)

Any early response would be appreciated.


Thanks and Regards,
Santa
email: santa.prasad-external@gemplus.com


Re: Soap SSL Communication

Posted by Scott Nichol <sn...@scottnichol.com>.
Some docs for using SOAP with SSL are included in the distribution and can
also be found on-line at
http://cvs.apache.org/viewcvs.cgi/*checkout*/xml-soap/java/docs/install/FAQ_
Tomcat_SOAP_SSL.html?rev=HEAD&content-type=text/html.

Scott Nichol

----- Original Message -----
From: "Santa" <Sa...@gemplus.com>
To: <so...@ws.apache.org>
Sent: Wednesday, August 13, 2003 09:58
Subject: Soap SSL Communication


Hello,

I am Santa, using the SOAP on WAS5.0 also testing on Tomcat 4.0. I would
like to know how to make SSL communication from the Java Soap Client. The
Server is configured for the SSL (HTTPS) communication.

I have written a SOAP Server (HelloSOAP) and deployed on the Tomcat4.0 as
well as WAS5.0.  The Soap Server  Code is -

public class HelloSOAP

public String sayHello(String name){

return " Hello From Soap -- > "+name;
}
}

I am able to communicate with the HelloSOAP using normal HTTP protocol. The
Soap Client Code is -

public class SoapClient {
private  void invokeSayHello(URL url) {
Call call = new Call();
call.setTargetObjectURI("urn:HelloSOAP");

call.setMethodName("sayHello");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);

String name = "SP Shukla";
Vector params = new Vector();
params.addElement(new Parameter("name", String.class, name, null));
call.setParams(params);

try {
Response resp = call.invoke(url, "");
if (!resp.generatedFault()) {
Parameter result = resp.getReturnValue();
System.out.println(result.getValue());
} else {
System.out.println("FAULT Returned");
System.out.println(resp.getFault().getFaultString());
}
} catch (SOAPException e) {
System.out.println("Code: "+e.getFaultCode()+ ", Msg:" + e.getMessage());
soapE.printStackTrace();
} catch (Exception e) {
System.out.println("Caught Exception:" + e.getMessage());
e.printStackTrace();
}
}

public static void main(String[] args) {
try {
URL url = new URL("http://localhost:9080/SoapTest/servlet/rpcrouter");
SoapClient soapClient = new SoapClient();
soapClient.invokeSayHello(url);
} catch (MalformedURLException mue) {
mue.printStackTrace();
}
}
}


COULD ANYONE PLEASE HELP ME  FOR THE SSL COMMUNICATION FROM THE JAVA SOAP
CLIENT ????

Please give the web-link also (if possible)

Any early response would be appreciated.


Thanks and Regards,
Santa
email: santa.prasad-external@gemplus.com