WCF nettcpbinding in windows phone 8? - wcf

I have WCF Service with nettcpbinding endpoint , how can I consume this service in WP8?,
I don't want to use sockets because I don't want to change the implementation of my service, is there any way to consume the service using sockets?
Will nettcpbinding be supported in the next versions of WP8, if yes then when?

I not using WCF (but that *.asmx), Its more simple type of services but this solution maybe work too for you
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580%28v=vs.105%29.aspx

You can implement it yourself.
It's not that hard, and the protocol stack is well-documented.
See this article for an overview.
WP7-8 already includes binary XML serialization used by nettcp, namely XmlDictionaryReader and XmlDictionaryWriter classes. So, you only need to implement the lower-level pieces of the protocol, i.e. the framing protocol, and SOAP envelopes.

Related

how to overcome WCF soap feature?

in my understanding, WCF internally does some SOAP work before the serialization process.
is there a way to skip the soap feature and render source data directly to binary format?
WCF doesn't do anything SOAP-y untill you apply a binding that implements SOAP. If you want binary, take a look at net.TCP or write your own binding.
See Windows Communcation Foundation Bindings on MSDN.

What is the relationship between WCF, Rest and SOAP?

What is the relationship between WCF and REST&SOAP? Is WCF based on one of those technologies (REST or SOAP) or it is a separate technology?
WCF is a messaging framework for building distributed systems. Distributed systems is mostly just another word for web services.
What this means is that you can write methods in C# (or any of the .NET languages) and then apply a bunch of configurations to the code that make your code accessible to others and turn your code into a web service.
Those "bunch of configurations" are WCF. WCF allows you to expose your methods to other computers or applications using REST if you set up the WCF configurations around your C# code to expose it as a RESTful service. Or, you can easily take the same C# methods and make them available via the SOAP protocol.
If you have a method called "GetData()", you can set up the WCF configuration to make that method available in a service that is hosted in IIS. When someone calls that service, they can send an HTTP GET request to http://www.yourdomain.com/SomeService/GetData, and the GetData method will receive the message and send back a response. When you make a GET request over HTTP, you're using the REST. REST is pretty much tied to HTTP as the transport protocol. REST also has no standard message format. Whatever you want to send in your HTTP message, and however you want to send it is OK. You can send XML, or JSON, or just plain text. You can use POST, or GET or PUT or any of the HTTP verbs as well.
With SOAP, your messages can be sent to the service using any transport protocol -- you aren't tied to HTTP. SOAP messages are designed to be transport neutral. They are encoded in XML and the XML always has a head and a body node inside of an envelope node. There are lots of web standards around SOAP -- standards for putting security, sessions and other features into the header of the message, for example. Also, with SOAP, you get a WSDL, which I won't go into explaining here, but it makes it a LOT easier for clients to program against. Most programming languages have a method of taking a WSDL and converting it into strongly-typed methods and objects so that your service is easy to call.
REST is very popular on the internet and is as scalable as the internet (i.e. VERY scalable). SOAP is very popular in business-to-business applications.
WCF isn't automatically REST or SOAP, but you can make it that way. What you need here is a tutorial:
WCF
http://www.codeproject.com/Articles/406096/A-beginners-tutorial-for-understanding-Windows
REST
http://rest.elkstein.org/
Here's some other interesting stuff:
WCF - REST / SOAP
https://msdn.microsoft.com/en-us/library/hh323708(v=vs.100).aspx
WCF and REST
https://msdn.microsoft.com/en-us/library/ee391967.aspx
Or you can do a google/bing/metacrawler/altavista search on your own.....
From MSDN
The WCF programming model provides various capabilities, such as SOAP
services, web HTTP services, data services, rich internet application
(RIA) services, and workflow services. SOAP services support
interoperability between systems that are built with Java, other
platforms, and those that use messaging standards that are supported
by Microsoft®. SOAP services also support transports such as HTTP,
TCP, named pipes, and MSMQ. Web HTTP services and data services both
support REST. Web HTTP services enable you to control the service
location, request and response, formats, and protocols. Data services
enable you to expose data models, and data-driven logic as services.
WCF also includes two programming models: The service model and the
channel model. The service model provides a framework for defining
data contracts, service contracts and service behaviors. The channel
model supports specifying formats, transports, and protocols.
Both SOAP and REST services can provide functionality to web
applications, and both can be used to exchange information in the
web's distributed environment. Each one has its own advantages, and
limitations.
Although, this question has got several good answers, just putting in my 2-cents, in an attempt for newbies to WCF vs SOAP vs REST-full services, to make it a bit easier for them to understand.
We get confusions, whether WCF supports both REST and SOAP ? And, normally, we just see generic definitions about SOAP and REST. So , we need something from Microsoft to make us feel the truth : ) So here's a screenshot from Microsoft MSDN :
So, yes, WCF supports both .
In context with OP:
SOAP services: in WCF programming model support interoperability between systems that are built with Java, other
platforms, and those that use messaging standards that are supported
by Microsoft®. These also support transports such as HTTP,
TCP, named pipes, and MSMQ.
Web HTTP services : in WCF programming model supports REST. [Source: MSDN]

How do I use Google Protocol Buffers with a C++ client and a C# WCF service?

Several questions:
How do I get my C# WCF service to use Protocol Buffers?
How do I write a C++ client for a WCF service?
How do I get that C++ client to use Protocol Buffers when talking to the WCF service.
There seems to be lots of tiny snippets of information out there, but nobody appears to have pulled it all together in one place.
For questions 1 and 3, I do not think that WCF supports Protocol Buffers, REST is probably the closest thing that you have in WCF. You could either use REST, or a REST layer between the client and the server using Protocol Buffers.
Question 2 in covered in this stackoverflow question: Create WCF service for unmanaged C++ clients

Is WCF appropriate for implementing legacy network services?

I use the term network services to refer to things such as NNTP, IMAP, POP3... things which have a defined protocol layered on top of TCP/IP.
I'm having a very difficult time figuring out how I can connect to an existing network service using a WCF client. I haven't found any examples other than ones that are basically using C#-ified socket code.
Can anyone refer me to any examples of using WCF to talk to a legacy service as something other than a glorified socket?
Is WCF even appropriate for this type of requirement?
Thanks.
WCF comes with a set of standard bindings, here is a list of the bindings provided in 3.5:
http://msdn.microsoft.com/en-us/library/ms730879.aspx
If you need to use anything else, WCF is probably not the way to go. Even if you could build your own binding, the cost would outweigh the benefit.
If you have a requirement in your project that everything should use WCF, you could build a WCF facade over your sockets code.
Well, the term "WCF" actually means 2 things:
The framework: "ABC" - Address, binding, contract
Actual use of a combination of the above (for example, a WCF webservice using BasicHttpBinding)
There's not built in bindings for the protocols you mentioned, which is why the examples you'll see looks like "glorified sockets" - That's what they are. That's what a binding is: A level of abstraction built on a basic protocol (typically UDP/IP or TCP/IP).
Now, with all this being said, you need to build / borrow / steal / whatever a binding that is usable with your protocol of choice. This might look like you're just injecting sockets into the WCF framework, and honestly, that's just what it is :)... So what's so great about it?
If you managed to implement your binding to-the-specs, you got yourself a very easily substituted component, which will fit into all WCF applications. Whether you want this behaviour or not, is up to you and your requirements :)
Good luck with it.
Well, WCF at its heart is the unified communication engine offering by Microsoft, based on SOAP - it replaces ASMX web services, WSE, .NET Remoting and more.
As such, it's SOAP based and therefore can talk to anything that talks SOAP - which I doubt is the case for POP3 or other services. So I don't think you can write a WCF client for these services, really.
As for writing these services from scratch and exposing them as WCF services - that might work, since basically the WCF service implementation can do anything, and then present itself to the outside world as a SOAP service - could work, question is: what's the benefit?
Marc

Windows Communication Foundation (WCF)

Why we are going for WCF when web services (ASMX) exist ??
Here is a nice article that you can look at
Comparing ASP.NET Web Services to WCF Based on Development
WCF supports protocols beyond HTTP (TCP and MSMQ come to mind) and message formats beyond XML, so it could be used for tasks they are unsuitable e.g. because these tasks require better performance.
WCF could be self-hosted so no need for hosting in IIS.
WCF supports preserving service object state between calls.
Another rather interesting and thoughtful comparison:
http://www.keithelder.net/blog/archive/2008/10/17/WCF-vs-ASMX-WebServices.aspx
Download the PowerPoint and have a look at it - also, watch Keith's DotNetRocks TV appearance for a great screencast intro to WCF and its advantages over ASMX.
Marc
Web services require use of HTTP protocol on standard HTTP ports, right? WCF is more flexible. It can be based on HTTP, TCP, UDP and such. It allows you to design an application with network connectivity without caring so much about the protocol used. Then you can more easily switch the network protocol without affecting the application.