Beruflich Dokumente
Kultur Dokumente
Windows Communication Foundation (Code named Indigo) is a programming platform and runtime
system for building, configuring and deploying network-distributed services. It is te latest service
oriented tecnology! Interoperability is te fundamental caracteristics of WCF. It is unified
programming model provided in ."et Framework #.$. WCF is a combined features of Web %ervice,
&emoting, '%'( and C)'*. WCF provides a common platform for all ."+, communication.
-elow figures sows te different tecnology combined to form WCF.
Advantage
.. WCF is interoperable wit oter services wen compared to ."et &emoting,were te client
and service ave to be ."et.
/. WCF services provide better reliability and security in compared to 0%'1 web services.
#. In WCF, tere is no need to make muc cange in code for implementing te security model
and canging te binding. %mall canges in te configuration will make your re2uirements.
3. WCF as integrated logging mecanism, canging te configuration file settings will
provide tis functionality. In oter tecnology developer as to write te code.
Disadvantage
'aking rigt design for your re2uirement is little bit difficult. I will try to elp you on solving tese
difficulties in te following article.
Development Tools
Default template is available for WCF
1. WCF - Test Client tools for testing the WCF service.
'icrosoft provides inbuilt application to test te WCF application. ,is can be done by opening te
4isual %tudio command prompt and type te wcfClient Serviceurl sows below. ,is will elp te
developer to test te service before creating te client application.
1. WCF services can be debugged now in isual !tudio "##$. Wcfsvchost.e%e
will do it for &ou because service will be self hosted when &ou start
debugging.
Difference between WCF and Web service
Web service is a part of WCF. WCF offers muc more fle5ibility and portability to develop a
service wen comparing to web service. %till we are aving more advantages over Web service,
following table provides detailed difference between tem.
Features Web !ervice WCF
6osting It can be osted in II%
It can be osted in II%, windows activation
service, %elf-osting, Windows service
7rogramming
8Web%ervice9 attribute as to be added
to te class
8%erviceContraact9 attribute as to be added
to te class
'odel
8Web'etod9 attribute represents te
metod e5posed to client
8)perationContract9 attribute represents te
metod e5posed to client
)peration
)ne-way, &e2uest- &esponse are te
different operations supported in web
service
)ne-Way, &e2uest-&esponse, :uple5 are
different type of operations supported in
WCF
1';
%ystem.1ml.seriali<ation name space
is used for seriali<ation
%ystem.&untime.%eriali<ation namespace is
used for seriali<ation
+ncoding
1'; ..$, ',)'('essage
,ransmission )ptimi<ation
'ecanism), :I'+, Custom
1'; ..$, ',)', -inary, Custom
,ransports
Can be accessed troug 6,,7, ,C7,
Custom
Can be accessed troug 6,,7, ,C7,
"amed pipes, '%'(,7/7, Custom
7rotocols %ecurity %ecurity, &eliable messaging, ,ransactions
WCF Fundamental
In tis part of tutorial you are going to learn about some fundamental concepts in WCF. ,ese
concepts and terms will be used trougout tis tutorial.
+nd 7oint
-indings and -eavior
Contracts and %ervice ost
'essage and Cannel
WCF client and 'etadata
'nd(oint
WCF %ervice is a program tat e5poses a collection of +ndpoints. +ac +ndpoint is a portal for
communicating wit te world.
0ll te WCF communications are take place troug end point. +nd point consists of tree
components.
Address
-asically =&;, specifies were tis WCF service is osted .Client will use tis url to connect to te
service. e.g
ttp>??localost>@$A$?'y%ervice?%impleCalculator.svc
)inding
-inding will describes ow client will communicate wit service. ,ere are different protocols
available for te WCF to communicate to te Client. Bou can mention te protocol type based on
your re2uirements.
0 binding as several caracteristics, including te following>
,ransport -:efines te base protocol to be used like 6,,7, "amed 7ipes, ,C7, and '%'(
are some type of protocols.
+ncoding ()ptional) - ,ree types of encoding are available-,e5t, -inary, or 'essage
,ransmission )ptimi<ation 'ecanism (',)'). ',)' is an interoperable message
format tat allows te effective transmission of attacments or large messages (greater tan
C3D).
7rotocol()ptional) - :efines information to be used in te binding suc as %ecurity,
transaction or reliable messaging capability
,e following table gives some list of protocols supported by WCF binding.
)inding Description
-asic6ttp-inding -asic Web service communication. "o security by default
W%6ttp-inding Web services wit W%-E support. %upports transactions
W%:ual6ttp-inding Web services wit duple5 contract and transaction support
W%Federation6ttp-inding Web services wit federated security. %upports transactions
'sm2Integration-inding
Communication directly wit '%'( applications. %upports
transactions
"et'sm2-inding
Communication between WCF applications by using 2ueuing.
%upports transactions
"et"amed7ipe-inding
Communication between WCF applications on same computer.
%upports duple5 contracts and transactions
"et7eer,cp-inding
Communication between computers across peer-to-peer services.
%upports duple5 contracts
"et,cp-inding
Communication between WCF applications across computers.
%upports duple5 contracts and transactions
Contract
Collection of operation tat specifies wat te endpoint will communicate wit outside world.
=sually name of te Interface will be mentioned in te Contract, so te client application will be
aware of te operations wic are e5posed to te client. +ac operation is a simple e5cange pattern
suc as one-way, duple5 and re2uest?reply.
-elow figure illustrate te functions of +ndpoint
'%ample*
+ndpoints will be mentioned in te web.config file on te created service.
<system.serviceModel>
<services>
<service name="MathService"
behaviorConfiguration="MathServiceBehavior">
<endpoint
address="http:localhost:!"#"MyServiceMathService.svc"
contract="$MathService"
binding="%s&ttpBinding">
<service>
<services>
<behaviors>
<serviceBehaviors>
<behavior name="MathServiceBehavior">
<serviceMetadata http'et(nabled=")rue">
<service*ebug include(+ception*etail$n,aults="true" >
<behavior>
<serviceBehaviors>
<behaviors>
<system.serviceModel>
)inding and )ehavior
)inding
%imple definition for -inding describes ow te client will communicate wit service. We can
understand wit an e5ample.
Consider a scenario say, I am creating a service tat as to be used by two type of client. )ne of te
client will access %)07 using ttp and oter client will access -inary using ,C7. 6ow it can be
doneF Wit Web service it is very difficult to acieve, but in WCF its Gust we need to add e5tra
endpoint in te configuration file.
<system.serviceModel>
<services>
<service name="MathService"
behaviorConfiguration="MathServiceBehavior">
<endpoint address="http:localhost:!"#"MyServiceMathService.svc"
contract="$MathService"
binding="%s&ttpBinding">
<endpoint address="net.tcp:localhost:!"!"MyServiceMathService.svc"
contract="$MathService"
binding="net)cpBinding">
<service>
<services>
<behaviors>
<serviceBehaviors>
<behavior name="MathServiceBehavior">
<serviceMetadata http'et(nabled=")rue">
<service*ebug include(+ception*etail$n,aults="true" >
<behavior>
<serviceBehaviors>
<behaviors>
<system.serviceModel>
%ee ow simple it is in WCF. 'icrosoft is making everyting simple.cording to its scope> common
beaviors affect all endpoints globally, service beaviors affect only service-related aspects,
endpoint beaviors affect only endpoint-related properties, and operation-level beaviors affect
particular operations.
'%ample*
In te below configuration information, I ave mentioned te -eavior at %ervice level. In te
service beavior I ave mention te servie'etadata node wit attribute ttHet+nabledIJtrueJ. ,is
attribute will specifies te publication of te service metadata. %imilarly we can add more beavior
to te service.
<system.serviceModel>
<services>
<service name="MathService"
behaviorConfiguration="MathServiceBehavior">
<endpoint address="" contract="$MathService"
binding="%s&ttpBinding">
<service>
<services>
<behaviors>
<serviceBehaviors>
<behavior name="MathServiceBehavior">
<serviceMetadata http'et(nabled=")rue">
<service*ebug include(+ception*etail$n,aults="true" >
<behavior>
<serviceBehaviors>
<behaviors>
<system.serviceModel>
+ote*
0pplication can be controlled eiter troug coding, configuring or troug combination of bot.
%pecification mention in te configuration can also be overwritten in code.
Contracts and !ervice ,ost
Contracts
In WCF, all services are e5posed as contracts. Contract is a platform-neutral and standard way of
describing wat te service does. 'ainly tere are four types of contracts available in WCF
!ervice Contract
%ervice contracts describe te operation tat service can provide. For +g, a %ervice provide to know
te temperature of te city based on te <ip code, tis service is called as %ervice contract. It will be
created using %ervice and )perational Contract attribute.
,o know more on %ervice contract see %ervice contract tutorial.
Data Contract
:ata contract describes te custom data type wic is e5posed to te client. ,is defines te data
types, tat are passed to and from service. :ata types like int, string are identified by te client
because it is already mention in 1'; scema definition language document, but custom created
class or data types cannot be identified by te client e.g. +mployee data type. -y using
:ataContract we can make client to be aware of +mployee data type tat are returning or passing
parameter to te metod.
,o know more on :ataContract see :ataContract tutorial.
-essage Contract
:efault %)07 message format is provided by te WCF runtime for communication between Client
and service. If it is not meeting your re2uirements ten we can create our own message format. ,is
can be acieved by using 'essage Contract attribute.
,o know more on 'essage Contract see 'essage contract tutorial.
Fault Contract
%uppose te service I consumed is not working in te client application. I want to know te real
cause of te problem. 6ow I can know te errorF For tis we are aving Fault Contract. Fault
Contract provides documented view for error occurred in te service to client. ,is elps us to easy
identity, wat error as occurred.
,o know more on Fault Contract see Fault Contract tutorial.
!ervice ,ost
%ervice 6ost obGect is in te process of osting te WCF service and registering endpoints. It loads
te service configuration endpoints, apply te settings and start te listeners to andle te incoming
re2uest. System.ServiceModel.ServiceHost namespace old tis obGect. ,is obGect is created wile
self osting te WCF service.
In te below e5ample you can find tat WCF service is self osted using console application.
Creating uri for the hosting the service
-ri uri = ne% -ri."http:localhostCategoryService"/0
Creating the host ob1ect for MathService
Service&ost host = ne% Service&ost.typeof.CategoryService/2 uri/0
3dding endpoint to the &ost ob1ect
host.3ddService(ndpoint.typeof.$CategoryService/2ne% 4S&ttpBinding./2 uri/0
host.5pen./0 &osting the Service
Console.4rite6ine."4aiting for client invocations"/0
Console.7ead6ine./0
host.Close./0
-essage and Channel
-essage
WCF 'essage is te unit of data e5cange between client and service. It consists of several parts,
including a body and eaders.
WCF .untime
WCF runtime is te set of obGect responsible for sending and receiving message. For e5ample
formatting te message, applying security and transmitting and receiving message using various
protocol.
Channels*
Cannels are te core abstraction for sending message to and receiving message from an +ndpoint.
-roadly we can categories cannels as
Transport Channels
- ,andles sending and receiving message from networ/. (rotocols li/e ,TT(0 TC( name pipes
and -!-1.
(rotocol Channels
- Implements %)07 based protocol by processing and possibly modifying message. e.g. W%-
%ecurity and W%-&eliability.
WCF Client and -etadata
WCF Client
WCF client is a client application creates to e5pose te service operations as metod. 0ny
application can ost a WCF client, including an application tat ost a service. ,erefore it is
possible to create a service tat includes WCF clients of oter services.
0 client application is a managed application tat uses a WCF client to communicate wit anoter
application. ,o create a client application for a WCF service re2uires te following steps>
.. Het te 7ro5y class and service end point information
=sing SvcUtil.exe we can create pro5y class for te service and configuration information
for endpoints. +5ample type te following sentence in te 4isual studio command prompt,
tis will generate te class file and configuration file wic contain information about te
endpoints.
svcutil /language:vb /out:ClientCode.vb /config:app.config
http://localhost:!"!/MyService/SimpleCalculator.svc#wsdl
/. Call operations.
0dd tis class files in te client application. ,en create te obGect for tis class and invoke
te service operation. Configuration information we got from te above step as to be added
to te client application configuration file. Wen te client application calls te first
operation, WCF automatically opens te underlying cannel. ,is underlying cannel is
closed, wen te obGect is recycled.
Creating the pro+y on client side
MyCalculatorService8ro+y.MyService8ro+y pro+y
= ne% MyCalculatorService8ro+y.MyService8ro+y./0
Console.4rite6ine."Counter: " 9 pro+y.MyMethod.//0
#. Close te WCF client obGect.
0fter using te obGect created in te above steps, we ave to dispose te obGect. Cannel will
be closed wit te service, wen te obGect is cleared.
-etadata
Caracteristics of te service are described by te metadata. ,is metadata can be e5posed to te
client to understand te communication wit service. 'etadata can be set in te service by enabling
te %ervice'etadata node inside te servcie-eaviour node of te service configuration file.
<system.serviceModel>
<services>
<service name="MathService"
behaviorConfiguration="MathServiceBehavior">
<endpoint address="" contract="$MathService"
binding="%s&ttpBinding">
<service>
<services>
<behaviors>
<serviceBehaviors>
<behavior name="MathServiceBehavior">
<serviceMetadata http'et(nabled=")rue">
<service*ebug include(+ception*etail$n,aults="true" >
<behavior>
<serviceBehaviors>
<behaviors>
<system.serviceModel>
,is metadata can be viewed wile creating WCF client application using SvcUtil.exe
WCF Architecture
,e following figure illustrates te maGor components of WCF.
Figure .> WCF 0rcitecture
Contracts
Contracts layer are ne5t to tat of 0pplication layer. :eveloper will directly use tis contract to
develop te service. We are also going to do te same now. ;et us see briefly wat tese contracts
will do for us and we will also know tat WCF is working on message system.
!ervice contracts
- :escribe about te operation tat service can provide. +5ample, %ervice provided to know te
temperature of te city based on te <ip code, tis service we call as %ervice contract. It will be
created using %ervice and )perational Contract attribute.
Data contract
- It describes te custom data type wic is e5posed to te client. ,is defines te data types, are
passed to and from service. :ata types like int, string are identified by te client because it is
already mention in 1'; scema definition language document, but custom created class or
datatype cannot be identified by te client e.g. +mployee data type. -y using :ataContract we can
make client aware tat we are using +mployee data type for returning or passing parameter to te
metod.
-essage Contract
- :efault %)07 message format is provided by te WCF runtime for communication between
Client and service. If it is not meeting your re2uirements ten we can create our own message
format. ,is can be acieved by using 'essage Contract attribute.
(olicies and )inding
- %pecify conditions re2uired to communicate wit a service e.g security re2uirement to
communicate wit service, protocol and encoding used for binding.
!ervice .untime
- It contains te beaviors tat occur during runtime of service.
,rottling -eavior- Controls ow many messages are processed.
+rror -eavior - %pecifies wat occurs, wen internal error occurs on te service.
'etadata -eavior - ,ells ow and weter metadata is available to outside world.
Instance -eavior - %pecifies ow many instance of te service as to be created wile
running.
,ransaction -eavior - +nables te rollback of transacted operations if a failure occurs.
:ispatc -eavior - Controls ow a message is processed by te WCF Infrastructure.
-essaging
- 'essaging layer is composed of cannels. 0 cannel is a component tat processes a message in
some way, for e5ample, by autenticating a message. 0 set of cannels is also known as a cannel
stack. Cannels are te core abstraction for sending message to and receiving message from an
+ndpoint. -roadly we can categories cannels as
,ransport Cannels
6andles sending and receiving message from network. 7rotocols like 6,,7, ,C7, name
pipes and '%'(.
7rotocol Cannels
Implements %)07 based protocol by processing and possibly modifying message. +.g. W%-
%ecurity and W%-&eliability.
Activation and ,osting
- %ervices can be osted or e5ecuted, so tat it will be available to everyone accessing from te
client. WCF service can be osted by following mecanism
II%
Internet information %ervice provides number of advantages if a %ervice uses 6ttp as
protocol. It does not re2uire 6ost code to activate te service, it automatically activates
service code.
Windows 0ctivation %ervice
(W0%) is te new process activation mecanism tat sips wit II% K.$. In addition to 6,,7
based communication, WCF can also use W0% to provide message-based activation over
oter protocols, suc as ,C7 and named pipes.
%elf-6osting
WCF service can be self osted as console application, Win Forms or W7F application wit
grapical =I.
Windows %ervice
WCF can also be osted as a Windows %ervice, so tat it is under control of te %ervice
Control 'anager (%C').
WCF ,osting
In tis part of te tutorial we are going to see te four different way of osting te WCF service.
WCF service cannot e5ist on its own! it as to be osted in windows process called as ost process.
%ingle ost process can ost multiple servers and same service type can be osted in multiple ost
process. 0s we discussed tere are mainly four different way of osting te WCF service.
.. II% osting
/. %elf osting
#. Windows 0ctivation %ervice
3. Windows %ervice
'ultiple osting and protocols supported by WCF.'icrosoft as introduced te WCF concept in
order to make distributed application development and deployment simple.
,osting 'nvironment !upported protocol
Windows console and form application 6,,7,net.tcp,net.pipe,net.msm2
Windows service application (formerly known as ", services) 6,,7,net.tcp,net.pipe,net.msm2
Web server II%C ttp, wsttp
Web server II%K - Windows 7rocess 0ctivation %ervice (W0%) 6,,7,net.tcp,net.pipe,net.msm2
0 summary of osting options and supported features.
Feature !elf-,osting II! ,osting WA! ,osting
+5ecutable 7rocess? 0pp :omain Bes Bes Bes
Configuration 0pp.config Web.config Web.config
0ctivation 'anual at startup 'essage-based 'essage-based
Idle-,ime 'anagement "o Bes Bes
6ealt 'onitoring "o Bes Bes
7rocess &ecycling "o Bes Bes
'anagement ,ools "o Bes Bes
II! 234 ,osting
,e main advantage of osting service in II% is tat, it will automatically launc te ost process
wen it gets te first client re2uest. It uses te features of II% suc as process recycling, idle
sutdown, process ealt monitoring and message based activation. ,e main disadvantage of using
II% is tat, it will support only 6,,7 protocol.
;et as do some ands on, to create service and ost in II%
!tep 1*%tart te 4isual %tudio /$$@ and click File-L"ew-LWeb %ite. %elect te JWCF %erviceJ and
;ocation as ttp. ,is will directly ost te service in II% and click )D.
!tep "* I ave created sample 6elloWorld service, wic will accept name as input and return wit
J6elloJ and name. Interface and implementation of te %ervice is sown below.
I-&!ervice.cs
:ServiceContract;
public interface $MyService
<
:5perationContract;
string &ello4orld.string name/0
=
-&!ervice.cs
public class MyService : $MyService
<
>region $MyService Members
public string &ello4orld.string name/
<
return "&ello " 9 name0
=
>endregion
=
!tep 5* %ervice file (.svc) contains name of te service and code beind file name. ,is file is used
to know about te service.
-&!ervice.svc
<?@ Service&ost 6anguage="C>" *ebug="true"
Service="MyService" CodeBehind="A3ppBCodeMyService.cs" ?>
!tep 6* %erver side configurations are mentioned in te config file. 6ere I ave mention only one
end point wic is configured to Jws6ttp-indingJ, we can also ave multiple end point wit
differnet binding. %ince we are going to osted in II%. We ave to use only ttp binding. We will
come to know more on endpoints and its configuration in later tutorial. Web.Config
<system.serviceModel>
<services>
<service behaviorConfiguration="ServiceBehavior" name="MyService">
<endpoint address="http:localhost$$S&ostedServiceMyService.svc"
binding="%s&ttpBinding" contract="$MyService">
<identity>
<dns value="localhost">
<identity>
<endpoint>
<endpoint address="me+" binding="me+&ttpBinding"
contract="$Metadata(+change">
<service>
<services>
<behaviors>
<serviceBehaviors>
<behavior name="ServiceBehavior">
<CDD )o avoid disclosing metadata information2
set the value belo% to false and remove the
metadata endpoint above before deployment DD>
<serviceMetadata http'et(nabled="true">
<CDD )o receive e+ception details in faults for
debugging purposes2 set the value belo% to true.
Set to false before deployment to avoid disclosing e+ception information
DD>
<service*ebug include(+ception*etail$n,aults="false">
<behavior>
<serviceBehaviors>
<behaviors>
<system.serviceModel>
+ote*
Bou need to mention te service file name, along wit te 0ddress mention in te config file. II%
%creen sot
,is screen will appear wen we run te application.
!tep 2* "ow we successfully osted te service in II%. "e5t we ave to consume tis service in
client application. -efore creating te client application, we need to create te pro5y for te service.
,is pro5y is used by te client application, to interact wit service. ,o create te pro5y, run te
4isual %tudio /$$@ command prompt. =sing service utility we can create te pro5y class and its
configuration information.
svcutil http://localhost/IISHostedService/MyService.svc
0fter e5ecuting tis command we will find two file generated in te default location.
'y%ervice.cs - 7ro5y class for te WCF service
output.config - Configuration information about te service.
!tep 4* "ow we will start creating te Console application using 4isual %tudio /$$@(Client
application).
!tep 7* 0dd te reference J%ystem.%ervice'odelJ! tis is te core dll for WCF.
!tep $* Create te obGect for te pro5y class and call te 6elloWorld metod.
static void Main.string:; args/
<
Creating 8ro+y for the MyService
MyServiceClient client = ne% MyServiceClient./0
Console.4rite6ine."Client calling the service..."/0
Console.4rite6ine.client.&ello4orld."7am"//0
Console.7ead./0
=
!tep 8* If we run te application we will find te output as sown below.
I ope you ave enGoyed te %ervice osted in II%. "ow let start te look on te self osted service.
!elf ,osting
In web service, we can ost te service only in II%, but WCF provides te user to ost te service in
any application (e.g. console application, Windows form etc.). 4ery interestingly developer is
responsible for providing and managing te life cycle of te ost process. %ervice can also be in-pro
i.e. client and service in te same process. "ow letJs us create te WCF service wic is osted in
Console application. We will also look in to creating pro5y using $Client%ase$ abstract class.
+ote* ,ost process must be running before the client calls the service0 which t&picall& means
&ou have to prelaunch it.
!tep 1* First let9s start create the !ervice contract and it implementation. Create a console
application and name it as -&Calculator!ervice. This is simple service which return addition
of two numbers.
!tep "* Add the !&stem.!ervice-odel reference to the pro:ect.
!tep 5* Create an I!impleCalculator interface0 Add !erviceContract and ;perationContract
attribute to the class and function as shown below. <ou will /now more information about
these contracts in later session. These contracts will e%pose method to outside world for using
this service.
I-&Calculator!ervice.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
namespace MyCalculatorService
{
[ServiceContract(!
pu"lic inter#ace $SimpleCalculator
{
[%perationContract(!
int &dd(int num'( int num);
*
*
!tep 6* -&Calculator!ervice is the implementation class for I-&Calculator!ervice interface
as shown below.
-&Calculator!ervice.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace MyCalculatorService
{
class SimpleCalculator + $SimpleCalculator
{
pu"lic int &dd(int num'( int num)
{
return num' , num);
*
*
*
!tep 2* +ow we are read& with service. =et9s go for implementing the hosting process. Create
a new console application and name it as 9-&Calculator!ervice,ost9
!tep 4* ServiceHost is the core class use to host the WCF service. It will accept implemented
contract class and base address as contractor parameter. <ou can register multiple base
addresses separated b& commas0 but address should not use same transport schema.
-ri .ttp-rl
/ ne0 -ri(1.ttp+22local.ost+34542MyService2SimpleCalculator1;
-ri tcp-rl
/ ne0 -ri(1net.tcp+22local.ost+34542MyService2SimpleCalculator1;
Service6ost .ost
/ ne0 Service6ost(typeo#(MyCalculatorService.SimpleCalculator( .ttp-rl(
tcp-rl;
-ultiple end points can be added to the !ervice using AddServiceEndpoint() method.
Host.Open() will run the service0 so that it can be used b& an& client.
!tep 7* )elow code show the implementation of the host process.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ServiceModel;
using System.ServiceModel.7escription;
namespace MyCalculatorService6ost
{
class 8rogram
{
static void Main(string[! args
{
22Create a -9$ to serve as t.e "ase address
-ri .ttp-rl / ne0
-ri(1.ttp+22local.ost+34542MyService2SimpleCalculator1;
22Create Service6ost
Service6ost .ost
/ ne0 Service6ost(typeo#(MyCalculatorService.SimpleCalculator(
.ttp-rl;
22&dd a service endpoint
.ost.&ddService:ndpoint(typeo#(MyCalculatorService.$SimpleCalculator