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 Ognjen Blagojevic <og...@etf.bg.ac.yu> on 2007/04/16 13:05:43 UTC
Axis2 1.1.1 and HTTPS problem
Hi all,
When I try to call Axis2-generated client for Axis2 web service over
HTTPS, an exception is thrown:
java.lang.IllegalStateException: Can't overwrite cause.
Here is source:
Korona2Stub stubSsl = *new*
Korona2Stub("https://127.0.0.1:8443/axis2/services/korona2");
Korona2Stub.TestSnimi reqSsl = *new* Korona2Stub.TestSnimi();
reqSsl.setTestString("Test string.");
reqSsl.setTestInteger(1); // Test integer
Korona2Stub.TestSnimiResponse res1Ssl = stubSsl.testSnimi(req); //
Exception thrown here.
System./out/.println(res1Ssl.get_return());
Same code works fine with HTTP on 8080. Is there anything else I need to
do to make HTTPS work?
I'm using Tomcat 6.0.10 with HTTPS connector enabled, and I can call
REST version of my web service from Firefox:
https://127.0.0.1/axis2/rest/korona2/testSnimi?testString=test&testInteger=1
Below is the full stack trace:
Exception in thread "main" java.lang.IllegalStateException: Can't
overwrite cause
at java.lang.Throwable.initCause(Throwable.java:320)
at com.ctc.wstx.compat.Jdk14Impl.setInitCause(Jdk14Impl.java:70)
at com.ctc.wstx.exc.WstxException.<init>(WstxException.java:46)
at com.ctc.wstx.exc.WstxIOException.<init>(WstxIOException.java:16)
at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
at
org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:115)
at
org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:420)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput(SOAPOverHTTPSender.java:190)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:232)
at
org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
at
org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
at
org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
at
org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
at
org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:541)
at
org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
at
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
at
org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
at orka.generated.Korona2Stub.testSnimi(Korona2Stub.java:850)
at orka.Klijent.main(Klijent.java:149)
Regards,
Ognjen
SV: SV: Axis2 1.1.1 and HTTPS problem
Posted by Peter Gylling Jørgensen <Pe...@frv.dk>.
Hi Ognjen,
I just like to point out to you, that
> -Djavax.net.ssl.trustStore=D:\java\HttpsTest\cert\keystore
leaves all instances of the same JVM with access to your webservice.
This is mainly a problem, when you wan't a servlet to gain access to a webservice, where the tomcat server will share the access with all the different servlets installed.
\pgj
>
> option. After that, the test client worked, as well as the
> Axis2 client.
>
>
> Maybe this three simple steps could be added to Axis2 docs.
>
> Regards,
> Ognjen
>
>
>
> Peter Gylling Jørgensen wrote:
> > Hi Ognjen,
> >
> > Behind the scene the AXIS2 client deploys the HttpClient.
> Try to connect directly using a simple HttpClient to
> establish the needed tweeks to connect, this way you can
> focus on the SSL/TLS connection.
> >
> > For guidelines see:
> http://jakarta.apache.org/commons/httpclient/sslguide.html
> >
> > Eventhough you set clientAuth="false" the client must
> authenticate the server, ie the client must have the servers
> credentials in the truststore. If in doubt you can add SSL
> debug info using this argument to the JVM:
> -Djavax.net.help=ssl:handshake:data
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: SV: Axis2 1.1.1 and HTTPS problem
Posted by Ognjen Blagojevic <og...@etf.bg.ac.yu>.
Hi Peter,
Thanks for a tip. I tried to create simple java app to connect to local
Tomcat over HTTPS, and figure out what was the problem. I needed to:
1. export Tomcat's self-signed certificate
2. import that certificate into new (client) keystore
3. call a client with an
-Djavax.net.ssl.trustStore=D:\java\HttpsTest\cert\keystore
option. After that, the test client worked, as well as the Axis2 client.
Maybe this three simple steps could be added to Axis2 docs.
Regards,
Ognjen
Peter Gylling Jørgensen wrote:
> Hi Ognjen,
>
> Behind the scene the AXIS2 client deploys the HttpClient. Try to connect directly using a simple HttpClient to establish the needed tweeks to connect, this way you can focus on the SSL/TLS connection.
>
> For guidelines see: http://jakarta.apache.org/commons/httpclient/sslguide.html
>
> Eventhough you set clientAuth="false" the client must authenticate the server, ie the client must have the servers credentials in the truststore. If in doubt you can add SSL debug info using this argument to the JVM: -Djavax.net.help=ssl:handshake:data
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
SV: Axis2 1.1.1 and HTTPS problem
Posted by Peter Gylling Jørgensen <Pe...@frv.dk>.
Hi Ognjen,
Behind the scene the AXIS2 client deploys the HttpClient. Try to connect directly using a simple HttpClient to establish the needed tweeks to connect, this way you can focus on the SSL/TLS connection.
For guidelines see: http://jakarta.apache.org/commons/httpclient/sslguide.html
Eventhough you set clientAuth="false" the client must authenticate the server, ie the client must have the servers credentials in the truststore. If in doubt you can add SSL debug info using this argument to the JVM: -Djavax.net.help=ssl:handshake:data
\pgj
________________________________
Fra: Ognjen Blagojevic [mailto:ognjen@etf.bg.ac.yu]
Sendt: 17. april 2007 10:25
Til: axis-user@ws.apache.org
Emne: Re: Axis2 1.1.1 and HTTPS problem
Hi Eric,
I enabled Tomcat HTTPS connector:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
and generated .keystore file with:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
as described in Tomcat docs. Tomcat is running, I can see its welcome page both on 8080 and 8443.
I put Axis2 1.1.1 WAR file in tomcat/webapps dir. I can see Axis2 welcome page both on 8080 and 8443.
I put korona2.aar (my service archive) into axis2 "services" dir. I can see generated WSDL (both on 8080 and 8443). I can also call REST version of my web service from Firefox on both ports. I can generate client stub using wsdl2java. This client stub can call web service on port 8080, but when I try to call on 8443 (as described earlier), it fails.
Regards,
Ognjen
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org
Re: Axis2 1.1.1 and HTTPS problem
Posted by Ognjen Blagojevic <og...@etf.bg.ac.yu>.
Hi Eric,
I enabled Tomcat HTTPS connector:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" />
and generated .keystore file with:
%JAVA_HOME%\bin\keytool -genkey -alias tomcat -keyalg RSA
as described in Tomcat docs. Tomcat is running, I can see its welcome
page both on 8080 and 8443.
I put Axis2 1.1.1 WAR file in tomcat/webapps dir. I can see Axis2
welcome page both on 8080 and 8443.
I put korona2.aar (my service archive) into axis2 "services" dir. I can
see generated WSDL (both on 8080 and 8443). I can also call REST version
of my web service from Firefox on both ports. I can generate client stub
using wsdl2java. This client stub can call web service on port 8080, but
when I try to call on 8443 (as described earlier), it fails.
Regards,
Ognjen
Eric Chow wrote:
> Hi Ognjjen,
>
> Can you show me the steps(include those key generation steps) to setup
> in tomcat and your client.
>
> On 4/16/07, Ognjen Blagojevic <og...@etf.bg.ac.yu> wrote:
>> Hi all,
>>
>> When I try to call Axis2-generated client for Axis2 web service over
>> HTTPS,
>> an exception is thrown:
>>
>> java.lang.IllegalStateException: Can't overwrite cause.
>>
>> Here is source:
>>
>> Korona2Stub stubSsl = new
>> Korona2Stub("https://127.0.0.1:8443/axis2/services/korona2");
>> Korona2Stub.TestSnimi reqSsl = new Korona2Stub.TestSnimi();
>> reqSsl.setTestString("Test string.");
>> reqSsl.setTestInteger(1); // Test integer
>> Korona2Stub.TestSnimiResponse res1Ssl = stubSsl.testSnimi(req); //
>> Exception
>> thrown here.
>> System.out.println(res1Ssl.get_return());
>>
>> Same code works fine with HTTP on 8080. Is there anything else I need
>> to do
>> to make HTTPS work?
>>
>> I'm using Tomcat 6.0.10 with HTTPS connector enabled, and I can call
>> REST
>> version of my web service from Firefox:
>> https://127.0.0.1/axis2/rest/korona2/testSnimi?testString=test&testInteger=1
>>
>>
>>
>> Below is the full stack trace:
>>
>>
>> Exception in thread "main" java.lang.IllegalStateException: Can't
>> overwrite
>> cause
>> at java.lang.Throwable.initCause(Throwable.java:320)
>> at
>> com.ctc.wstx.compat.Jdk14Impl.setInitCause(Jdk14Impl.java:70)
>> at com.ctc.wstx.exc.WstxException.<init>(WstxException.java:46)
>> at
>> com.ctc.wstx.exc.WstxIOException.<init>(WstxIOException.java:16)
>> at
>> com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
>> at
>> org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:115)
>>
>> at
>> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:420)
>>
>> at
>> org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput(SOAPOverHTTPSender.java:190)
>>
>> at
>> org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:232)
>>
>> at
>> org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
>>
>> at
>> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
>>
>> at
>> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
>>
>> at
>> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
>>
>> at
>> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
>>
>> at
>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
>>
>> at
>> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
>>
>> at
>> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:541)
>>
>> at
>> org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
>>
>> at
>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
>>
>> at
>> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
>>
>> at
>> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
>> at
>> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
>>
>> at
>> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
>>
>> at
>> orka.generated.Korona2Stub.testSnimi(Korona2Stub.java:850)
>> at orka.Klijent.main(Klijent.java:149)
>>
>>
>>
>> Regards,
>> Ognjen
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
Re: Axis2 1.1.1 and HTTPS problem
Posted by Eric Chow <er...@gmail.com>.
Hi Ognjjen,
Can you show me the steps(include those key generation steps) to setup
in tomcat and your client.
On 4/16/07, Ognjen Blagojevic <og...@etf.bg.ac.yu> wrote:
> Hi all,
>
> When I try to call Axis2-generated client for Axis2 web service over HTTPS,
> an exception is thrown:
>
> java.lang.IllegalStateException: Can't overwrite cause.
>
> Here is source:
>
> Korona2Stub stubSsl = new
> Korona2Stub("https://127.0.0.1:8443/axis2/services/korona2");
> Korona2Stub.TestSnimi reqSsl = new Korona2Stub.TestSnimi();
> reqSsl.setTestString("Test string.");
> reqSsl.setTestInteger(1); // Test integer
> Korona2Stub.TestSnimiResponse res1Ssl = stubSsl.testSnimi(req); // Exception
> thrown here.
> System.out.println(res1Ssl.get_return());
>
> Same code works fine with HTTP on 8080. Is there anything else I need to do
> to make HTTPS work?
>
> I'm using Tomcat 6.0.10 with HTTPS connector enabled, and I can call REST
> version of my web service from Firefox:
> https://127.0.0.1/axis2/rest/korona2/testSnimi?testString=test&testInteger=1
>
>
> Below is the full stack trace:
>
>
> Exception in thread "main" java.lang.IllegalStateException: Can't overwrite
> cause
> at java.lang.Throwable.initCause(Throwable.java:320)
> at
> com.ctc.wstx.compat.Jdk14Impl.setInitCause(Jdk14Impl.java:70)
> at com.ctc.wstx.exc.WstxException.<init>(WstxException.java:46)
> at
> com.ctc.wstx.exc.WstxIOException.<init>(WstxIOException.java:16)
> at
> com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
> at
> org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:115)
> at
> org.apache.axiom.om.impl.llom.OMNodeImpl.serializeAndConsume(OMNodeImpl.java:420)
> at
> org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.handleOMOutput(SOAPOverHTTPSender.java:190)
> at
> org.apache.axis2.transport.http.SOAPOverHTTPSender$AxisSOAPRequestEntity.writeRequest(SOAPOverHTTPSender.java:232)
> at
> org.apache.commons.httpclient.methods.EntityEnclosingMethod.writeRequestBody(EntityEnclosingMethod.java:495)
> at
> org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:1973)
> at
> org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:993)
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:397)
> at
> org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:170)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:396)
> at
> org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:346)
> at
> org.apache.axis2.transport.http.AbstractHTTPSender.executeMethod(AbstractHTTPSender.java:541)
> at
> org.apache.axis2.transport.http.SOAPOverHTTPSender.send(SOAPOverHTTPSender.java:119)
> at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:335)
> at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:204)
> at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:674)
> at
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:237)
> at
> org.apache.axis2.description.OutInAxisOperationClient.execute(OutInAxisOperation.java:202)
> at
> orka.generated.Korona2Stub.testSnimi(Korona2Stub.java:850)
> at orka.Klijent.main(Klijent.java:149)
>
>
>
> Regards,
> Ognjen
>
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org