Hello.
I'm using JOpera for Eclipse to create a RESTful Web Services composition.
When I try POST for any resource, the process return me the message
"IOException: Server returned HTTP response code: 500 for URL:
http://localhost:8080/project/hospedagem/". So, I can't POST to the RESTful
Web Service.
What may be happening? Please give me some tips for I solve this problem.
Thank you for all!!!
Regards,
Rodrigo Pupe
More Information
Dear Rodrigo Pupe,
could you give more details about your problem? It would be great also to take a look at your .oml files you have been writing.
1. Are you trying to call a resource from a JOpera process with the HTTP adapter or are you trying to publish a resource from a process?
2. Can you post to the same resource
http://localhost:8080/project/hospedagem/
from a test client (like curl or Firefox Poster)
3. Is port 8080 used by Tomcat or by JOpera's embedded Web Server?
http://www.jopera.org/docs/help/jop_7.html#7.5 (last question of the section)
Best Regards,
JOpera Team
Re: More Information
Good Morning, JOpera Team.
Thank you for answer my e-mail.
Answering your questions, follow:
1- I'm trying to call a resource from a JOpera process with the HTTP Adapter;
2- When I try POST to the same resource from a test client (I'm using the REST Client Firefox Plugin), this problem doesn't happen.
3- My TomCat use 8080 port, and JOpera embedded Web Server use 8081 port;
Talking with a friend, he told me that the problem may be in the moment that send the XML to the resource request body. In JOpera, when I check the System Input Parameter body, the XML is OK.
The .oml file is attached. When you open the file, execute the process "TestPOST 1.0".
Thanks again!!!
Regards,
Rodrigo Pupe.
Content-Type
Hola Rodrigo Pupe,
your oml looks fine.
It can be that the server crashes because the Content-Type header is missing.
If you look into the PostSolicitaReservaHospedagem (HTTP Adapter) and open the "Advanced System Parameters" you can add the headers required by the server into the "headin" parameter.
For example:
headin
Content-Type: application/xml
You could check which headers are sent by the REST Client Firefox Plugin ("Content-Type: text/xml" could also be an option).
Let us know if this helps you fix the problem. You may also want to check the exception log of tomcat to see what kind of error is caused by the request coming from JOpera.
Best Regards,
JOpera Team
Re: Content-Type
Good Evening, JOpera Team.
I try setup "headin" Advanced System Parameter with the value "Content-Type: application/xml" but the problem continue. Also, I try use "Content-Type: text/xml", but I had the same result (error 500).
Do you have anymore tips?
The REST Adapter would be the best way in this case? If yes, How use it?
Thank for all help!!!
Best Regards,
Rodrigo Marques Pupe.
More Tips
Hi Rodrigo Marques Pupe,
sorry to hear that adding the header did not help.
well, you could try to add some logging statements in your server. Does your code gets called or does it stop before then? If your code runs, until when? What kind of error/exception do you find in tomcat's logs?
If all fails, would it be possible to send us a snapshot of the parts of the code that are running on your server? so that we can try to reproduce the problem.
The REST adapter is used to publish URIs from a process, where you can have tasks that are triggered by clients that send HTTP requests to JOpera, so it does not apply in this scenario.
Best Regards,
JOpera Team.
Charset was missing
Hola, JOpera Team.
Finally, I think I solved the problem.
I think that the problem was when I drop and create my database again. Also, I include, with the Content-Type parameter, the charset parameter in the headin System Advanced Parameter.
With all this, my process is OK.
Thank you for all help in my questions and problems.
God bless you forever!
Best regards,
Rodrigo Marques Pupe.