473,378 Members | 1,309 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,378 software developers and data experts.

Calling web service from asp.net page fails

Jon
Hi all,

I'm trying to call a web service from an asp.net (v1.1) page written in C#
(the web service was written in C# too) and I keep getting a "The request
failed with HTTP status 401: Unauthorized. " error message. Calling the web
service works fine when I create a windows form application to call it. The
IIS is on a win2003 server and it is configured to use "Integrated
Authentication".

The IIS logs do not show a userid from the asp.net call to the webservice,
they do show a userid from the windows form app. I suspect that this is the
issue.

The first portion of the stack trace is
"System.Web.Services.Protocols.SoapHttpClientProto col.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean asyncCall) at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)" ... the rest is the lines within my .net
application.

I have added CredentialCache.DefaultCredentials() and then tried it. I have
also tried supplying user/pwd/domain with the same error results.

Does anybody have any ideas as to what may be causing this and how to
resolved it? Any ideas on what parameters to use/fill that I am not?

The relevant part of my code is:

mxService mxAs = new mxService();
mxAs.Url = _webServer + _serviceUrl;
CredentialCache crCache = new CredentialCache();
NetworkCredential netCr = new NetworkCredential();
netCr.Domain = "ourDomain";
netCr.UserName = "user1";
netCr.Password = "123";

crCache.Add(new Uri(mxAs.Url), "Negotiate", netCr );
mxAs.Credentials = crCache;
string listings = mxAs.getListings("News","Approved"); // 401 - Not
Authorized here...

Thanks & regards
Jon
May 16 '06 #1
2 1556
I wonder if it's the aspnet account which is trying to make the call and
that's why it's failing? Just a guess...

"Jon" <Jo*@discussions.microsoft.com> wrote in message
news:AD**********************************@microsof t.com...
Hi all,

I'm trying to call a web service from an asp.net (v1.1) page written in C#
(the web service was written in C# too) and I keep getting a "The request
failed with HTTP status 401: Unauthorized. " error message. Calling the web service works fine when I create a windows form application to call it. The IIS is on a win2003 server and it is configured to use "Integrated
Authentication".

The IIS logs do not show a userid from the asp.net call to the webservice,
they do show a userid from the windows form app. I suspect that this is the issue.

The first portion of the stack trace is
"System.Web.Services.Protocols.SoapHttpClientProto col.ReadResponse(SoapClien
tMessage message, WebResponse response, Stream responseStream, Boolean asyncCall) at System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)" ... the rest is the lines within my .net
application.

I have added CredentialCache.DefaultCredentials() and then tried it. I have also tried supplying user/pwd/domain with the same error results.

Does anybody have any ideas as to what may be causing this and how to
resolved it? Any ideas on what parameters to use/fill that I am not?

The relevant part of my code is:

mxService mxAs = new mxService();
mxAs.Url = _webServer + _serviceUrl;
CredentialCache crCache = new CredentialCache();
NetworkCredential netCr = new NetworkCredential();
netCr.Domain = "ourDomain";
netCr.UserName = "user1";
netCr.Password = "123";

crCache.Add(new Uri(mxAs.Url), "Negotiate", netCr );
mxAs.Credentials = crCache;
string listings = mxAs.getListings("News","Approved"); // 401 - Not Authorized here...

Thanks & regards
Jon

May 18 '06 #2
Jon
Thank's Paul,

The server that is hosting the web service is using "Windows"
authentication and when I added in "Basic" authentication it works
fine. What I am wondering is if this is a case of to many 'hops' or a
quick pass through of the firewall rules within our network. I will
now need to discuss this with our network people to determine if this
is an acceptable way to go.

Thanks & regards
Jon

May 18 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

17
by: Patrick | last post by:
I am almost certain that I could use HTTP Post/Get to submit XML Web Service call (over SSL as well, if using Version 3 of MSXML2) from an ASP Application? However, would I only be able to call...
1
by: Eugen Frunza | last post by:
http://support.microsoft.com/?kbid=823684 A service that makes a call to the SetProcessWorkingSetSize function fails in Windows Server 2003 and Windows 2000 Server. SYMPTOMS When a service...
5
by: Nick Flandry | last post by:
I'm running into an Invalid Cast Exception on an ASP.NET application that runs fine in my development environment (Win2K server running IIS 5) and a test environment (also Win2K server running IIS...
0
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. ...
3
by: Mike | last post by:
Timeout Calling Web Service I am calling a .NET 1.1 web service from an aspx page. The web service can take several minutes to complete its tasks before returning a message to the aspx page. ...
7
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
5
by: Nate | last post by:
We are attempting to make a request to a web service (we will refer to it as XXXServices) hosted on a Web Logic server from a C# SOAP client. The server responds with a 401 Unauthorized error...
1
by: ananth | last post by:
Hi All, I have a web service created in Notes Database and i am calling the web service in Visual studio.Net application by adding a web reference. I need to have authentication...
7
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
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: 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:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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.