Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Java > Java and JDK > Servlets
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Servlets section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old March 13th, 2006, 02:26 PM
Registered User
Join Date: Mar 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending XML via http post, using servlet

Hey I am hopeing someone may be able to help. I am trying to send and xml stream via http post. I am using a servlet using goPost. The server I am sending the request to will return with a response as long as the stream is sent via http post, as of right now I am getting an error from the remote server saying im not sending the xml stream via post.

my imports are :

import java.io.*;
import java.net.*;

import javax.servlet.*;
import javax.servlet.http.*;


throws ServletException, IOException {

and using goPost:

protected void doPost(HttpServletRequest request, HttpServletResponse response)

whats included in the xml stream is a simple domain search, when a client types in a domain search on my website the servlet grabs that info and sends it to the remote server via sendRedirect basically temp files.. here is where the xml doc is being sent to:


Maybe somewhere there I need make another POST call.. not sure..

Can someone send me in the right direction please, I would certainly appriciate it. If you need more info let me know. I am not exactly an expert when it comes to servlets, or java for that fact, I am a student, and able to understand most things, just be nice to me if I dont sound like i know what im doing. :)

Corey C
Old March 14th, 2006, 07:03 PM
Registered User
Join Date: Mar 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts

Be carefull !
You're missing some concepts
1) sendRedirect tell the client to call the new link
2) anyway http://pirin.names4ever.com/TestXAPI....exe?something is never a post

You need wrapping the request opening an url (java.net.*) from the servlet, do everythind you need, then send a response to the client.

Hope it's usefull enough

Ivan Rosina

Similar Threads
Thread Thread Starter Forum Replies Last Post
HTTP post silver_scar C# 2005 0 July 31st, 2006 09:52 AM
HTTP POST/GET d_alchemist JSP Basics 1 April 24th, 2006 09:18 AM
XML HTTP Post acdsky Servlets 2 June 2nd, 2005 10:59 AM
Servlet & HTTP Parsing lian_a Servlets 0 April 30th, 2004 01:57 AM
Single HTTP POST - Multiple XML docs denniswong288 XML 1 August 26th, 2003 05:05 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.