Friday, 5 August 2016

Developing WCF Service | Booking Service


In this walkthrough, I would build a WCF Service to support Banking Transaction in ATM. Create a new project, Open  VS 2012 >New Projects > Visual C#  >  WCF  > WCF Service Application.
Lets implement Booking service, below is the interface for booking service having single operation BookService. DataContracts are Booking Request and Booking Response as shown below.
Booking Service Implementation is shown below, its uses Hashtable to store transaction data. Validation is performed on the Booking Request and either on success or failure, booking response is constructed and echoed back to the client. Note, successful transactions are added to hashtable
Lets run the service and test it. Below is the service url and wsdl
Using test client, lets test the service. Service request should have unique contact number others, service responds stating already service request exists. There is max cap size of 10 set in  the hashtable. Beyond 10 unique request, service would respond back saying service is unavailable.
Considerations while develope WCF services for BizTalk interfaces:>>

BizTalk generates schema based on below details, 
Request DataContract :BookingRequest
Response DataContract: BookingRespone
Service Contract Method: BookService(Param Reqtype)
Service Contract Response schema gets auto-generated with a suffix "RESPONSE" to the Service Contract method "BookService", , as refer below.

Service Contract Method Response schema: BookService+Response >> BookServiceResponse

We should specify unique names Request, Response Data Contract and Service Contract Method, This would avoid duplicate schema for service contract response.

No comments:

Post a Comment

Note: only a member of this blog may post a comment.