You are on page 1of 6

15-Minute Walkthrough

For Web Service Software Factory 2010

Overview
This walkthrough is intended to serve a couple of purposes. It provides a way to experience much of
what the Service Factory has to offer if you dont have enough time to complete the hands-on lab. This
walkthrough can also serve as an effective demonstration for anyone needing to deliver a presentation
about the Service Factory 2010.
The first time you complete this walkthrough, it may take longer than 15 minutes if you choose to poke
around a little. However, if you do the steps from start to finish, it will take approximately 15 minutes.
Also, because this walkthrough is trying to respect your time, you wont find much explanatory text.
Please use the hands-on labs and factory documentation for a more comprehensive introduction.

Scenario
This walkthrough shares the same scenario as the hands-on lab. If you are interested, you can find the
scenario in the Service Factory documentation.

Instructions
To complete this walkthrough, your computer must have the Service Factory 2010 installed, along with
all of the required system requirements. To make sure your computer has everything it needs for the
walkthrough; see the System Requirements topic in the Service Factory 2010 Documentation.
As you go through the walkthrough, you might receive some Validation Errors at the beginning but they
will cease to exist in the end.

Set Up the Starter Solution


A starter solution is being provided to give you a considerable head start. The remaining instructions
assume you are using it. Extract the contents of the ZIP file provided to C:\Temp\15MinDemo, and open
the BlueYonderAirlines.sln file. (Remember to open Visual Studio 2010 as Administrator.)

Complete the Data Contract Model


The following steps will add a new data contract to the model, connect it to an existing data contract,
and add a new property to it:
1. Open the CommonScmTypes.datacontract file (Right click and use Open With Web Service
Software Factory 2010 DC Model).
2. In the Toolbox (CTRL+ALT+X to open), select the Aggregation tool. Select the Vendor data
contract, and then select the AircraftPart shape. This will add a Vendor property to the
AircraftPart shape.
3. Using the Properties window, rename the new Vendor property on the AircraftPart shape to
PreferredVendor.
4. Save the CommonScmTypes.datacontract file.

Complete the Service Contract Model


The following steps establish dependency relationships with items inside and outside of the model:
1. Open the MaterialMgmt.servicecontract file (Right click and use Open With Web Service
Software Factory 2010 SC Model).
2. In the GetDemandRequest message, select the AircraftPart part. In the Properties window (F4
to open), choose the ellipsis button () for the Type value. In the Create reference to element
dialog box, click on Browse, select \15 Minute
Walkthrough\BlueYonderAirlines\CommonScmTypes.datacontract, Expand DataContract,
choose the AircraftPart data contract and choose OK.
3. In the SetDemandResponse message, right click on Parts, click on Add new Primitive Message
Part, change the name to ErrorMessage.
4. There are other external dependencies on this model that have already been established for
you. For example, on the XSD Message shapes (i.e. PartAvailabilityRequest), a dependency is
created through the Element property.
5. Save the MaterialMgmt.servicecontract file.

Choose the Implementation Technology


The following steps define WCF as the implementation technology for the service and data contract
models:
1. With the MaterialMgmt.servicecontract file open, click on the white design surface. In the
Properties window, choose WCF Extension as the value of the Implementation Technology
property.
2. For both the GetDemandRequest and SetDemandRequest messages, use the Properties
window to change the IsWrapped property to True.
3. Open the CommonScmTypes.datacontract file.
4. Click on the white design surface. In the Properties window, choose WCF Extension as the value
of the Implementation Technology property.
5. For each member within each data contract, sequence their Order properties with unique
values starting with zero. For example, for the AircraftPart data contract leave the Order
property of PartNumber to 0 and set the Order property of PartLevel to 1 and Order of
PreferredVendor to 2.
6. Select the Contacts data contract collection shape and in the Properties window, select List<T>
as the value for the CollectionType property.
7. Open the StandardDeployment.host file (Right click and use Open With Web Service Software
Factory 2010 Host Model).
8. Using the Host Explorer (View > Other Windows > Host Explorer to open), select the
EastCoastDataCenterFarm4 host application, and in the Properties window, choose WCF
Extensions as the value of the Implementation Technology property.
9. Select the MfgWinformClient client application and in the Properties window, and then choose
WCF Extensions as the value of the Implementation Technology property.
10. Using the Properties window, change the EnableMetadataPublishing property to True for both
the MaterialMgmt and VendorGateway service references.
11. Save all of the open files.

Unfold and Connect the Implementation Projects


The following steps will create the projects where the code will be generated and connect the models
to the projects using a mapping table:
1. In Solution Explorer (CTRL+ALT+L to open), right-click the BlueYonderAirlines solution, and then
choose Add/WCF Implementation Projects
Note: If this doesnt appear, go to Tools Guidance Package Manager and click on Enable/
Disable Packages. Check the Web Service Software Factory 2010, click on OK, and then click on
Close. Then do Step 1 again.
2. Ensure the Project type (left pane) is Guidance Packages\Web Service Software Factory 2010
and the Template (right pane) is WCF Implementation Projects.
3. Type BYA.Mfg.SCM in the Name textbox, and then click OK. At this point, the solution structure
will unfold and projects will be created. This may take a few seconds.
4. Open the MaterialMgmt.servicecontract file, and then click on the design surface.
5. In the Properties window, choose BYA.Mfg.SCM as the value for the Project Mapping Table.
6. Open the CommonScmTypes.datacontract file, and then click on the design surface.
7. In the Properties window, choose BYA.Mfg.SCM as the value for the Project Mapping Table.
8. Save both the CommonScmTypes.datacontract and MaterialMgmt.servicecontract files.

Complete the Host Model


The following steps create a new proxy and endpoint as well as associate the model elements with
their related project:
1. Open the StandardDeployment.host file.
2. Using the Host Explorer, select the EastCoastDataCenterFarm4 host, and for the
Implementation Project property in the Properties window, select
BlueYonderAirlines\BYA.Mfg.SCM\Tests\BYA.Mfg.SCM.Host as the project. After the project is
selected, use the Enter key to ensure the project is selected.
3. Select the MfgWinformClient client, and for the Implementation Project property in the
Properties window, select BlueYonderAirlines\BYA.Mfg.SCM\Tests\BYA.Mfg.SCM.Client as the
project. After the project is selected, use the Enter key to ensure the project is selected.
4. Save the StandardDeployment.host file.

Generate the Source Code and Run the Service


The following steps generate the code for each of the models
1. Open the CommonScmTypes.datacontract file, right-click on the design surface, and choose
Generate Code.
2. Open the MaterialMgmt.servicecontract file, right-click on the design surface, and choose
Generate Code.
3. Open the StandardDeployment.host file and using the Host Explorer, select the MaterialMgmt
Service Reference, right-click on the design surface, and choose Generate Code. Repeat this
step for the VendorGateway Service Reference.
4. In Solution Explorer, right-click the host project, and choose Build Web Site. After the project
builds, right-click the host project again, and then choose View in Browser. This will start the
service so you can query its metadata in the next step.
5. Open the MaterialMgmt.cs file within the BYA.Mfg.SCM.ServiceImplemntation project and
change the following code:
public virtual BYA.Mfg.SCM.MessageContracts.GetDemandResponse
GetPartDemand(BYA.Mfg.SCM.MessageContracts.GetDemandRequest request)
{
return null;
}

to
public virtual MessageContracts.GetDemandResponse
GetPartDemand(MessageContracts.GetDemandRequest request)
{
return new MessageContracts.GetDemandResponse() {
PartLevel = request.AircraftPart.PartLevel
};
}

6. Using the Host Explorer, select the MaterialMgmtProxy, right-click on the Proxy shape (Triangle
Shape on MfgWinFormClient) and click on Add Service Reference. In the popup that opens, click
on Discover button. Select the BYA.Mfg.SCM.Host/MaterialMgmt.svc. Change the Namespace
to MaterialMgmtServiceReference and click OK.
Repeat this step for the VendorGatewayProxy. (Choose BYA.Mfg.SCM.Host/VendorGateway.svc
and change the Namespace to VendorGatewayServiceReference.)

7. Open the MainForm.cs file, and add the following using statement:
using BYA.Mfg.SCM.Client.MaterialMgmtServiceReference;
using BYA.Mfg.SCM.Client.VendorGatewayServiceReference;

8. Add the following code within MainForm.cs file in ExecuteButton_Click method:


PartLevel level = new PartLevel() { IncomingLevel = 1000, OnHandLevel = 1000
};
AircraftPart part = new AircraftPart() { PartLevel = level, PartNumber = "1"
};
GetDemandRequest request = new GetDemandRequest() { AircraftPart = part, Date
= DateTime.Now };
MaterialMgmtContractClient proxy = new MaterialMgmtContractClient();
PartLevel returnedLevel = proxy.GetPartDemand(request);
ResultsGrid gridDialog = new ResultsGrid(returnedLevel);
gridDialog.ShowDialog(this);
proxy.Close();

9. All of the generated source code can be found in the Generated Code folder of each project
(except the client proxies, which are in the Service References folder).
10. Set BYA.Mfg.SCM.Client as the StartUp Project. Build and run the solution. Click on Execute.
You will be able to see the results grid with values.

More Exercise
For a more in-depth exercise with the Service Factory, please spend some time with the hands-on labs.

You might also like