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

S.Allegro edited comment on CXF-2585 at 12/17/09 1:32 PM:
----------------------------------------------------------

Thank's for your quick answer
I prefer the 2nd workaround, and I will enjoy some code for the interceptor.
(PS: in fact, I setup my proxy using Spring, not JAXRSClientFactory directly)


      was (Author: sallegro):
    Thank's for your quick answer
I prefer the 2nd workaround, and I will enjoy some code for the interceptor.
(PS: in fact, I setup my proxy using Spring, not JAXRSClientFactory directly)

Stéphane

-----Message d'origine-----
De : Sergey Beryozkin (JIRA) [mailto:j...@apache.org] 
Envoyé : mercredi 16 décembre 2009 21:50
À : ALLEGRO Stephane RD-BIZZ-ISS
Objet : [jira] Commented: (CXF-2585) Already connected exception when using a 
proxy created with JAXRSClientFactory


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

Sergey Beryozkin commented on CXF-2585:
---------------------------------------

it is a bug affecting a proxy based flavor only. 
The problem is that a proxy does not indicate to the transport-level 
HttpConduit that an empty POST (with no request body) is coming which is 
something that never occurs with SOAP proxies.

It will be fixed for soon to be released 2.2.6

Couple of workarounds.
1. Use WebClient :

Response r = WebClient.create(endpointAddress).query("param", 
"bob").post(null); String s = (String)r.getEntity();

2. If you do prefer to use a proxy then for the empty POST be processed 
correctly, you can temporarily register a CXF out interceptor with a proxy and 
set a "org.apache.cxf.post.empty" property on a message - let me know please if 
you'd like to try this option and I will post a code for the interceptor

thanks


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


  
> Already connected exception when using a proxy created with JAXRSClientFactory
> ------------------------------------------------------------------------------
>
>                 Key: CXF-2585
>                 URL: https://issues.apache.org/jira/browse/CXF-2585
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-RS
>    Affects Versions: 2.2.5
>         Environment: JDK 1.5.0.18
>            Reporter: S.Allegro
>            Assignee: Sergey Beryozkin
>             Fix For: 2.2.6, 2.3
>
>
> I'm trying to get a very simple Rest client working, but I always got this 
> exception:
> java.lang.IllegalStateException: Already connected
>       at 
> java.net.HttpURLConnection.setFixedLengthStreamingMode(HttpURLConnection.java:100)
>       at 
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.thresholdNotReached(HTTPConduit.java:1885)
>       at 
> org.apache.cxf.io.AbstractThresholdOutputStream.close(AbstractThresholdOutputStream.java:99)
>       at 
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1976)
>       at 
> org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:66)
>       at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:637)
>       at 
> org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
>       at 
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
>       at 
> org.apache.cxf.jaxrs.client.ClientProxyImpl.doChainedInvocation(ClientProxyImpl.java:429)
>       at 
> org.apache.cxf.jaxrs.client.ClientProxyImpl.invoke(ClientProxyImpl.java:166)
>       at $Proxy16.doSomething(Unknown Source)
>       at com.francetelecom.resttest.RestTest.main(RestTest.java:27)
> Here is my jax-rs interface:
> @Path("/")
> public interface RestWS {
>     @POST
>     @Path("/test")
>     public String doSomething( @QueryParam("param") String paramName);
> }
> And here the way my client uses it:
> RestWS proxy = 
> JAXRSClientFactory.create("http://localhost:8080/RestWSMock",RestWS.class);
> proxy.doSomething("bob");
> I can not get it simpler. Any idea what's wrong ?
> regards

-- 
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