You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Blue Diamond <gv...@gmail.com> on 2011/03/03 09:04:08 UTC

HTTPConduit for Dispatch

Hello All!

We use CXF for creating dynamic JAX-WS clients (Dispatch<SOAPMessage>) for
our service. All is set.
Now I want to engage HTTPS. I am able to do it from cxf.xml file but what I
need is, this to be done programmatically given the server URL is dynamic.
This is where I am stuck.

*Code:*
*Client client = ClientProxy.getClient(dispatchClient);*
*HTTPConduit conduit = (HTTPConduit) client.getConduit();*
*
*
*Exception:*
Exception in thread "main" java.lang.IllegalArgumentException: not a proxy
instance
at java.lang.reflect.Proxy.getInvocationHandler(Unknown Source)
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)


So, the mechanism provided works for JAX-WS clients but not dynamic dispatch
based clients? What do I do in this? Does CXF support this? How to
get/configure conduit for my dispatch dynamically at runtime?

Need help...

Thanks & Regards,
Anil

Re: HTTPConduit for Dispatch

Posted by Blue Diamond <gv...@gmail.com>.
My bad. I messed up with providers.. Able to fix it :)

>From CXF front no issues. Conduit setting programmatically works perfectly!

Thanks a lot!
Anil

On Thu, Mar 3, 2011 at 3:01 PM, Blue Diamond <gv...@gmail.com> wrote:

> Thanks a lot Freeman! :) It worked.
>
> Unfortunately, I ended up getting the following exception which didn't show
> up when I did cxf.xml way!!! I understand this is some SSL related issue.
> But any idea on why this could have happened? My certificates are FIPS
> compliant.
>
> javax.net.ssl.SSLHandshakeException: bad handshake record MAC
> at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
>  at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
> at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
>  at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(Unknown Source)
> at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown Source)
>  at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source)
> at javax.net.ssl.SSLEngine.unwrap(Unknown Source)
>  at
> org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.unwrap(SslSelectChannelEndPoint.java:708)
> at
> org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.fill(SslSelectChannelEndPoint.java:362)
>  at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:290)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
>  at
> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
>  at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
>  at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
> at java.lang.Thread.run(Unknown Source)
> [org.eclipse.jetty.util.log] : EXCEPTION
> javax.net.ssl.SSLHandshakeException: bad handshake record MAC
> at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
>  at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
> at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
>  at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(Unknown Source)
> at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown Source)
>  at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source)
> at javax.net.ssl.SSLEngine.unwrap(Unknown Source)
>  at
> org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.unwrap(SslSelectChannelEndPoint.java:708)
> at
> org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.fill(SslSelectChannelEndPoint.java:362)
>  at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:290)
> at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
>  at
> org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
>  at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
> at
> org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
>  at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
> at java.lang.Thread.run(Unknown Source)
>
> On Thu, Mar 3, 2011 at 1:59 PM, Freeman Fang <fr...@gmail.com>wrote:
>
>> Hi,
>>
>> You code should be like
>>
>> Client client =
>> ((org.apache.cxf.jaxws.DispatchImpl)dispatchClient).getClient();
>>
>> HTTPConduit conduit = (HTTPConduit) client.getConduit();
>> ...
>>
>>
>> Freeman
>>
>>
>>
>> On 2011-3-3, at 下午4:04, Blue Diamond wrote:
>>
>>  Hello All!
>>>
>>> We use CXF for creating dynamic JAX-WS clients (Dispatch<SOAPMessage>)
>>> for
>>> our service. All is set.
>>> Now I want to engage HTTPS. I am able to do it from cxf.xml file but what
>>> I
>>> need is, this to be done programmatically given the server URL is
>>> dynamic.
>>> This is where I am stuck.
>>>
>>> *Code:*
>>> *Client client = ClientProxy.getClient(dispatchClient);*
>>> *HTTPConduit conduit = (HTTPConduit) client.getConduit();*
>>> *
>>> *
>>> *Exception:*
>>> Exception in thread "main" java.lang.IllegalArgumentException: not a
>>> proxy
>>> instance
>>> at java.lang.reflect.Proxy.getInvocationHandler(Unknown Source)
>>> at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)
>>>
>>>
>>> So, the mechanism provided works for JAX-WS clients but not dynamic
>>> dispatch
>>> based clients? What do I do in this? Does CXF support this? How to
>>> get/configure conduit for my dispatch dynamically at runtime?
>>>
>>> Need help...
>>>
>>> Thanks & Regards,
>>> Anil
>>>
>>
>>
>> --
>> Freeman Fang
>>
>> ------------------------
>>
>> FuseSource: http://fusesource.com
>> blog: http://freemanfang.blogspot.com
>> twitter: http://twitter.com/freemanfang
>> Apache Servicemix:http://servicemix.apache.org
>> Apache Cxf: http://cxf.apache.org
>> Apache Karaf: http://karaf.apache.org
>> Apache Felix: http://felix.apache.org
>>
>>
>

Re: HTTPConduit for Dispatch

Posted by Blue Diamond <gv...@gmail.com>.
Thanks a lot Freeman! :) It worked.

Unfortunately, I ended up getting the following exception which didn't show
up when I did cxf.xml way!!! I understand this is some SSL related issue.
But any idea on why this could have happened? My certificates are FIPS
compliant.

javax.net.ssl.SSLHandshakeException: bad handshake record MAC
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source)
at javax.net.ssl.SSLEngine.unwrap(Unknown Source)
at
org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.unwrap(SslSelectChannelEndPoint.java:708)
at
org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.fill(SslSelectChannelEndPoint.java:362)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:290)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
at java.lang.Thread.run(Unknown Source)
[org.eclipse.jetty.util.log] : EXCEPTION
javax.net.ssl.SSLHandshakeException: bad handshake record MAC
at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.fatal(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.readNetRecord(Unknown Source)
at com.sun.net.ssl.internal.ssl.SSLEngineImpl.unwrap(Unknown Source)
at javax.net.ssl.SSLEngine.unwrap(Unknown Source)
at
org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.unwrap(SslSelectChannelEndPoint.java:708)
at
org.eclipse.jetty.io.nio.SslSelectChannelEndPoint.fill(SslSelectChannelEndPoint.java:362)
at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:290)
at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:212)
at org.eclipse.jetty.server.HttpConnection.handle(HttpConnection.java:426)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:510)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint.access$000(SelectChannelEndPoint.java:34)
at
org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:40)
at
org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:450)
at java.lang.Thread.run(Unknown Source)

On Thu, Mar 3, 2011 at 1:59 PM, Freeman Fang <fr...@gmail.com> wrote:

> Hi,
>
> You code should be like
>
> Client client =
> ((org.apache.cxf.jaxws.DispatchImpl)dispatchClient).getClient();
>
> HTTPConduit conduit = (HTTPConduit) client.getConduit();
> ...
>
>
> Freeman
>
>
>
> On 2011-3-3, at 下午4:04, Blue Diamond wrote:
>
>  Hello All!
>>
>> We use CXF for creating dynamic JAX-WS clients (Dispatch<SOAPMessage>) for
>> our service. All is set.
>> Now I want to engage HTTPS. I am able to do it from cxf.xml file but what
>> I
>> need is, this to be done programmatically given the server URL is dynamic.
>> This is where I am stuck.
>>
>> *Code:*
>> *Client client = ClientProxy.getClient(dispatchClient);*
>> *HTTPConduit conduit = (HTTPConduit) client.getConduit();*
>> *
>> *
>> *Exception:*
>> Exception in thread "main" java.lang.IllegalArgumentException: not a proxy
>> instance
>> at java.lang.reflect.Proxy.getInvocationHandler(Unknown Source)
>> at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)
>>
>>
>> So, the mechanism provided works for JAX-WS clients but not dynamic
>> dispatch
>> based clients? What do I do in this? Does CXF support this? How to
>> get/configure conduit for my dispatch dynamically at runtime?
>>
>> Need help...
>>
>> Thanks & Regards,
>> Anil
>>
>
>
> --
> Freeman Fang
>
> ------------------------
>
> FuseSource: http://fusesource.com
> blog: http://freemanfang.blogspot.com
> twitter: http://twitter.com/freemanfang
> Apache Servicemix:http://servicemix.apache.org
> Apache Cxf: http://cxf.apache.org
> Apache Karaf: http://karaf.apache.org
> Apache Felix: http://felix.apache.org
>
>

Re: HTTPConduit for Dispatch

Posted by Freeman Fang <fr...@gmail.com>.
Hi,

You code should be like

Client client =  
((org.apache.cxf.jaxws.DispatchImpl)dispatchClient).getClient();
HTTPConduit conduit = (HTTPConduit) client.getConduit();
...


Freeman


On 2011-3-3, at 下午4:04, Blue Diamond wrote:

> Hello All!
>
> We use CXF for creating dynamic JAX-WS clients  
> (Dispatch<SOAPMessage>) for
> our service. All is set.
> Now I want to engage HTTPS. I am able to do it from cxf.xml file but  
> what I
> need is, this to be done programmatically given the server URL is  
> dynamic.
> This is where I am stuck.
>
> *Code:*
> *Client client = ClientProxy.getClient(dispatchClient);*
> *HTTPConduit conduit = (HTTPConduit) client.getConduit();*
> *
> *
> *Exception:*
> Exception in thread "main" java.lang.IllegalArgumentException: not a  
> proxy
> instance
> at java.lang.reflect.Proxy.getInvocationHandler(Unknown Source)
> at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:93)
>
>
> So, the mechanism provided works for JAX-WS clients but not dynamic  
> dispatch
> based clients? What do I do in this? Does CXF support this? How to
> get/configure conduit for my dispatch dynamically at runtime?
>
> Need help...
>
> Thanks & Regards,
> Anil


-- 
Freeman Fang

------------------------

FuseSource: http://fusesource.com
blog: http://freemanfang.blogspot.com
twitter: http://twitter.com/freemanfang
Apache Servicemix:http://servicemix.apache.org
Apache Cxf: http://cxf.apache.org
Apache Karaf: http://karaf.apache.org
Apache Felix: http://felix.apache.org