getting Status500 when i call HttpClient.executeMethod(Post)

Trying to call a webservice which has Basic Authetication. I am passing in the valid crediantials but some how getting status 500 at getExecuteMethod(). Does this mean call to the webservice successful?? Please help.. Its very urgent..
HttpClient client = new HttpClient();
			// pass our credentials to HttpClient, they will only be used for
			// authenticating to servers with realm "realm" on the host
			// "", to authenticate against
			// an arbitrary realm or host change the appropriate argument to null.
				new AuthScope(
				new UsernamePasswordCredentials(
			// create a GET method that reads a file over HTTPS, we're assuming
			// that this file requires basic authentication using the realm above.
			post = new PostMethod(url);
			RequestEntity entity = new StringRequestEntity(soapRequest);
			ILogger.ITimer t = getLogger().createTimer();
			//	timer.setAutoReset(true);
			status = client.executeMethod(post);
			 if (status != HttpStatus.SC_OK) {
			 	System.err.println("Method failed: " + post.getStatusLine());
Here is the log file info:
[7/14/09 21:19:56:206 EDT] 00000027 AuthChallenge I org.apache.commons.httpclient.auth.AuthChallengeProcessor selectAuthScheme basic authentication scheme selected
[7/14/09 21:19:56:503 EDT] 00000027 SystemOut     O executeMethod() = 0.469 seconds
[7/14/09 21:19:56:503 EDT] 00000027 SystemOut     O HTTP Status Code = 500
[7/14/09 21:19:56:519 EDT] 00000027 SystemOut     O Error occured when posting soap request.  HTTP status(500). and the exception is org.xml.sax.SAXParseException: Content is not allowed in prolog.

Open in new window

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I don't think getting 500 response code has to do with
(in)valid credentials. You get an error "Not Authorized"
when the credentials are not valid.
Mick BarryJava DeveloperCommented:
check the server logs, 500 indicates an error on the sertver
SubhachanduAuthor Commented:
Yes, I know i passed in valid credentials, but any idea why Status 500 is getting for executeMethod()??
CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

SubhachanduAuthor Commented:
I noticed in the logs, i am able to see this .. Why is this exception coming up??
Error occured when posting soap request.  HTTP status(500). and the exception is org.xml.sax.SAXParseException: Content is not allowed in prolog.
Mick BarryJava DeveloperCommented:
sounds like a problem reading xml
SubhachanduAuthor Commented:
does that mean my client is able to communicate the webservice and trying it read its xml??
Mick BarryJava DeveloperCommented:
no way to tell whats happening from what you have posted
SubhachanduAuthor Commented:
Do you want me post the SOAP request which i am passing in
RequestEntity entity = new StringRequestEntity(soapRequest);
> the exception is org.xml.sax.SAXParseException: Content
is not allowed in prolog.

This means that the XML you are sending to server doesn't
have valid syntax.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HttpClient, btw, is not the first choice for a web service client. While it can work as one afaik, you would be better off using something like Axis
SubhachanduAuthor Commented:
This helped to resolve the problem as i missed backslash to one of the tags used in my XML passing using HttpClient.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Languages and Standards

From novice to tech pro — start learning today.