Pablo Cibraro, Kurt Claeys, Fabio Cozzolino, Johann Grabner. Wrox Programmer to Programmer™. Join the discussion @ portal7.info Professional. WCF 4. Professional WCF Programming covers everything you need to know about WCF, He is the author of Professional SQL Server XML by Wrox, writes the. chapters: WCF OVERVIEW; WCF Concepts; Understanding WCF; Addresses; WCF BINDINGS; WCF CONTRATS; cLIENTS; sERVICES; Transactions and.
|Language:||English, Spanish, German|
|Genre:||Science & Research|
|ePub File Size:||18.53 MB|
|PDF File Size:||16.34 MB|
|Distribution:||Free* [*Sign up for free]|
the author of Professional SQL Server XML by Wrox, writes the bi-weekly feature article for Chapter 5: Understanding and Programming WCF Bindings. Excerpted from Professional WCF portal7.info Development with the Windows(r) Communication Foundation,. Wrox Press, portal7.info Professional WCF portal7.info development with the Windows Communication Foundation. Wrox professional guides. Material. Type. Book. Language.
I have schwser notes from I passed L1 without doing any exercises, but had not enough time to do L2 properly. The problem may be you are a moron! A mendicant person here would be happy to have that garbage. Based on User Reviews and Ratings, we have provided a complete list of the same below. The Level I CFA exam is often considered the most difficult of the three CFA exams due to its integration of topics, higher expectation of analytical skills, and item set format. Not only must you learn the curriculum, but you must also comprehend how to apply your knowledge when answering item set questions. Our instructors have years of experience and know what it takes to pass the Level II exam…let them teach you.
This interface has a single State property, of type CommunicationState, which is used to return the cur- rent state of the object. When an ICommunicationObject is instantiated, its default state is Created. While in the Created state, the ICommunicationObject can be configured but it cannot send or receive communication. For example, any of the events listed earlier can be registered. Once the object is in the Open state, it can send and receive messages, but it no longer can be configured.
The Open method must be called for the object to enter the Opened state. The object will stay in the Open state until its transition to the Closed state is finished. The Close method allows any unfinished work to be completed before transitioning to the Closed state. The Abort method does not exit grace- fully, meaning all unfinished work is ignored.
The Abort method can also be used to cancel any and all outstanding operations, and that includes outstanding calls to the Close method. Keep in mind that the Abort method will cause any unfinished work to be cancelled. Use transactions, discussed in Chapter 9, if you want work grouped as a single unit. Programming Windows Communication Foundation IExtensibleObject The IExtensibleObject interface provides extensible behavior in the client, meaning that it enables the object to be involved in custom behaviors.
In WCF, the extensible object pattern is used to add new func- tionality to existing runtime classes, thereby extending current components, as well as adding new state features to an object. This interface exposes a single property to provide this functionality. The Extensions property, of type IExtenstionCollection, is used to return a collection of extension objects that can then be used to extend the existing runtime classes.
There are also a small handful of methods that you can use to return the creden- tial information. This allows client applications to have access to client-side runtime functionality directly. This information includes the SessionId, Input and Output session, as well as the local and remote endpoints that are currently com- municating with the client in the session.
This information is provided by the following properties: Returns the input session for the channel. Returns the output session for the channel.
Returns the local endpoint for the channel. Returns the remote address connected with the channel. Returns the current session identifier. Returns, or sets, the time in which the operation has to complete. If the operation does not complete in the specified time, an exception is thrown. Tells WCF to store messages before handing them off to the transport. There are two AllowOutputBatching properties, one that is applied at the channel level and one that is applied at the message level.
Clients the channel-level AllowOutputBatching property. If the message-level AllowOutputBatching property is set to true, the message will be sent immediately even if the AllowOutputBatching property is set to true at the channel level. Keep in mind that the AllowOutputBatching property can affect the performance of the system because you are telling WCF to store outgoing messages in a buffer and send them out with other messages as a group.
Your message delivery needs will affect how this setting is configured. Setting this property to true means that message throughput and delivery is essential to you, and setting it to false will reduce latency.
Channel Factories It is important that you understand the client objects and client channel objects because both of these uti- lize the ChannelFactory object. The ChannelFactory object is responsible for creating and supporting all the runtime client invocations.
As stated earlier, you can either create clients on demand using the ChannelFactory or by using the Service Model Metadata Utility svcutil.
The svcutil utility automatically generates the handling of the ChannelFactory, but as stated before, creating the channels on demand provides you more control over the creation and handling of the channels. For example, you can repeatedly create a new channel from an existing factory.
The following code illustrates using the ChannelFactory to create a channel to a service by specifying the service contract name: CreateChannel bb, ea ; client. PlaceOrder Val1 ; In this example, the address and binding were specified in code and passed as parameters to the CreateChannel method. The following section details the ChannelFactory class, which is used to create and manage channels that are used by the clients to send messages and communicate with service endpoints.
ChannelFactory Class The following sections list many of the important constructors, properties, and methods of the ChannelFactory class. Constructors The ChannelFactory class has a single constructor called ChannelFactory, and it is used to instantiate a new instance of the ChannelFactory class, as illustrated in the previous example.
The following code snippet, taken from the previous example, shows the instantiation of the ChannelFactory class: Returns the credentials used by the client to communicate with the service end- point, via the channel created by the factory. Returns the endpoint that the channel created by the factory connect.
Returns the value of the current communication object state. The use of credentials requires a reference to the System.
Description namespace, which needs to be added via a using statement: Description; Once you have access to the System. Description namespace, you can configure client and service credentials as well as provide credentials for authenticating on the proxy side. The following example illustrates how to provide credentials for proxy side authentication when creating a channel: WriteLine factory. Endpoint ; Methods The following methods are exposed by the ChannelFactory class.
Immediately transitions the communication object from its current state into the closing state. Begins an asynchronous operation to close the current communication object.
Transitions the object from its current state into the closed state. Finishes the asynchronous close on the current communication object. Finishes the asynchronous open on the current communication object. Transitions the object from the created state into the opened state. The following can be used to explicitly open a channel: CreateChannel ; factory. Open ; channel.
DoSomething ; The following can be used to implicitly open a channel: CreateChannel ; channel. DoSomething ; The difference between the two previous examples is that by explicitly opening the channel you have more control over the creation and management of the channel. Be sure to close the channel factory when you are done with it: Typically in code you will create a channel that is configured with a specific binding and endpoint.
In most of the exam- ples you have seen, a channel has been created to an endpoint that has been configured with a specific binding, as shown here: CreateChannel bb, ea ; textbox1. Programming Windows Communication Foundation The CreateChannel method takes a number of overloads that can be used to create the channel as described in the following table.
CreateChannel EndpointAddress Creates a channel used to send messages to the specified endpoint address. CreateChannel String Creates a channel used to send messages to a service whose endpoint is configured in a spec- ified way. CreateChannel Binding, EndpointAddress Creates a channel used to send messages to a service endpoint at the specified endpoint and configured with the specified binding.
CreateChannel EndpointAddress, Uri Creates a channel used to send messages to a service endpoint at the specified endpoint through the specified transport address. CreateChannel Binding, EndpointAddress, Uri Creates a channel used to send messages to a service endpoint at the specified endpoint and configured with the specified binding and transport address. Asynchronous communication is discussed later on in this chapter. Client Communication Patterns Now that you understand how channels are created and function, this section describes the different types of communication that can take place between the client and the service endpoint.
One-Way One-way communication is just that, it is communication in a single direction. That direction flows from the client to the service. No reply is sent from the service, and the client does not expect a response. In this scenario, the client sends a message and continues execution. Figure illustrates a one-way communication. The client sends a message to the service, and execution takes place on the service. No response is sent back to the client from the service.
This tells the service that no response is required. The following code example illustrates setting a one-way communication: The InitiateOrder and FinalizeOrder operations are defined as one-way operations, whereas the PlaceOrder operation is not.
When the client calls the InitiateOrder service operation, it will immedi- ately continue processing without waiting for a response from the service. However, when the client calls the PlaceOrder service operation, it will wait for a response from the service before continuing. Request-Reply Request-reply communication means that when the client sends a message to the service, it expects a response from the service. Request-reply communication also means that no further client execution takes place until a response is received from the service.
Figure illustrates a request-reply communication. The client sends a message to the service, the serv- ice operation takes place, and a responding message is sent back to the client. Further client execution is paused until the responding message is received by the client.
This tells the service that a response is required. The default value for the IsOneWay parameter is False, so the second method is to not include the IsOneWay parameter at all and the operation will be a request-reply communication by default. The following code example, taken from the previous example, illustrates setting a request-reply com- munication: The InitiateOrder and PlaceOrder operations are defined as request-reply operations, whereas the FinalizeOrder operation is a one-way communication.
The InitiateOrder is explicitly defined as a request-reply communication by setting the IsOneWay parameter to False, whereas the PlaceOrder method is a request-reply communication by default because no specific communication method is specified, thereby being a request-reply communication by default.
Therefore, the client will wait for a response from both the InitiateOrder and PlaceOrder operations, but not on the FinalizeOrder operation.
Duplex Duplex communication is the ability of both the client and service to initiate communication, as well as respond to incoming messages; in other words, bi-directional communication, or duplex messaging pat- tern. With duplex communication, the service can not only respond to incoming messages, but it can Excerpted from Professional WCF Programming: Clients also initiate communication with the client by sending request messages seeking a response message from the client.
The client communication with the service does not change, meaning that it still communicates with the service via a proxy.
However, the service communicates with the client via a callback, as shown in Figure The following sec- tions describe the service and client requirements for building duplex communication service and client. A full example is given at the end of the chapter. Service In all of the examples so far the WCF service has consisted of a single interface and a class that imple- ments that interface.
For duplex communication, the service must contain two interfaces. The purpose of the first, or primary, interface is used for client-to-service communication, meaning that it is used to receive messages from the client, as you have seen in all the examples so far. The second interface, or callback interface, is used for service-to-client communication, to send messages from the service to the client. The trick to remember is that both of these contracts must be designated as one-way contracts because the second interface, or callback, is handling the communication from the service to the client.
The following example illustrates how to define a duplex service contract. The first step is to define the interface that makes up the service side of the duplex contract: Programming Windows Communication Foundation The second step is to create the callback interface. This is the interface that will send the results of the preceding operations back to the client: This links the two interfaces: To do this correctly, a service behavior needs to be added to the class.
This is accomplished by adding the [ServiceBehavior] attribute to the service class. Once the behavior attribute has been added, the PerSession value of the InstanceContextMode parameter on that behavior attribute needs to be set. This creates an instance of the service for each outbound duplex session: PerSession ] public class DuplexServiceClass: The service contains two interfaces, one of which is the callback for sending messages to the client.
You also have a service class that implements the duplex service. The second part of this equation is to modify the client to handle duplex communication. Client For duplex communication, the client must also take some responsibility for this type of communication, and therefore must implement the callback contract.
It does this by implementing the callback interface of the duplex contract: This is done by creating an instance of the InstanceContext in the client class: All of the examples in the book so far have used an added service reference. Programming Windows Communication Foundation However, the same can be accomplished using the svcutil utility, or by using the ChannelFactory as dis- cussed earlier in this chapter. The DuplexChannelFactory class provides the ability to create and maintain duplex channels, which are used by clients to send and receive messages between endpoints.
It is through the duplex channel that clients and services can communicate with each other independently. This is important because both sides can initiate communication with the other party. Creating a duplex client proxy using the DuplexChannelFactory is quite simple and not that different from the examples given earlier in this chapter using the ChannelFactory.
The CreateChannel method of the DuplexChannelFactory class allows you to create a duplex client proxy.
This method requires the serv- ice contract name as a generic parameter. The following example illustrates how to create a duplex channel that the client and service can use for communication: CreateChannel bb, ea ; textbo1. AddNumbers; IServiceClass. Close ; IServiceClass. Dispose ; As you can see, using the ChannelFactory to create duplex client communication is easy. Lastly, operations of a service can be called and accessed synchronously or asynchronously. The next sec- tion discusses calling a service asynchronously.
Asynchronous Calling methods asynchronously allows applications to continue processing other work while the called method is still executing. Like the duplex communication, asynchronous operations require specific changes to the client and to the service.
So, like the duplex example, the following sections describe the service and client require- ments for building an asynchronous communication service and client. Service Asynchronous operations divide the operation into two separate but related operations. The first opera- tion is the Begin operation, which the client calls to start operation processing.
In a Begin operation, two additional parameters need to be passed to the operation and the return value is a System. The first parameter s in the Begin method is the value or values you wish to pass it.
The second param- eter is a callback object, and the third parameter is the state object. The callback object is provided by the client and runs when the called operation is complete. Clients when the operation is finished. For example, you would normally pass the client proxy because this tells the callback function to automatically call the End operation and return the result.
The second operation is a matching End operation that takes the System. IAsyncResult as a parameter and returns a return value. The End operation does not need an [OperationContract] attribute.
The Begin operation must contain the AsyncPattern property with the value of that property set to True. The following code illustrates defining an asynchronous communication service operation: Client On the client side of an asynchronous service, the client simply needs to pass the correct parameters and make sure that the returned results are of the IAsyncResult type.
To access the asynchronous service operation, the client first calls the Begin operation, which in the following example is the BeginAdd operation. In that call, a callback function is specified through which the results are returned, in this case the callbackAdd function. When the callback function executes, the client calls the End operation to obtain the results, which in the following example is the EndAdd operation: BeginAdd 2, 2, callbackAdd, client ; client.
IServiceClass ar. EndAdd ; textbox1. Creating Client Code Most, if not all, of the examples so far throughout the book have used an added service reference to con- sume the service and build the client. The syntax and options for this tool were covered in detail in Chapter 3.
This section provides a few examples of using the Service Model Metadata Utility Tool to generate client code. Generating Client Code The svcutil utility is a command-line tool that generates client code from service metadata. From this tool, proxy classes, contracts data, service, and message , and configuration files can be generated to be added to your client application. The svcutil utility assumes a number of defaults if left blank, such as the language and the output file name.
The default language is C and the output filename that is generated is taken from the service contract namespace.
Even though the two aforementioned values are defaulted, it is good practice to specify those values to make sure you are getting what you are intending. The following example illustrates specifying the lan- guage and output file for the examples in Chapter 6: For example, the following generates a message contract type. Remember the message example from Chapter 6?
The following code is from that example, and in the highlighted line the message is being passed from the client to the service.
BookOrder ; Val1. Text; int. TryParse textBox2. Text, out intval ; Val1. Text; Val1. PlaceOrder Val1 ; textBox2. OrderNumber; The svcutil utility can also export metadata for contracts, services, and data types contained in compiled assemblies. For example, the following command exports the data types from the data contract example in Chapter 6: The following code was taken from the first example in Chapter 5 where every- thing was defined in code.
The first two lines define the addresses and transports of the service endpoints. The second line creates a service host for the service passing in the two addresses. The third and fourth lines define the two bind- ings that the endpoints will use.
The remaining code defines the endpoints that will be exposed on the service, associates the addresses and bindings with those endpoints, and then finally associates those endpoints with the service and the service host and then starts the service host: Add mBehave ; sh.
Open ; Although this works, hopefully you have learned over the past few chapters that this method is not the most efficient method. Suppose you wanted to add a binding or endpoint address? That would require you to modify the code and rebuild the application. The following is the configuration-based version of the preceding code. The same endpoints, addresses, and bindings are specified.
This configuration should look familiar because it is the exact same configu- ration from the service host project that the past handful of examples from the last three chapters have used: ServiceClass ; sh.
Open ; Now suppose you want to add an additional binding or endpoint address? Is a recompile necessary? Not at all. The only thing you need to modify is the configuration file to add the necessary components.
The purpose of this section is to illustrate that defining endpoints addresses and bindings can be done a number of ways. There are benefits to both, but the majority of the time you should steer toward using configuration rather than inline code. Typed versus Untyped Ser vices Chapter 3 spent a page or two discussing the different types of services.
The two major types are typed and untyped services. As explained in Chapter 3, typed services function a lot like a class method, in that they take parameters and return results if needed. Untyped services let the developer have much more control and flexibility by providing the ability to work at the message level. The following two sec- tions take a look at the client side on how to work with the two types of services.
Invoking Operations of a Typed Services Most of the examples so far in this book have utilized typed services. The client calls the service using a proxy, and the service can return a result if necessary. Vikash says 6 months ago.
Tapz says 5 months ago. Wei Seong says 5 months ago.
Raam says 4 months ago. Tochukwu says 4 months ago. I certainly agree with drcfa. Just wondering if there would be any people that will still use Schweser when there is a good study site here for free.
I've spent hours comparing notes of the two but cannot really tell any big difference. Level2Guy At the beginning of this year I checked out Schweser from a friend and I feel that they are too condensed. Moreovers cfacenter's notes are better written.
The problem with Schweser is that there are not enough exercises within the notes, what reduces dramatically its quality and effectiveness. Their online package is a complete garbage. He told me that more than half of his classmates fell the exam. Not a great idea to download Schweser. I passed LI with textbooks and Schweser notes along with cfacenter practice exams. The Schweser notes were useful in a limited sense, as they gave me a concise summary of what the AIMR-mandated reading was.
But for the amount of money Schweser charges, you're better off combining cfacenter with the books. Yeah, I also think the Schwester exercise too easy. I can get full score with that! Schweser gets a bad reputation, but i know a lot of people that like them. Their notes are not as complete they don't give detailed explanations and seem to be brief mainly because i think they assume you know the info, or have had some knowledge of it in the past I think their videos are great.
I don't think it really matters what you have, its really the amount of time you study and the effort you put into it. If two people using schweser and cfacenter both study for hours, they will have the same chance of passing. Stoyan Schweser can be helpful ONLY if you have solid financial and accounting background because it is only an overview and there are not many detailed explainations. Schweser's typeset always made me feel tired,why can't they just print clearly?!
Nevil1 I passed Level I in June. I read schweser notes. I felt they were too condensed. The practice questions online were too easy. DirtyHarry I agree with Stoyan. Schweser doesn't explain throughly. So, anyone read it, must have previous background in finance or accounting and economic.
It all depends on the person, doesn't it. Many people will fail. Some used Schewser, some Stalla, some analystnotes, some go through all the readings. Many failures will blame the notes. I have even heard people blame the required course materials i. I passed all three exams in a row. I also attended some courses expensive for the sake of getting some human conact - but they were pretty lame. I agree with Wassup - study hard! And if you can't do it, it wasn't meant to be.
I used Schweser Notes as only a starter. I used Schweser notes for my L1 exam. Mine is a sad story!