Creating guidance Package WCF Web Service

  1. Creating Guidance Service Factory Model Project
  2. Creating Service Contract Model
  3. Creating XML Schemas for Service Contract
  4. Creating Data Contract Model
  5. Creating WCF WebService
  6. Creating Host Model

Steps1

Create new project in VS2008

In Guidance PackagesSelect Service Factory

Click on OK

Right click on ExampleServiceService Factory Modeling Edition

  1. Add new ServiceContract model

Give model name: ExampleServicecontract

XML Namespace:

Click on Finish

From toolbox

  1. drag two XSD Message
  2. Click on left side XSD Message Box and press F4 for properties
  3. In a property change Is WrappedFalls to True
  4. Change Name to ExmpDataServiceRequest
  5. Change name for right side XSD Message Box as ExmpDataServiceResponse and alsoIs WrappedFalls to True

  1. Add one Operation change name as GetExampleDataOperationby pressing F4 or Click on the name
  2. Right click on Faults and add new data contract fault change the name as ExampleFaultMessage

  1. Same as above how you are adding XSD Message Box (XML Schema) & Operations, like that you have to add
  2. ServiceContract change name as ExampleDataServiceContract
  3. Service change name as ExampleDataService
  1. Now you complete Half of Service Contract Design
  1. Click on Connector
  2. Come on the design drag from Request XSD file (left side) to Operation
  3. then Operation to Response XSD
  4. Operation to Service Contract
  5. Service Contract to Service

Adding XML Schemas for XSD Message files

  1. Add two XML Schemas because you added two XSD Message
  2. Always Left XSD Message is Request and Right is Response
  3. You have to give a name for two XML Schemas such a way that you can identify which schema is for which XSD Message

Example

XSD MessageXML Schema

AbcDataTransferRequestDataTransferRequest

WiproFacilityUsageRequestFacilityUsageRequest

Like this you can make out this XML for This XSD

  1. Change both the schema name as
  2. DataServiceRequest
  3. DataServiceResponse

In each xml file you add

xs:elementname="FacilityMgmtRequest"

<xs:complexType

<xs:sequence

<xs:elementname="facilityusage"

<xs:complexType

<xs:sequencemaxOccurs="unbounded"

<xs:elementname="datarow"

<xs:complexType

<xs:sequence

<xs:elementname="FacilityID"type="xs:integer"</xs:element

<xs:elementname="Name"type="xs:string"</xs:element

<xs:elementname="LocationID"type="xs:integer"</xs:element

</xs:sequence

</xs:complexType

</xs:element

</xs:sequence

</xs:complexType

</xs:element

</xs:sequence

</xs:complexType

</xs:element

  1. now you come to ServiceContract design and select Request XSD Message got to propertiy and click on element
  2. select request element from request XML Schema
  3. do same for response also

if get no element found

Then go to respected XML Schema delete

xmlns:mstns="

then try you will get element after that undo the deleted one.

below image for request XSD Message do same for Response XSD

Adding new Data Contract

Model Name: ExampleDataContract

XML Namespace:

  1. Add One Fault Contract
  2. Change name as ExampleFaultContract
  3. Add one primitive data type in members
  4. Change name as ExampleFaultMessage

Creating WCF WebService

On Solution Explorer add new WCF Implementation Projects

New of WCF web service name is ExampleWCFService

It will generate automatic code for all like

  1. Business Logic (Folder)
  2. BusinessEntities
  3. BusinessLogic
  4. Resource Access(Folder)
  5. DataAcess
  6. ServiceInterface (Folder)
  7. DataContracts
  8. FaultContracts
  9. MessageContracts
  10. ServiceContracts
  11. ServiceImplementation
  12. Test(Folder)
  13. Host
  14. Client

Setting some properties in DataContract Design ServiceContract Design Pages

1.Come to DataContract Design Page Press F4 you will get

Select Implementation Technology is WCF Extension

Project Mapping Table is ExampleWCFService

Right click on DataContract Design Page and click on Validate

You shouldn’t get any error

If you don’t get any error go a head with generate code by pressing right click on design page

2.

Select Type by press F4 on ExampleFaultMessage in ServiceContract Design Page

3. Come to serviceContract Design Page press F4 you will get

Select Implementation Technology is WCF Extension

Project Mapping Table is ExampleWCFService

Right click on the ServiceContract Design page and click on Validate All

You shouldn’t get any error

Rebuild your Service Solution

Settings in Host

Double Click on Examplehost

You will find Host Model Explore on right side

Right click on the Host Model and Add New Host Application

You will get HostApplication1 Goto Properties of it and change

  1. Implementation Project
  1. Implementation Technology as WCF
  1. Change Name as ExampleHost

Right Click on the host add new Service Reference

Go to Property of the ServiceReference1

  1. change Enable Metadata Publish False to True
  2. Change name as ExampleService
  3. Select the Service Implementation

Adding New EndPoint to Host Model

Change the name of Endpoint1 to ExampleEndpoint

Right click on ExampleEndpoint and select ValidateAll

Click on ExampleService you will see like this and click on Generate Code

This is the End of All type of setting on Design

Lets Start with Coding in Service and interact with application