#1 2012-06-28 09:04:35

minchi
Member
Registered: 1970-01-01
Posts: 43

tRestRequest component error

Hello,

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 ?

Regards

Last edited by minchi (2012-06-28 09:07:11)

Offline

#2 2012-06-28 18:32:35

sberyozkin
Talend team
Registered: 2011-02-17
Posts: 50

Re: tRestRequest component error

Hi

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
Cheers, Sergey

Last edited by sberyozkin (2012-06-28 18:35:26)

Offline

#3 2012-06-28 18:47:47

minchi
Member
Registered: 1970-01-01
Posts: 43

Re: tRestRequest component error

Hi,

tSendmail<-tRestRequest ->tExtractXMLfield->tXMLmap -> tmySQLinput

error comes from tsendmail (if wrong call of tRestRequest)

configuration of tRestResquest is:

endpoint:  http://ipaddress:8040/services/serviceO2/

REST API mapping:   res           POST            ""

the shema of trestrequest is body(document) and string(string)

Offline

#4 2012-06-28 19:49:27

sberyozkin
Talend team
Registered: 2011-02-17
Posts: 50

Re: tRestRequest component error

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.

Offline

#5 2012-06-29 09:41:35

minchi
Member
Registered: 1970-01-01
Posts: 43

Re: tRestRequest component error

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:

<representation mediaType="application/xml"/>
<representation mediaType="application/json"/>

how do i fix it ? (and add "text/xml" for example)


log:

Code:

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.

Uploaded Images

Last edited by minchi (2012-06-29 10:45:18)

Offline

#6 2012-06-29 16:08:35

sberyozkin
Talend team
Registered: 2011-02-17
Posts: 50

Re: tRestRequest component error

Hi

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

Cheers, Sergey

Last edited by sberyozkin (2012-06-29 17:04:05)

Offline

#7 2012-06-29 17:16:29

minchi
Member
Registered: 1970-01-01
Posts: 43

Re: tRestRequest component error

I don't understant your update *Update* : fixed on the trunk what do you mean ?

And how to add this to the coponent ?

Last edited by minchi (2012-06-29 18:01:28)

Offline

#8 2012-06-29 18:59:23

sberyozkin
Talend team
Registered: 2011-02-17
Posts: 50

Re: tRestRequest component error

> 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

Content-Type: application/xml

instead of

Content-Type: text/xml

if that is not possible then consider manually updating

org.talend.designer.esb.components.rs.provider/src/main/resources/additional/header_additional_talendesb_rest.javajet

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

Offline

#9 2012-06-30 14:31:01

minchi
Member
Registered: 1970-01-01
Posts: 43

Re: tRestRequest component error

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 ?
Many thanks

Offline

#10 2012-07-03 09:51:02

minchi
Member
Registered: 1970-01-01
Posts: 43

Re: tRestRequest component error

Or maybe it is possible to add a content-type by default in the tRestRequest component ?

Offline

#11 2012-07-04 12:52:40

sberyozkin
Talend team
Registered: 2011-02-17
Posts: 50

Re: tRestRequest component error

Hi, sorry for a delay,

Can you export the job and attach here ? I can experiment, otherwise I've no idea where 500 is coming from.

Offline

#12 2012-07-04 12:58:06

sberyozkin
Talend team
Registered: 2011-02-17
Posts: 50

Re: tRestRequest component error

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

Offline

Board footer

Powered by FluxBB