• 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

HTTP Post and XML

 
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am attempting to develop a servlet based application which services both SOAP (xml/http) and standard HTTP Posts. Tentatively, my approach is to convert the HTTP Post into an xml request (I get a buffered reader and convert the posted form parameter name value pairs into standard XML ) - however, I have problems with interpretation of the the posted buffer in some cases. I believe that I could deal with these special cases effectively if I had access to the code for request.getParameter ("parameterStringName"); Does anybody have information on this subject? It is disconcerting to think that the HTTP/HTML people missed out on using standard XML for the construction of the post buffer from an HTML form.
 
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I attempted the same but, ran into problems with the servlet runner itself. It was throwing parse exceptions before the servlet itself was activated. I overcame this by sending and recieving the XML as a 'file attachment' using multipart MIME.
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Carl,
It sounds like we attempted different things. Apparently, whatever you tried caused an exception in container processing before the servlet was activated. My problems come about in the service method of a running servlet. I have no problems associated with having a servlet's service method activated as a function of a standard HTTP/HTML form post.
 
Sheriff
Posts: 7001
6
Eclipse IDE Python C++ Debian Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is plenty of source code available for servlet containers. You can download the source for the reference servlet container "Tomcat" from http://jakarta.apache.org/ or the popular and efficient Resin from http://www.caucho.com/ . Either of these will include an implementation of getParameter(String).
The format of HTTP POST requests was decided long before XML was even proposed. It may be a bit clumsy, but it works, and for flat name/value pairs it's quite an efficient transfer format.
If you are extracting the parameter values in a servlet, why are you attempting to parse out your own parameters rather than just using the built in parameter parsing? It's trivial to make a loop which reads all the provided parameters and builds them into some other format.
 
John Davis
Ranch Hand
Posts: 189
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frank!
Perhaps I could learn from this to listen more carefully to what the sheriff says (than the bartender). You are very correct. I had not realized that processing all parameters regardless of name was non-trivial using the standard api. Thanks for the suggestion, I will follow it.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic