You are not logged in.
I'm using talend SE 5.1.1 deployed on debian server (virtual machine).
I have error code 500 when the REST service is called (error sent from trestrequest component).
My endpoint is http://ipaddress:8040/services/serviceO2/ (I don't have URI path (""), do i need it ?)
An external server send me a POST request (datas are similar than an xml) to the URL http://ipaddress:8040/services/serviceO2/
I succeed in retrieving data through php page via website on port 8040 (http://ipaddress:8040/services/serviceO2/index.php).
But it's simplier to play with XML through a talend service than through php and I get a wrong call error on the tRestRequest component which is error code 500.
I can't modify POST request because not me who send it so how to add by default content-type (application/xml) on my trestrequest component (maybe it's the probem) ?
Something wrong ?
Last edited by minchi (2012-06-28 09:07:11)
What is an actual exception that you are seeing ?
How do you set up the POST request mapping (in tRESTRequest component editor) ?
Perhaps attaching an exported job or few images would help us find the issue real fast
Last edited by sberyozkin (2012-06-28 18:35:26)
tSendmail<-tRestRequest ->tExtractXMLfield->tXMLmap -> tmySQLinput
error comes from tsendmail (if wrong call of tRestRequest)
configuration of tRestResquest is:
REST API mapping: res POST ""
the shema of trestrequest is body(document) and string(string)
Can you please attach an actual job ? It's tricky to advise without seeing what is actually happening.
I think you may need to add tRESTResponse with the status code only (200 for ex) for tSendEmail to get the confirmation but I'm not exactly sure.
Please find the screens of my job.
I notice that my tRestRequest component doesn't receive request with "text/xml" media type, it just accept "application/xml"
indeed my wadl (rest service description at http://ip:8040/services/serviceO2?_wadl) only contains:
how do i fix it ? (and add "text/xml" for example)
2012-06-29 10:34:02,925 | WARN | qtp2139633649-79 | JAXRSUtils | pache.cxf.jaxrs.utils.JAXRSUtils 409 | - - | No operation matching request path "/services/serviceO2/POST" is found, Relative Path: /, HTTP Method: POST, ContentType: text/xml, Accept: application/xml,. Please enable FINE/TRACE log level for more details.
Last edited by minchi (2012-06-29 10:45:18)
Yes, it is unfortunate that only application/xml is accepted.
Is there any way for you to get the client component to set Content-Type to "application/xml" as a workaround ?
The only other option is to modify the source of the java jet generator resource, to get "text/xml" added to the generated @Consumes() annotation ?
We will get it added by default, by in mean time these are the options, let me know please how you get on
*Update* : fixed on the trunk
Last edited by sberyozkin (2012-06-29 17:04:05)
> I don't understant your update *Update* : fixed on the trunk what do you mean ?
text/xml will be supported by default too in the next release
> And how to add this to the coponent ?
The better option is to make sure that the incoming request already contains
if that is not possible then consider manually updating
look for @Consumes and @Produces annotation and add "text/xml". I guess it is not something we should recommend users but you might want to try it for the sake of confirming tRESTRequest actually works
I did it but i always receive error 500, my url endpoint is http://ip:8040/services/serviceO2/, but i don't need URI path (it's "/" by default so request try to access http://ip:8040/services/serviceO2// which is a wrong url), so how can i fix it ?
By the way, according to the log, "No operation matching request path "/services/serviceO2/POST", you should have a
REST API mapping set up like this:
res POST "POST"
given that it's a POST request and the actual URI has "POST" at the end too.
However I'm still not sure where 500 is coming from, the match failure should result in 404, so having a job to experiment with will definitely help :-)