WCF Test client and authentication - wcf

I'm trying to call a webservice with WCF Test Client but the webservice requires authentication.
How do I log on and call it by WCF Test Client (I tried to get it from browsers and then to call but does not work). I could use SOAP UI, but I'd like to do it with WCF Test Client if is possible. Maybe changing WCF config?
Error: Cannot obtain Metadata from If this is a Windows (R)
Communication Foundation service to which you have access, please
check that you have enabled metadata publishing at the specified
address. For help enabling metadata publishing, please refer to the
MSDN documentation at
http://go.microsoft.com/fwlink/?LinkId=65455.WS-Metadata Exchange
Error URI: Metadata contains a reference that cannot be
resolved: ''. The HTTP request is unauthorized with client
authentication scheme 'Anonymous'. The authentication header received
from the server was 'Basic realm=""'. The remote server
returned an error: (401) Unauthorized.HTTP GET Error URI:
There was an error downloading ''. The request failed with
HTTP status 401: Unauthorized.

Do you have a mex endpoint specified in your config?
If you're having setup issues I'd suggest reading through the Codeplex applications scenarios to ensure you have setup your service and WCF Test Client properly.
Please post configs and some sample code if you require any further help.
EDIT:
These links may provide some insight in to the issue:
WCF - Cannot obtain Metadata, but works when the XML Endpoint is removed?
Cannot obtain Metadata from WCF service when using Microsoft WCF Test Client.

Related

Akana API gateway is not working for secured SOAP services

In Akana API Gateway, I am trying to setup a Proxy API for invoking SOAP service which is Secured(BASIC Authentication). When I tried to invoke the Proxy API from Test Client, it is not invoking the Target service.
It is showing the 503 service unavailable Error. However, It is working fine when I invoke the target service from SOAP UI.(I passed BASIC Authentication credential in SOAP UI)
I even tried, invoking the Proxy API from SOAP UI and passed the BASIC Authentication credential. Still I get the same error. ie., 503 service unavailable Error
Here is the error details
Cause: Binding component error encountered. HTTP Error [503:Service Unavailable] when accessing the URI [http://url]
Could any one please help.
I managed to resolve this issue.
It was due to the incorrect Protocol. The WSDL URL is HTTPS. After importing the WSDL, the auto generated operation endpoint has HTTP.
After modifying the endpoint URL manually from HTTP to HTTPs, it worked.

How can my UWP app authenticate with a WCF service?

I'm writing an UWP app in C#, and I'm trying to have it consume data from a (pre-existing) WCF service. I can't find any information online on the subject. Here is what my code looks like (WCF service is Serv, service namespace is Ns):
var config = Ns.ServClient.EndpointConfiguration.BasicHttpBinding_IServ;
var client = new Ns.ServClient(config);
var result = client.TestCall();
I get the following exception, which I don't understand how to parse:
Exception thrown:
'System.ServiceModel.Security.MessageSecurityException' in
mscorlib.ni.dll
Additional information: The HTTP request is unauthorized with client
authentication scheme 'Negotiate'. The authentication header received
from the server was 'Negotiate, NTLM'.
What does this error message mean? And how do I successfully authenticate with the WCF service?
Bonus question: what is the ServiceReferences.Designer.ClientConfig file? How do I use it?
I opened the Package.appxmanifest file and added the Enterprise Authentication and Private Networks (Client & Server) capabilities. This fixed the issue.

HTTP Errors while consuming non-WCF Web Service using a WCF Client

I am trying to consume a third party web service, which is developed not in .NET but in some other langauge (may be in Java). I am trying to consume the service from WCF Client. But while adding Service reference it is throwing a error:
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'basic realm="EXTRACT-CREDENTIAL"'.
Also when I am hitting the service URL in a browser it's throwing an error as follows:
HTTP GET Requests are not supported by the broker. Please use HTTP POST instead
What could be the way to consume the service from WCF client?

Silverlight WCF Service to Service calls

Question:
Are there known issues making calls to a service that calls another service from Silverlight?
Scenario:
I have the following 3 projects:
SilverlightClient - Silverlight project with a Button
SilverlightClient.Web - A web application that hosts the SilverlightClient.xap.
BackEnd - A different web application that hosts the FOO Service which does some special backend processing.
I have created a Silverlight WCF-Enabled web service in both SilverlightClient.Web and Backend. These are respectively SilverlightClientService and BackEndService.
From SilverlightClient.Web I add a service reference to BackEndService. I have a test ASPX page that I've written code that calls BackEndService successfully.
From SilverlightClient I add a service reference to SilverlightClient.Web's SilverlightClientService. If my SilverlightClientService returns plain data, such as a string, it works quite well.
The moment, however, that I change SilverlightClientService to call BackEndService, I get the following exception:
HTTP 415 - "The request failed with HTTP status 415: Unsupported Media Type."
I had an issue with 2 services not communicating. We finally figured out that using Cassini (the built in Visual Studio IIS) to host the ListenerService 'BackEnd' was causing the problem. Switching the project to start in a virtual directory of IIS allowed the two to communicate.
I was seeing : An error occurred while receiving the HTTP response to http://localhost:1484/MainListenerService.cs. This could be due to the service endpoint binding not using the HTTP protocol. This could also be due to an HTTP request context being aborted by the server (possibly due to the service shutting down). See server logs for more details. and this error:
The HTTP request was forbidden with client authentication scheme 'Anonymous'.
Are you using basicHttpBinding? Silverlight only supports basicHttpBinding but the default when you create a WCF service is wsHttpBinding. You should change that on your web.config before adding the reference on your Silverlight project. Check out this video from Tim Heuer: http://silverlight.net/learn/videos/all/how-to-consume-wcf-and-aspnet-web-services-in-silverlight/

WCF-BasicHttp NTLM ESB guidance

I am trying to access an asmx service located on IIS, the asmx is using integradted security
I am trying to call it with wcf-basichttp adapter configured inside ESB guidance 1.0
The error i am getting is :
The HTTP request is unauthorized with client authentication scheme 'Anonymous'. The authentication header received from the server was 'NTLM'
I tryed to set in the endpoint config:
UserName=DOMAIN\Username&Password=Password&TransportClientCredentialType=NTLM
Any idea would be appriciated
I would take a look at this similar thread.