473,379 Members | 1,187 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

How to pass the authentication in http header in .net while consuming Java web servic

I am programming what is to be a web service client that will use an
HTTP-POST to request and retrieve data. The remote server (written in java
for what it's worth) requires basic authentication as per RFC 2617
(http://www.faqs.org/rfcs/rfc2617.html). My attempts to authenticate are
failing. The server requires the header to be present with the request.
For security reasons, it will not reply in any way if the header is not
present.

i need a code in .net which consume Java web services that pass basic authentication as per RFC 2617 (http://www.faqs.org/rfcs/rfc2617.html).means basic authentication is required in header for every request. Please help me for the code .

Code is:

request = (HttpWebRequest) WebRequest.Create(SomeURI);

request.PreAuthenticate = true;
request.Credentials = new NetworkCredential("rts","rts");

request.Timeout = 30 * 1000;
request.Method = "POST";
request.ContentType = "application/x-www-form-urlencoded";
request.ContentLength = reqBytes.Length;

Stream reqStream = request
reqStream.Write(reqBytes,0,reqBytes.Length);
reqStream.Close();


This code doesn't pass the header authentication

Thanks
Mar 23 '10 #1
2 2719
tlhintoq
3,525 Expert 2GB
Rather than ask someone else to code it for you...

You say you have been working on this, but it is failing. Please provide your code for authentication along with the errors you are receiving and someone here should be able to help point out where you have gone awry.
Mar 23 '10 #2
this is my code but no header is passed

Expand|Select|Wrap|Line Numbers
  1. request = (HttpWebRequest) WebRequest.Create(SomeURI);
  2.  
  3. request.PreAuthenticate = true;
  4. request.Credentials = new NetworkCredential("JoeBlow","MountainHo");
  5.  
  6. request.Timeout = 20 * 1000;
  7. request.Method = "POST";
  8. request.ContentType = "application/x-www-form-urlencoded";
  9. request.ContentLength = reqBytes.Length;
  10.  
  11. Stream reqStream = request
  12. reqStream.Write(reqBytes,0,reqBytes.Length);
  13. reqStream.Close();
Mar 23 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: HH | last post by:
I'm learning to design web applications with php, mysql, and apache from a book. I copied a sample application called guestbook 2000 that came with the CD in the book to my htdocs folder, but...
8
by: Ollie | last post by:
I have a requirement for a company intranet where they want to use a single sign-on with their windows 2003 domain (AD) so I was thinking of using windows authentication in the asp.net application...
2
by: code | last post by:
Hi, I have stumbled across an interesting problem regarding forms authentication over multiple sub domains. The topic has been covered in various forms online but never really gets a definitive...
13
by: Pete | last post by:
I'm cross posting from mscom.webservices.general as I have received no answer there: There has been a number of recent posts requesting how to satisfactorily enable BASIC authorization at the...
3
by: Patrick Fogarty | last post by:
I am programming what is to be a web service client that will use an HTTP-POST to request and retrieve data. The remote server (written in java for what it's worth) requires basic authentication...
1
by: Stu | last post by:
Hi, Im using vis studio 2003 and I think wse is out of the question as clients could be using java which doesnt support it. So I managed to find some code which allows you to develop a custom...
1
by: bugnthecode | last post by:
Hi, I am trying to put together a small app that uses one of my company's web service. Originally I interfaced with this web service using java, and have the example code. I believe the web...
1
by: =?Utf-8?B?RGFtaXIgRGV6ZWxqaW4=?= | last post by:
Hi. I have to implement an Java Axis2 web service client in .NET WCF as well a web service to witch a Java Axis2 client will connect. I would like to provide user identification using...
0
by: Tom | last post by:
Hi, I need to connect to a SOAP web service (Java server) that requires basic HTTP authentication over HTTP (not HTTPS). I've tried the following setup: <security...
2
by: ramprakashjava | last post by:
sorry still that error exist , how to avoid this deprecated method overriding in my netbeans ! In Bundled tomcat log it shows Dec 30, 2009 9:03:45 PM...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.