Adding Web Reference to a secure http web service - c#

I have a WCF client from which i am supposed to communicate to a thirdparty web service whose url and wsdl is disclosed.The third party WebService(.asmx) uses https. All I am doing is trying to add service reference from my dev environment ,but unable to succeed.So i went ahead and used SOAPUI to test the service where i am able to fire a request and got a response.
Is it not possible in VS2010 to add the service reference in order to access the metadata of a HTTPS web service ? Since this is the first time I am using HTTPS ,i would be glad if some one can guide me the right way ?

#Aron :I tried to get the same by using a web browser and i selected proceed anyway option then it takes me to the WSDL page.
I will assume that you are running your development server on your local dev machine. You should check the actual address that the IIS server is setup for. Open up the page in your web browser. You will have a page that asks you if you want to proceed anyway, DONT.
View server certificate.
Here is the GMail certificate. Notice the "issued to:". This means that the certificate is only for https://mail.google.com. If another server tried to use it for another address you would have the same error.
So you want to use whatever is in there as your https://{my issued to}/Webservice.asmx

Related

403 Forbidden Error when calling Web Api over SSL

I have a standard C# Web Api running on IIS that has a custom AuthorizeAttribute to properly authorize calls via a key in the request header variables. Recently, one of my clients calls to the API over SSL have started to fail with an 403 Forbidden error. He is successful when calling the non-SSL url.
The same call - same url, api key etc. works perfectly over SSL from my machine, and none of my other clients are having any issues with this. What could possibly be the issue for this specific client? I have checked some basic things like his client machine time settings etc. are all in order, not sure if this could be some kind of certificate related issue?
try the following:
1- check the proxy on his machine
2- since SSL is used to protect data and safety the data should not change in the way on the server. it could be changed by a virus on the machine (I have the same problem with one of my clients) make sure his system is clean
3- consider calling the API in other ways like (postman, browser, ...)
according to what you write clearly, there is something wrong with his machine. if you find the problem It would be nice to tell me too

How to check webservice(endpoint) is available from a particular server(not local)

I wanted to check whether a webservice(endpoint)(.svc) is available from a particular web server.
For ex: The webserver www.test123.com is able to access the endpoint **
htp://www.abc.com/ecl/CustomHistory.svc
If not PS as robdy states, see this answer...
Is it possible to test a webservice using just an endpoint and XML code using SOAPUI Pro tool?
Your web server is a physical or virtual machine where you can login in remotely.
Log-in to the server and browse the svc url from that machine web browser.

Hosts Redirect 400 Error Web Page Cannot be Found

I'm trying to test my application against the OAuth Microsoft Account Login.
I have added the following to my hosts file
127.0.0.1 testdomain.co.uk
My application is running over https so when I run the app it runs as follows;
https://localhost:44308/home
Now when I hack the url to be
https://testdomain.co.uk:44308/home
I get the certificate warning (which is to be expected). However, when I click continue to site, i get a 400 Web Page cannot be found error?
Any ideas on what i am doing wrong here?
You need to tell your web server that it should handle the testdomain.co.uk for this project. Your web server (IIS Express) does not know it, as by default it is set to handle "localhost" host only. How to change that is described here: https://stackoverflow.com/a/32365556/3835864

Webservice URL appends port when adding a reference in my application

I have developed a simple .asmx webservice and hosted it on my server. The local machine url of the service is http://192.168.1.34:1115/webservices/verify.asmx.
I have given this a public IP so we can access it from anywhere like http://104.32.43.21/webservices/verify.asmx
when I hit the public url from my browser it works fine and the service page shown.
But when I try to add a reference of this service in my asp.net application, the port number 1115 gets appended to the service url and it shows an error in downloading the wsdl file from the server saying unable to resolve the host.
can someone tell me what is happening here and how can I access the webservice.
Thanks
There was problem in the way I was trying to add the service reference to my application. When ever adding an ASMX service reference add it with appending ?wsdl at the last of the service URL.
For my case it should have been like: http://104.32.43.21/webservices/verify.asmx?wsdl.

CredentialCache with IIS vs personal development server

I have a webservice that I am testing. When I use the personal asp.net webserver, the one with the random port everything works fine. It uses my credentials when I pass DefaultCredentials to an ssrs server to run a report.
When I tried to move it to my local IIS server, the DefualtCredentials UserName is blank and the ID that gets pass to the SSRS server is ASPNET.
I turned off Annon access and only Integrated Windows Authentication is on.
My local IIS is 5.1, so it doesn't have application pools as a separate object.
In the web.config authentication is set
<authentication mode="Windows" />
Thanks in advance.
UPDATE
I do have the
<identity impersonate="true" />
now, but my problem is trickier then originally stated.
The outer webservice calls SSRS webservice and now it works fine in the browser.
But when I call the outer webservice from within SSIS, it does not work, when I step through the code the call to the outer webservice occurs but when I make the call to SSRS i get a 401 Authentication error.
I have valid credentials in the HTTP Manager. I have the package protection level at EncryptSensitiveWithUserKey.
Again if I call the outer webservice from a personal ASP.net webserver, even the SSIS works fine. I just have to download the wsdl every time because the port changes and then I have to re-setup the webservice task. I am concern when I go to production.
(I have yet to run a test from code to see how the webservice acts)
UPDATE 2
Again the webservice works in IE, but not in SSIS nor Firefox even when I supply my credentials when I hit the webservice
I know I am getting authenticated properly because
User.Identity.Name
returns my login name in the webservice, but when I assign defaultCredentials to the reporting service service it still gives me 401 error. I even tried to impersonate the log in that I was logged in as
Dim win As System.Security.Principal.WindowsIdentity = CType(User.Identity, System.Security.Principal.WindowsIdentity)
Dim context As System.Security.Principal.WindowsImpersonationContext = win.Impersonate()
reportService.Credentials = System.Net.CredentialCache.DefaultCredentials
This is the answer I received from Microsoft.
It was my pleasure to discuss your issue over the phone littler earlier. As I was saying that HTTP connection manager does not support Windows Authentication, please have a look at the article at: http://msdn.microsoft.com/en-us/library/ms140114.aspx
Important
The HTTP connection manager supports only anonymous authentication and basic
authentication. It does not support Windows Authentication.
So, at this point using Script Task to call the Web Services would be an option, however you mentioned that there will be a challenge of moving the package to QA to UAT etc. I agree with you that managing the URL in the proxy class is a challenge.
Please let me know if you have further questions.
Now even this is not true because I showed the gentleman from Microsoft that our web service did require Windows Authentication but what is not working is known as the “double-hop”. That is the credentials do not get passed to the SSRS server.

Categories