473,503 Members | 1,804 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Http 401 Unauthorised

I currently have a web service set that returns data. When I use these
services through a browser, everything works fine and the resulting xml
is displayed. However sometimes when I connect to the scripts using a
php script I get the error message Http 401: Unauthorised. This usually
happens after a short time, when the webservices have not been used. I
am connecting to the webservices using Http Post and cURL.

Oct 4 '06 #1
2 3110
In Addition the actual error message is

A SoapException occurred: Message: The request failed with HTTP status
401: Unauthorized. Exception: System.Net.WebException: The request
failed with HTTP status 401: Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)
at CRMWebService.CRMWebService.CrmService.Execute(Req uest Request)
in \\MYCOMPUTER\\wwwroot\CRMWebService\Web
References\CRMWebService\Reference.cs:line 48
at CRMWebService.GetMultipleEntities.GetData(String[] fieldsToGet)
in \\mycomputer\\wwwroot\crmwebservice\getmultipleent ities.cs:line 48

the Code this error refers to is actually Visual C# but is pretty
normal.
I just cant work out why sometimes it works and sometimes not
Iain Adams wrote:
I currently have a web service set that returns data. When I use these
services through a browser, everything works fine and the resulting xml
is displayed. However sometimes when I connect to the scripts using a
php script I get the error message Http 401: Unauthorised. This usually
happens after a short time, when the webservices have not been used. I
am connecting to the webservices using Http Post and cURL.
Oct 4 '06 #2
Iain Adams wrote:
In Addition the actual error message is

A SoapException occurred: Message: The request failed with HTTP status
401: Unauthorized. Exception: System.Net.WebException: The request
failed with HTTP status 401: Unauthorized.
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.ReadResponse(SoapClientMessage
message, WebResponse response, Stream responseStream, Boolean
asyncCall)
at
System.Web.Services.Protocols.SoapHttpClientProtoc ol.Invoke(String
methodName, Object[] parameters)
at CRMWebService.CRMWebService.CrmService.Execute(Req uest Request)
in \\MYCOMPUTER\\wwwroot\CRMWebService\Web
References\CRMWebService\Reference.cs:line 48
at CRMWebService.GetMultipleEntities.GetData(String[] fieldsToGet)
in \\mycomputer\\wwwroot\crmwebservice\getmultipleent ities.cs:line 48

the Code this error refers to is actually Visual C# but is pretty
normal.
I just cant work out why sometimes it works and sometimes not
Iain Adams wrote:
>>I currently have a web service set that returns data. When I use these
services through a browser, everything works fine and the resulting xml
is displayed. However sometimes when I connect to the scripts using a
php script I get the error message Http 401: Unauthorised. This usually
happens after a short time, when the webservices have not been used. I
am connecting to the webservices using Http Post and cURL.

Evidently the resource you're trying to access requires authorization.
The 401 is a normal message from the server requesting your userid and
password.

Browsers handle this automatically. If this is the first 401 this site
has sent while the browser has been running, it will pop up the
userid/password box on your screen. It remembers this information for
the specific site, and on the next 401 sends it automatically (if it is
rejected this time, the browser pops the userid/password box again).

I don't know how the remote site tracks this information. Some do it
with sessions, some by tracking the remote ip, etc. And most have a
timeout involved.

If you've already retrieved some information, chances are the
authorization has timed out and the system wants to reauthorize you.
Check out the curl option CURLOPT_USERPWD.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================
Oct 4 '06 #3

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

Similar topics

7
9262
by: Michael Foord | last post by:
#!/usr/bin/python -u # 15-09-04 # v1.0.0 # auth_example.py # A simple script manually demonstrating basic authentication. # Copyright Michael Foord # Free to use, modify and relicense. #...
8
10625
by: turnit \(removethis\) | last post by:
I have a login form that uses the post method to carry the information to the next page. The form works just fine in ie6.0, but fails in mozilla and fails in ie5.2 on a mac. "HTTP/1.1 400 Bad...
3
5389
by: ashesdesign | last post by:
Hi All, I am very new to php and even newer to XML. Can anyone please shed some light on how to post XML requests via HTTP. I have been searching high and low and have come across many...
4
3576
by: TrinityPete | last post by:
Hi all, We have a web application that uses web services for data access and retrieval. The web app and web services reside under IIS on the same server(WIN2003). The virtual directories have...
5
10376
by: David Lozzi | last post by:
Howdy, I wrote a web service in .Net for my customer. My customer has another vendor who now has to consume it but they are not using Visual Studio. Most of their pages are jsp, and they said...
4
2460
by: Bob Badger | last post by:
Hi, Simple question (although I guess with a complicated answer). Is HTTP an async protocol? For instance, if I send a message to a c# webservice via http what is the protocol actually doing? ...
0
3211
by: smlchris | last post by:
I am able to visit the website home page. But when I tried to login to a website that required me to key in user id and password. (We got the user id and password from the supplier) I received the...
1
4068
by: smlchris | last post by:
I have encountered the following error message when I tried to login to website (though they have provided us the user id and password). You are not authorised to view this page. HTTP Error...
2
2185
nirmalsingh
by: nirmalsingh | last post by:
hai all, i have created a website in asp.net c#. when i created a virtual directory and try ti run it i get the following error, You are unauthorised to view this page. How to resolve this? Thanx...
0
7076
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6984
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5576
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5005
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4670
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3162
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3151
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1507
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
377
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.