How to consume a WPF Service in Wordpress - c#

i am very new to web service and WCF. I want to know that is it possible to consume an WCF Service in WordPress website.
if yes then where to host the service.
or what technology (i.e Web Service, asp.net API or WCF service) is better to use for making service, if need to consume the service in WordPress site.
Please give any reference link in this regard.
Thanks in advance

You can create a RESTful WCF service if you so desire, even though I will recommend using ASP.NET WebAPI for this purpose as it suits more.
Please take a look at this question I've asked, where I've created a simple HTTP based WCF service. The purpose of the question is different but you can easily refer the code to create a simple RESTful service in WCF.

Related

Can I consume a Web API as you would consume the contract of a WCF service?

Description:
I have an client app consuming a WCF service, both runing on .NET Core and hosted as web apps in Azure.
The client has access to an interface that the service implements as its DataContract.
Currently I consume the service via creating a ChannelFactory based on an DataContract of the WCF service.
Because lots of reasons I'd like to move away from WCF.
My first idea was to convert the WCF service to a Web API and implement something like OpenAPI (Swagger) and from there consume the API via generated docs.
However I can't really find anything similar to the way you would consume a WCF contract and then be able to call upon its methods.
Question:
Is it possible o use a shared interface between the consumer and a Web API in a way that enables me to call upon the methods (routes) in that interface? Be it using OpenAPI (Swagger) or any other framework/lib/or otherwise.
Please let me know if anything is unclear and I'll add info, I'm aware its a somewhat broad question.

Are there any performance and/or other issues when hosting both a Web Api and WCF service in a single Windows service?

Initially when I built an application, there was only a requirement to expose an endpoint using WCF. Now, there is a requirement to expose another endpoint using REST therefore I have used .Net Web Api to do so. The WCF endpoint is hosted in a Windows service therefore I have hosted the Web Api endpoint in the same service. Are there any issues in doing so? Any performance considerations? After some exhaustive searching, I couldn't find any substancial information on the topic.
Are there any issues in doing so?
It may be better to expose the rest API via WCF using webHttpBinding rather than introduce WebAPI into the mix. I'm not aware of any problems this would cause per se, but in terms of solution simplicity I think it makes more sense to take advantage of WCF's multiple-endpoints-to-one-service-contract mapping capability.
I did consider this but I've read a lot of bad reviews about using WCF
to expose RESTful endpoints. Moreover, it appears Web Api is the
preferred technology as mentioned here:
WCF vs ASP.NET Web API
Agreed. If you were starting from scratch then I wouldn't hesitate recommending WebAPI over WCF (actually I would recommend using Nancyfx over WebApi any day of the week).
You can expose your service as HTTP with about 10 minutes work using WCF, assuming you wish to expose the same operations as are currently defined on your service contract, as you have already have the soap endpoint.
Plus you will end up with a simpler solution without the considerable bloat of asp.net/owin.

Azure restful webservice

i'm trying to create a restful webservice and deploy it to Azure.
I can't figure out how this should be done. The MS documentation is huge and doesn't say much on how to achieve this.
I created a Cloud Service Azure Project and included a ASP.NET MVC4 WEB API WebRole and Visual Studio automatically created a website.
WebRole is the entry point for the service right? I don't see how the WebRole is connected with anything in the project. I guess i'm totally missing some parts of this architecture.
Can you please tell me what's the best way to achieve this or point me to some helpful tutorials?
When should one choose to create a WCF Cloud Service?
Thank you!
Step-by-step instructions for creating a RESTful API in MVC in Windows Azure are here. You should not be thinking about hosting a RESTful API in WCF - while possible there is a lot of unnecessary overhead.
If you are into Node.js, you might want to look at the new Custom API feature in Windows Azure Mobile Services.

Accessing WCF webservice using browser

How to access WCF webservice using browser?
Currently its just implemented as normal webservice.
Please let me know how to set webConfig settings as well.
In order to access and test your WCF service from within your browser, you will need to make it RESTFUL webservice.
here are a couple of resources that will help:
http://msdn.microsoft.com/en-us/library/dd203052.aspx
http://www.codeproject.com/Articles/344512/Building-and-Testing-WCF-RESTful-services
also checkout this nice article that sums the needs and various aspects of building RESTFUL web services
http://predic8.com/rest-webservices.htm

Implementing web service with WCF 4.0 with authentification

I am starting development of the new project and since I am new in the WCF world I want to ask your advice.
I am going to implement web-service which will provide data for WPF client and for ASP.NET site. Web site and web service should be hosted in the Windows share hosting (not didicated server) and this fact is bothering me. WPF client and web site will provide almost the same functionality for the user, so I want to implement all logic inside web service not to duplicate it in the client and web site.
Not sure what is the best way to implement such web-service - REST, SOAP or something else? Please, help me with selecting technology for web-service creation, I just want to get direction for optimal solution. 10x.
Update: Sorry I did not wrote details. Service will be something like on-line shop with admin panel, so web service will be used for getting products and for adding new product to the system. It does not support tons of customers, it's just solution for small web-shops.
since you are developing a Web based solution and a WPF client, i would recommend the following options for your WCF services:
REST Option - This option is good if you have some complex Ajax architecture on the client using Json and stuff, or if you want to expose your services publicly. In this case the option is to expose an HTTP endpoint using webHttpBinding on your service. Since your deployment will be on a shared web server, you can host your service inside IIS. I would recommend considering a SSL option for security.
Soap Option - This options is the easy one, and should be more familiar to most developers, since it acts like a usual web service. In this case i would use an HTTP endpoint with wsHttpBinding on the service for enhanced security. Since your deployment will be on a shared web server, you can host your service inside IIS. I would recommend considering a SSL option for security.
Whatever solution you choose you will be able to accomplish your goal to have simple SOA architecture in place and will have centralized services for your CRUD operations.
I hope this answered your question.

Categories