I'm developing a simple web service using MS Visual Studio 2008, C# and .net 4. I used the WCF project template, and thru this, I was able to create a site and deploy it to IIS 7.5. It pretty much has all the default settings that, just that I added a new binding configuration for the wsHttpBinding where "security mode=None".
Using Soap UI 4.0.1, i wanted to test this service, but found that I had to add the endpoint URL again in the WS-A "To:" field.
Is there a way to change the wsdl or endpoint so I dont need to use the WS-A "To:" field in Soap UI? I don't understand why Soap UI requires the endpoint url again in the WS-A "To:" field when I already provide the wsdl to create the request.
I found that if I changed the configuration from wsHttpBinding to basicHttpBinding, then the WS-A field is not required anymore in SoapUI. However, I still dont know why SoapUI requires the WS-A "To" field for the wsHttpBinding configuration. Maybe its a bug/"feature" of SoapUI.
The difference is huge! wsHttpBinding is using SOAP 1.2 (vs 1.1), your authentication elements move to WS-* ones, and more. Here's a good example app that breaks it all down: http://www.codeproject.com/Articles/36396/Difference-between-BasicHttpBinding-and-WsHttpBind
Related
We have an existing wcf service, and I created a new project. I want to use it. I hit add service reference, pop in the URL, press OK, and it adds it as a service reference but there is no config generated.
I also tried svcutil.exe /language:cs /out:GeneratedProxy.cs /config:app.config [url] but no config is generated, only the proxy cs.
I'm using VS 2013 / .NET 4.0
My question is, is this a sign that the SVC itself has some missing data that is required to build the contracts, or is the problem with adding the service reference?
For the record I have tried unchecking the reuse types option which some questions on here have reported as fixing the problem.
Bonus question, do you think if I can't get this working that manually adding some generic default bindings and endpoint code to the web config will work?
First, the reason that why the Adding service reference generates nothing is that the WCF service is rest style service. By default, the proxy-based invocation of rest style WCF services is complex.
https://en.wikipedia.org/wiki/Representational_state_transfer
https://learn.microsoft.com/en-us/dotnet/framework/wcf/feature-details/wcf-web-http-programming-model
Calling the WCF rest style service with the client proxy is uncommon. Generally, we construct an Http request by using an HTTP client library to call the service, such as HttpClient, WebClient.
How to fix "ERR_ABORTED 400 (Bad Request)" error with Jquery call to C# WCF service?
Besides, calling the WCF rest style service with the client proxy is feasible. Please refer to my previous link.
WCF: There was no endpoint listening at, that could accept the message
Feel free to let me know if there is anything I can help with.
In our application a Service Reference was added to connect to a SOAP Web Service. When connecting to the Web Service we get an error. The owner of the web service told us that the error was caused because we use SOAP 1.2 and theirs web service only supports SOAP 1.1.
This answer mentions to add a textMassageEncoding setting in our custom binding. But it is not clear where to add this setting. Where should this setting been added?
Instead of adding a Service Reference add a Web Reference. I use VS 2013 (VS 2017 is exactly the same), right click on project name in Solution Explorer, select add then Service Reference, click Advanced button, click Add Web Reference at the bottom. Web references are a bit dated, but I use them all the time because I have a ton of legacy software, including android and iOS apps that use them. RESTful apis are typically the most used api these days.
I am currently developing a duplex WCF service and I wish to test the service using the WcfTestClient.exe that is provided by Visual Studio 2010. However as my WCF service is a duplex, the ending point are created as shown:
selfHost.AddServiceEndpoint(typeof(IPostingService), new WSDualHttpBinding(), "Posting");
apparently after running wcftestclient.exe and connecting to the service, it says that it is not supported for dual http bindings.
Any idea how else can I test my WCF service?
Check this post which offers some alternatives to wcfclient.
I would just write a simple console application to test it, but that would require you to configure the bindings outside the wcfclient. You can use WCF Configuration Editor (from Tools menu) to assist with binding configuration.
Host the WCF application, Once it is started do the following..
Use 'Poster' a add on in Mozilla.
Set appropriate return type, pass the url to your WCF application.
Set Post method and you are done.
Probably missing something very basic. I created a WCF 4.0 Rest Service. It works no problems when I'm hitting the url from a browser and I'm getting back what I want.
But now I want to use that service from a client mvc application (it will also be used by other non .net platforms which is why it's a rest service in the first place).
Problem is how do I get a service reference to it so I can start to use it in my c# code? With the new minimal WCF .net 4 config approach and no interface for the service contract, I don't know how to specify a mex endpoint. Ultimately I don't want a mex endpoint in production, just during development. I would love to be able to specify that all my services (around 10 in one application) have endpoints with one tiny piece of config that vs2010 .config transformations just rips out when I publish.
Stop. REST service doesn't use metadata. Metadata (Mex endpoint) are only for SOAP services because WSDL 1.1 (the only version supported by WCF) is able to describe only SOAP service. WADL or WSDL 2.0 is able to describe REST service but non of them is currently supported by WCF.
REST service is consumed by using WebRequest directly or by building ChannelFactory on top of shared contracts. Both methods are described here. Other method is to use HttpClient from REST Starter kit (former API). The problem with Starter kit is that it has never reached RTM (it was replaced by WCF 4). Instead of metadata endpoint WCF 4 REST service offers help page where all operation are described. When using WCF 4 REST template the help page should be already turned on - just add /help sufix to address of your service. Here is another article about building REST clients.
I'm building a webservice that needs to be accessible to a variety of potential platforms, including a number of older ASP and ASP .NET applications. After some research, I settled on a WCF service with both a REST (webHttpBinding) and SOAP (wsHttpBinding) endpoint (that way, I can support a wide range of platforms and still make the .NET coders happy).
For security, I'm using SSL and HTTP Authentication Basic against my own database of username/passwords. So I've written an HttpModule to handle the usernames and passwords and check for SSL. Now, the REST setup is working perfectly, but I'm having problems with the SOAP endpoint. No matter what settings I use, the SOAP client never sends me a WWW-Authorization header that I can use to authenticate. I'm assuming that setting something like <message clientCredentialType="UserName" /> should tell WCF that I expect an Authorization header, and that information will be picked up by Visual studio (or whatever client) when it creates a web reference. Perhaps I'm just being hopelessly naive.
So to summarize the question: is there any way that I can tell WCF to send me a WWW-Authorization header (ie, an HTTP basic header) along with the soap messages?
You can create custom headers for your authentication.
Have a look here