This print for content only-size & color not accurate 7" X 9-1/4" / casebound / malloy


Configuring the InvokeWebService Activities



Download 21,46 Mb.
Pdf ko'rish
bet1784/1830
Sana28.09.2021
Hajmi21,46 Mb.
#188411
1   ...   1780   1781   1782   1783   1784   1785   1786   1787   ...   1830
Bog'liq
[book] [en] Pro C# 2008 and the NET 3.5 Platform Fourth Edition

Configuring the InvokeWebService Activities

The final tasks are to pass the incoming data to the correct web method and print out the result.

Drag an InvokeWebService activity into the leftmost branch. Doing so will automatically open the

Add Web Reference dialog box, where you can specify the URL of the web service (which for this

example is http://localhost/MathWebService/Service.asmx) and click the Add Reference button

(see Figure 26-16).



Figure 26-16.

Referencing our XML web service

C H A P T E R   2 6  



I N T R O D U C I N G   W I N D O W S   W O R K F L O W   F O U N D AT I O N



939

8849CH26.qxd  10/10/07  11:46 AM  Page 939




When you do so, the IDE will generate a proxy to your web service and use it as the value to the

InvokeWebService’s ProxyClass property. At this point, you can use the Properties window to specify

the web method to invoke via the MethodName property (which is the Add method for this branch),

and map the two input parameters to your FirstNumber and SecondNumber properties and the return

value to the Result property. Figure 26-17 shows the full configuration of the first InvokeWebService

activity.



Figure 26-17.

A fully configured InvokeWebService activity 

You can now repeat this process for the remaining three IfElse branches, specifying the remain-

ing web methods. Do be aware that even though the Add Web Reference dialog box will appear for

each InvokeWebService activity, the IDE is smart enough to reuse the existing proxy, as each activity

is communicating with the same endpoint. 

Last but not least, we will add one final Code activity after the IfElse logic that will display the

result of the user-selected operation. Name this activity DisplayResult, and set the ExecuteCode

value to a method named ShowResult(), which is implemented as so:

private void ShowResult(object sender, EventArgs e)

{

Console.WriteLine("{0} {1} {2} = {3}",



FirstNumber, Operation.ToString().ToUpper(), SecondNumber, Result);

}

For simplicity, we are using the textual value of the Operation property to represent the selected



mathematical operator, rather than adding additional code to map MathOperation.Add to a + sign

C H A P T E R   2 6  



I N T R O D U C I N G   W I N D O W S   W O R K F L O W   F O U N D AT I O N



940

8849CH26.qxd  10/10/07  11:46 AM  Page 940




and MathOperation.Subtract to a - sign, and so on. In any case, Figure 26-18 shows the final design

of our workflow; Figure 26-19 shows one possible output.



Figure 26-18.

The completed web service–centric workflow

Figure 26-19.

Communicating with XML web services from a WF application


Download 21,46 Mb.

Do'stlaringiz bilan baham:
1   ...   1780   1781   1782   1783   1784   1785   1786   1787   ...   1830




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish