You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by kusandriadi <ka...@gmail.com> on 2013/02/21 11:27:01 UTC

couldnt send XML via HTTP POST using cxf in servicemix 4.5

i have used smx since 3.3, now we have a plan to upgrade to smx 4.5. (yes,
because it is support java7). we want to add something like REST feature in
our app.

currently as we know, if we want to used cxf integration with camel, we just
have to adding dependency camel-cxf, camel-core, etc.

I have made a simple application that provide a uri with GET and POST method
without problem.
but i have a problem when try to send XML to POST method.

the jaxb entity :


i have interface service like :


and the implemenntation :


I wonder what @Consumes type that i have to use, but since I using POST
method, I am sure that MediaType.APPLICATION_FORM_URLENCODED is the right
choice (I have try MediaType.APPLICATION_XML) too.



I have try to add <?xml version "1.0" encoding="UTF-8"?> but still no luck.



strange, because i have also followed and read example here 
http://jersey.java.net/nonav/documentation/latest/xml.html
<http://jersey.java.net/nonav/documentation/latest/xml.html>   and implement
it in sms 4.5 with camel 2.10.3..but still not work.
any idea to solve my problem? 

thanks



--
View this message in context: http://servicemix.396122.n5.nabble.com/couldnt-send-XML-via-HTTP-POST-using-cxf-in-servicemix-4-5-tp5715865.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: couldnt send XML via HTTP POST using cxf in servicemix 4.5

Posted by kusandriadi <ka...@gmail.com>.

I installed camel-jaxb in my smx, then i don't get those stack error anymore
(i dont know that really the problem or no because after that i did some
action but i forget)

now, i get following error when hit the POST method.



I wonder why camel-cxf couldnt parse my xml to object automatically. I look
some clue here http://camel.apache.org/jaxb.html and changed my routebuilder
implementation.





any clue about this? 

thanks :)



--
View this message in context: http://servicemix.396122.n5.nabble.com/couldnt-send-XML-via-HTTP-POST-using-cxf-in-servicemix-4-5-tp5715865p5715869.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Re: couldnt send XML via HTTP POST using cxf in servicemix 4.5

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

The error here
Caused by: java.lang.IllegalStateException: The bundle is uninstalled.
	at org.apache.felix.framework.Felix.getBundleResource(Felix.java:1473)
	at org.apache.felix.framework.BundleImpl.getResource(BundleImpl.java:611)
is interesting,  seems some bundle status isn't correct, could you please post "osgi:list"?
-------------
Freeman(Yue) Fang

Red Hat, Inc. 
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: @Freeman小屋

On 2013-2-21, at 下午6:27, kusandriadi wrote:

> i have used smx since 3.3, now we have a plan to upgrade to smx 4.5. (yes,
> because it is support java7). we want to add something like REST feature in
> our app.
> 
> currently as we know, if we want to used cxf integration with camel, we just
> have to adding dependency camel-cxf, camel-core, etc.
> 
> I have made a simple application that provide a uri with GET and POST method
> without problem.
> but i have a problem when try to send XML to POST method.
> 
> the jaxb entity :
> 
> 
> i have interface service like :
> 
> 
> and the implemenntation :
> 
> 
> I wonder what @Consumes type that i have to use, but since I using POST
> method, I am sure that MediaType.APPLICATION_FORM_URLENCODED is the right
> choice (I have try MediaType.APPLICATION_XML) too.
> 
> 
> 
> I have try to add <?xml version "1.0" encoding="UTF-8"?> but still no luck.
> 
> 
> 
> strange, because i have also followed and read example here 
> http://jersey.java.net/nonav/documentation/latest/xml.html
> <http://jersey.java.net/nonav/documentation/latest/xml.html>   and implement
> it in sms 4.5 with camel 2.10.3..but still not work.
> any idea to solve my problem? 
> 
> thanks
> 
> 
> 
> --
> View this message in context: http://servicemix.396122.n5.nabble.com/couldnt-send-XML-via-HTTP-POST-using-cxf-in-servicemix-4-5-tp5715865.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: couldnt send XML via HTTP POST using cxf in servicemix 4.5

Posted by kusandriadi <ka...@gmail.com>.
this post was resolved. honestly, using jaxb in osgi is little tricky. :D

thanks



--
View this message in context: http://servicemix.396122.n5.nabble.com/couldnt-send-XML-via-HTTP-POST-using-cxf-in-servicemix-4-5-tp5715865p5715960.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.