Top Banner
N aresh I nformation Technologies T echnologies Nagaraju Bende MCPD.NET Sr Consultant,Trainer http://nbende.wordpress.com
14

Wcf remaining

Jul 04, 2015

Download

Technology

shamsher ali

this slide is for WCF begineers
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Wcf remaining

Naresh InformationTechnologiesTechnologies

Nagaraju BendeMCPD.NET Sr Consultant,Trainer

http://nbende.wordpress.com

Page 2: Wcf remaining

Consuming WCF Services

VS.NET Role in building WCF Apps

Agenda – Session 4

�������������� �����������������

WCF Service Library & WCF Service

Data Contracts

Page 3: Wcf remaining

<system.serviceModel> <services> <endpoint address = "http://localhost:8000/CustomerManager" binding = "basicHttpBinding" contract = "IContactManager"> </endpoint> </services> </system.serviceModel>

Addresses

�������������� �����������������

</system.serviceModel>

<system.serviceModel> <services> <endpoint address = "net.tcp://localhost:8001/CustomerManager/" binding = "netTcpBinding" contract = "IContactManager"> </endpoint> </services> </system.serviceModel>

Page 4: Wcf remaining

Develop Real World WCF Service Library

WCFTESTCLIENT.exe / WCFSVCHost.exe

Agenda – Session 5

�������������� �����������������

Host in Windows Service

Configure more bindings

Page 5: Wcf remaining

WCF Service using Web Template

Hosting in Web Server

Agenda – Session 6

�������������� �����������������

LinqToSql/ADO.NET Entities/WCF

Demo

Page 6: Wcf remaining

IIS Hosting – simple 3 steps

1 Create Virtual Directory in IIS

Create .svc file for service

�������������� �����������������

2 Create .svc file for service implementation

3 Configuration of web.config for services

Page 7: Wcf remaining

Web Programming using WCF

WCF for ASP.NET AJAX apps

Agenda – Session 9

�������������� �����������������

webHttpBinding new in 3.5, VS.NET role

SOAP, JSON, POX, REST styles

Demo

Page 8: Wcf remaining

webHttpBinding

• New “web-friendly” WCF Binding in Fx 3.5– Allows for the development of RESTful services– Does not use SOAP envelopes– HTTP and HTTPS Transports Only

• Supports several wire formats:

�������������� �����������������

• Supports several wire formats:– XML– JSON– Binary (streams)

Page 9: Wcf remaining

• JavaScript Object Notation• Format for bridging JavaScript and objects

– Easier for browsers than XML

• ASP.NET AJAX & other AJAX toolkits use it

What is JSON?

�������������� �����������������

• ASP.NET AJAX & other AJAX toolkits use it– Other web-aware clients also (Silverlight, etc.)

������������ ����������� ������������������ ������������������ ������������������ ����������������������� ��������� �� ��������� �� ��������� �� ��������� ��

������������������������������������������������ �� ���� ������!��� ���� ������!��� ���� ������!��� ���� ������!�������������������������������������"�"�"�"�

Page 10: Wcf remaining

• WCF AJAX support in Visual Studio – Script manager, VS Project Templates

• WCF automatically generates JS proxy• Usage pattern similar to existing one:

– Add service to Script Manager control

WCF / AJAX Integration

�������������� �����������������

– Add service to Script Manager control– Write JavaScript code to work with proxy

• Configuration not required– Via the WebScriptServiceHostFactory (.svc file)

Page 11: Wcf remaining

SOAP, JSON, POX, REST styles

WebGet and WebInvoke

Agenda – Session 10

�������������� �����������������

UriTemplate in 3.5

Demo

Page 12: Wcf remaining

[WebGet] And [WebInvoke]

• Binds a WCF operation to URI space and HTTP method

• Indicate the HTTP Method for the operation– WebGet – Don’t make me write it– WebInvoke – All verbs other than GET (Method

�������������� �����������������

– WebInvoke – All verbs other than GET (Method parameter takes in the name of the Verb)

• Other Parameters– BodyStyle – Indicates whether the Request/

Response are wrapped or not– RequestFormat – Json or Xml– ResponseFormat – Json or Xml– UriTemplate – Rich binding to URI

Page 13: Wcf remaining

UriTemplate

• String that allows you to define the structure of the URI, as well as to define “Holes” – The “Holes” are variables– You Bind the template with parameters to

�������������� �����������������

– You Bind the template with parameters to fill the holes

• {productId} hole / variable gets bound to productId parameter in operation

��������������

����������������������������������������

����� ��� �������� ����������

��������

Page 14: Wcf remaining

WCF REST Starter Kit

• Microsoft.ServiceModel.Web.dll– New features supporting RESTful services

• Visual Studio 2008 Templates– REST Collections/Singleton Services

�������������� �����������������

– Atom Feed/Atom Publishing Protocol– HTTP/POX Services

• REST Samples• Codeplex Project

– Released at PDC– Written by WCF team– Features may be included in .NET 4.0