08.01.2015 Views

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

Beginning Web Development, Silverlight, and ASP.NET AJAX

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

228<br />

CHAPTER 9 ■ .<strong>NET</strong> 3.0: WINDOWS WORKFLOW FOUNDATION<br />

9. You’ll see that the <strong>Web</strong>ServiceInput <strong>and</strong> <strong>Web</strong>ServiceOutput activities are no longer<br />

showing any errors. However, you still need to perform one more step—the conversion<br />

of centigrade to Fahrenheit, which you do by adding a new Code activity<br />

between the existing activities (see Figure 9-17).<br />

Figure 9-17. Adding a Code activity between the input <strong>and</strong> the output<br />

10. Generate an ExecuteCode h<strong>and</strong>ler using the Properties dialog, <strong>and</strong> the IDE will generate<br />

the code h<strong>and</strong>ler, wire it up to the workflow, <strong>and</strong> then open the code<br />

window. Edit the h<strong>and</strong>ler so that it reads like this:<br />

private void codeActivity1_ExecuteCode(object sender, EventArgs e)<br />

{<br />

_fahrenheit = 32 + ((9 * _centigrade) / 5);<br />

}<br />

The environment is taking the burden of mapping the input from the web service<br />

caller to _centigrade, <strong>and</strong> mapping _fahrenheit to the output that is sent back to<br />

the caller. This function derives one from the other using the st<strong>and</strong>ard centigradeto-Fahrenheit<br />

formula.<br />

11. The next step is to publish this library as a web service. You do this by selecting the<br />

project in the Solution Explorer, right-clicking, <strong>and</strong> selecting Publish as <strong>Web</strong> Service<br />

from the context menu (see Figure 9-18).

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!