• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

NEWBIE Q: How to parse an XML HTTP-POST request in servlets using JDOM?

 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a client that sends an XML to my server using a POST request. Now I want my server to be able access the XML document. I am using JDOM and this code in my servers doPost returns a HTTP response code 500, although I would have wanted it to parse the requested XML document.



Just in case you need it, I have included the code of the client, that sends the HTTP POST request:

 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually what we really need is a description of the problem. Read this: ItDoesntWorkIsUseless
 
Kasper Rasmussen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Paul Clapham wrote:Actually what we really need is a description of the problem. Read this: ItDoesntWorkIsUseless



Sry, post have been edited to help you help me :)
 
Paul Clapham
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm guessing that the part about HTTP response code 500 was inserted later?

Anyway response code 500 means that the server had an error. So that's all we know so far. Your task now is to find out what that error is. Normally the server would log these errors in a log file somewhere. When you find that file you will see an error message and a stack trace which tells you what went wrong.
 
Kasper Rasmussen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok think I have found the error message:



Seems that it cannot find my parser? I have only imported the jdom.jar, shouldn't that be enough?>.>

EDIT: I know that it says doGet in the error message although I use a doPost, but this was the only way I could find the error message - could not find it anywhere in my Tomcat server folder :/

EDIT2: Okay so the problem is that my server cannot find the jdom.jar because the library has to be located in the web-inf folder, but I cannot seem to get the jar-file copied to that location in eclipse =/
 
Paul Clapham
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Kasper Rasmussen wrote:Okay so the problem is that my server cannot find the jdom.jar because the library has to be located in the web-inf folder, but I cannot seem to get the jar-file copied to that location in eclipse =/


Yes, that's right, you've identified the problem. And as you see it isn't an XML problem at all. If you would like this post moved to the forum about Eclipse then just post a response here asking for that or send me a PM.
 
Kasper Rasmussen
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
No problem - I found a solution - just had to move the .jar to the Java EE Module Dependencies and now it works like a charm
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic