You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Philip Wilder <ph...@nortel.com> on 2009/04/27 15:32:24 UTC

Using SSL with JAX-WS

Hello All, 

I have been struggling a bit with Axis2 attempting to setup WebServices
over SSL. Admittedly I'm fairly new to SSL in general so forgive me if I
use some of the terminology incorrectly. Also apologies for what amounts
to a long read. 

As far as I can tell there are two parts to this process:

(1) Serving up the WSDL over HTTPS.

(2) Serving Web Services over HTTPS.

With regards to (1) but I am having a problem with replaced
<soap:address /> element. While the hostname in the soap address field
is replaced properly as I would expect the port number defaults to 8080
(for testing purposes I am using port 8181). For example, if I connect
over the following address (names changed): 

	
https://localhost:8443/axis2/services/WebService.WebServicePort?wsdl 

the Soap Address line is written as follows:

	<soap:address
location="http://localhost:8080/axis2/services/WebService.WebServicePort
/"/>

Similarly if I replace localhost with 127.0.0.1 the hostname is changed
but the port number is not. The port number *will* change but only after
I connect to it directly over http
(http://localhost:8181/axis2/services/WebService.WebServicePort?wsdl).
Is there any way to configure this behaviour in the axis2.xml config
file? I have attempted to change the port parameter in the
org.apache.axis2.transport.http.SimpleHTTPServer Transport receiver
without success. In fact, commenting out this entire element appears to
have no effect on communications. As a reminder, I am seeing this
problem while using JAX-WS, no testing has been done using another
binding mechanism. 

For the curious a wsdl with the incorrect port specified maniftests
itself with the following error in the java client:

	Exception in thread "main"
com.sun.xml.ws.client.ClientTransportException: HTTP transport error:
java.net.ConnectException: Connection refused: connect
		at
com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpC
lientTransport.java:134)
		at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTrans
portPipe.java:140)
		at
com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(Ht
tpTransportPipe.java:86)
		at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:595)
		at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:554)
		at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:539)
		at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:436)
		at com.sun.xml.ws.client.Stub.process(Stub.java:248)
		at
com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:135)
		at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.jav
a:109)
		at
com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.jav
a:89)
		at
com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:118)
		at $Proxy30.deviceGet(Unknown Source)
		at com.nortel.ltp.CmdClient.getDevice(CmdClient.java:41)
		at com.nortel.ltp.CmdClient.main(CmdClient.java:29)
	Caused by: java.net.ConnectException: Connection refused:
connect
		at java.net.PlainSocketImpl.socketConnect(Native Method)
		at
java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
		at
java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
		at
java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
		at java.net.Socket.connect(Socket.java:520)
		at java.net.Socket.connect(Socket.java:470)
		at
sun.net.NetworkClient.doConnect(NetworkClient.java:157)
		at
sun.net.www.http.HttpClient.openServer(HttpClient.java:388)
		at
sun.net.www.http.HttpClient.openServer(HttpClient.java:523)
		at
sun.net.www.http.HttpClient.<init>(HttpClient.java:231)
		at sun.net.www.http.HttpClient.New(HttpClient.java:304)
		at sun.net.www.http.HttpClient.New(HttpClient.java:321)
		at
sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConn
ection.java:813)
		at
sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnecti
on.java:792)
		at
sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.ja
va:690)
		at
sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConne
ction.java:857)
		at
com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpC
lientTransport.java:122)
		... 14 more

This brings us to the second part of the problem (2). What is the best
way to serve the WebService over HTTPS? My instincts tell me that the
org.apache.axis2.transport.http.SimpleHTTPServer transport receiver is
not the correct choice which leaves me with the
org.apache.axis2.transport.nhttp.HttpCoreNIOSSLListener. Is there some
documentation to walk me through this process? If not, are there any
brave souls that have tread this path before me willing to share some of
their insights?

Any help would be appreciated.

Thanks,

Philip