• 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

Exact same request works in browser but not in my app!!!

 
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello all, I have an application that posts requests through an https connection to a web server. When everything goes well, the server is supposed to send me an xml file. Once my String is encoded and ready to be sent, it looks something like this:


InputSegments=%3c%3fxml+version%3d%221.0%22+encoding%3d%22UTF-8%22%3f%3e%3cCNCustTransmitToEfx+



So when I send it, I receive an error from the server saying that the request is incorrect. But when I copy paste the request String to the browser, it works great!!! So I can't figure out what is wrong here... I am posting my function hoping that somebody will be able to help me:




Your help will be greatly appreciated!

Alex

[ UD: added code tags ]
[ January 20, 2006: Message edited by: Ulf Dittmer ]
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This looks more like an I/O question; I'll move the thread to the I/O and Streams forum. Please find it there, and continue the discussion.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Using the browser issues a GET request, while your code issues a POST. Maybe the server doesn't accept POSTs?
 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
just wanted to point out



your securedUrl variable is not initialised to any value....

could this be a problem???
 
Alexandre Folgueras
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you all for your replys, it is very appreciated!

First, I've tried to set the method to GET, but it still does not work... Second, for the securedURL variable that does not seem to be instantiated, it actually is, the method is part of a thread and all necessary variables were initialized before starting the thread...

The requests actually "talks" to the server because I'm able to read the error message the server gives me on the BufferedReader. It says ( Invalid input segments". The company who owns the server cannot offer me any support, but they told me that if I get this error, it's that I am not posting the request correctly ( the error is not the content of the request but the way I send it )

If you guys have anymore ideas, it would be greatly appreciated!

Thank you,
Alex
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might try not encoding your request. That encoding is just for URLs, but if you're posting XML, you should send ">", "<", " " etc. unchanged.
 
Alexandre Folgueras
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The server's doc actually says that I must encode the data, including the XML. But after reading your post, I tried not to encode it but it still does not work...

But if I copy the exact same encoded String that I am sending to the OutputStreamWriter and send it to the browser, it works!

Anymore ideas?

Thank you!!!
 
Marshal
Posts: 28271
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
You might try a product like Jakarta Commons HttpClient, which takes care of details that you and I probably don't even know about.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic