You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by nbreau <nb...@rogers.com> on 2009/07/21 21:08:37 UTC

CXF Restful PUT and POST fail but GET works, prolog error

When deploying the sample code found at the following article

https://www.ibm.com/developerworks/webservices/library/ws-pojo-springcxf2/

deployed to both tomcat 5.5 and tomcat 6, GET requests return successfully
however POST and PUT requests fail with the following errors:

I've tried both CFX 2.1 and 2.2.2 but both error out.


----------------------------------
PUT Request in Tomcat 6 on Vista:
----------------------------------

INFO: URIParameterInterceptor handle message on path [/endpointPut/custo
mer01/endpoint/dfdf.vsvs.fw23s] with content-type [null]
Jul 21, 2009 10:35:06 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Unexpected EOF in prolog
 at [row,col {unknown-source}]: [1,0]
        at
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mer
geParams(URIParameterInInterceptor.java:122)


----------------------------------
PUT Request in Tomcat 5.5 in Ubuntu:
----------------------------------

INFO: URIParameterInterceptor handle message on path
[/EndpointPut/customer01/endpoint/dfdf.vsvs.fw23s] with content-type [null]
21-Jul-2009 10:29:34 AM org.apache.cxf.phase.PhaseInterceptorChain
doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: ParseError at [row,col]:[1,1]
Message: Premature end of file.
        at
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java:122)
        at
org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage(URIParameterInInterceptor.java:103)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)

-- 
View this message in context: http://www.nabble.com/CXF-Restful-PUT-and-POST-fail-but-GET-works%2C-prolog-error-tp24593398p24593398.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF Restful PUT and POST fail but GET works, prolog error

Posted by Sergey Beryozkin <se...@iona.com>.
Hi

It's a deprecated CXF HTTP Binding which is used in this case. I was not
involved at all in the HTTP Binding project so I don't know what's going on.
If you are starting a new project then I'd recommend you to go with the CXF
JAX-RS implementation

cheers, Sergey  


nbreau wrote:
> 
> When deploying the sample code found at the following article
> 
> https://www.ibm.com/developerworks/webservices/library/ws-pojo-springcxf2/
> 
> deployed to both tomcat 5.5 and tomcat 6, GET requests return successfully
> however POST and PUT requests fail with the following errors:
> 
> I've tried both CFX 2.1 and 2.2.2 but both error out.
> 
> 
> ----------------------------------
> PUT Request in Tomcat 6 on Vista:
> ----------------------------------
> 
> INFO: URIParameterInterceptor handle message on path [/endpointPut/custo
> mer01/endpoint/dfdf.vsvs.fw23s] with content-type [null]
> Jul 21, 2009 10:35:06 AM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unexpected EOF in prolog
>  at [row,col {unknown-source}]: [1,0]
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mer
> geParams(URIParameterInInterceptor.java:122)
> 
> 
> ----------------------------------
> PUT Request in Tomcat 5.5 in Ubuntu:
> ----------------------------------
> 
> INFO: URIParameterInterceptor handle message on path
> [/EndpointPut/customer01/endpoint/dfdf.vsvs.fw23s] with content-type
> [null]
> 21-Jul-2009 10:29:34 AM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: ParseError at [row,col]:[1,1]
> Message: Premature end of file.
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergeParams(URIParameterInInterceptor.java:122)
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMessage(URIParameterInInterceptor.java:103)
>         at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:236)
> 
> 

-- 
View this message in context: http://www.nabble.com/CXF-Restful-PUT-and-POST-fail-but-GET-works%2C-prolog-error-tp24593398p24594267.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: CXF Restful PUT and POST fail but GET works, prolog error

Posted by Daniel Kulp <dk...@apache.org>.
It's a combination of things in their Client.java:

1)  wout.write("<order 
xmlns=\"http://demo.order\"><name>Rajeev</name></order>r\n");

The "r" at the end is not escaped.  Thus, it's invalid content at the end of 
the XML stream.    

2) They aren't setting a Content-Type header, so the charset isn't being 
picked up properly and such.   Add:

httpCon.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");

With those changes and with the latest snapshot code (not sure if it works 
with the latest releases), the demo seems to work fine.

Dan



On Tue July 21 2009 3:08:37 pm nbreau wrote:
> When deploying the sample code found at the following article
>
> https://www.ibm.com/developerworks/webservices/library/ws-pojo-springcxf2/
>
> deployed to both tomcat 5.5 and tomcat 6, GET requests return successfully
> however POST and PUT requests fail with the following errors:
>
> I've tried both CFX 2.1 and 2.2.2 but both error out.
>
>
> ----------------------------------
> PUT Request in Tomcat 6 on Vista:
> ----------------------------------
>
> INFO: URIParameterInterceptor handle message on path [/endpointPut/custo
> mer01/endpoint/dfdf.vsvs.fw23s] with content-type [null]
> Jul 21, 2009 10:35:06 AM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: Unexpected EOF in prolog
>  at [row,col {unknown-source}]: [1,0]
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mer
> geParams(URIParameterInInterceptor.java:122)
>
>
> ----------------------------------
> PUT Request in Tomcat 5.5 in Ubuntu:
> ----------------------------------
>
> INFO: URIParameterInterceptor handle message on path
> [/EndpointPut/customer01/endpoint/dfdf.vsvs.fw23s] with content-type [null]
> 21-Jul-2009 10:29:34 AM org.apache.cxf.phase.PhaseInterceptorChain
> doIntercept
> INFO: Interceptor has thrown exception, unwinding now
> org.apache.cxf.interceptor.Fault: ParseError at [row,col]:[1,1]
> Message: Premature end of file.
>         at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.mergePara
>ms(URIParameterInInterceptor.java:122) at
> org.apache.cxf.binding.http.interceptor.URIParameterInInterceptor.handleMes
>sage(URIParameterInInterceptor.java:103) at
> org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChai
>n.java:236)

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog