[ 
https://issues.apache.org/jira/browse/CXF-1459?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648892#action_12648892
 ] 

Tom Schroedl commented on CXF-1459:
-----------------------------------

I was able to get some code along these lines to work that uses reflection 
instead of any instanceof  or explicit casting.

Class connType = Class.forName("com.sun.net.ssl.HttpsURLConnection");
Class verifierType = Class.forName("com.sun.net.ssl.HostnameVerifier");

if (connType.isInstance(connection)) {
         Method setHostnameVerifier = connType.getMethod("setHostnameVerifier", 
verifierType);
         Object proxy = 
java.lang.reflect.Proxy.newProxyInstance(this.getClass().getClassLoader(), 
                  new Class[] { verifierType }, 
                  new InvocationHandler() {
                           public Object invoke(Object proxy, Method method, 
Object[] args) throws Throwable {
                                    return true;
                           }
                   });
         setHostnameVerifier.invoke(connType.cast(connection), 
verifierType.cast(proxy));
         Method setSSLSocketFactory = connType.getMethod("setSSLSocketFactory", 
SSLSocketFactory.class);
         setSSLSocketFactory.invoke(connType.cast(connection), socketFactory);
}



> ClassCastException occurs on HTTPS web service call made by app deployed to 
> BEA WebLogic 9.2
> --------------------------------------------------------------------------------------------
>
>                 Key: CXF-1459
>                 URL: https://issues.apache.org/jira/browse/CXF-1459
>             Project: CXF
>          Issue Type: Improvement
>    Affects Versions: 2.0.4
>            Reporter: Tom Schroedl
>            Assignee: Benson Margulies
>         Attachments: HttpsURLConnectionFactory.patch
>
>
> HTTPS web service call fails from webapp deployed in ear file to BEA 9.2 with 
> following error:
> java.lang.ClassCastException: weblogic.net.http.SOAPHttpsURLConnection
>    at 
> org.apache.cxf.transport.https.HttpsURLConnectionFactory.createConnection(HttpsURLConnectionFactory.java:120)
> My weblogic-application.xml contains:
> <prefer-application-packages>
>    <package-name>javax.jws.*</package-name>
> </prefer-application-packages>
> The secure web service call works in Tomcat 5.5.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to