{"id":554,"date":"2010-08-25T07:18:49","date_gmt":"2010-08-25T07:18:49","guid":{"rendered":"http:\/\/tw.newtonstudio.com\/?p=554"},"modified":"2010-08-25T09:44:50","modified_gmt":"2010-08-25T09:44:50","slug":"%e4%bd%bf%e7%94%a8php%e4%be%86%e8%99%95%e7%90%86silverlight-soap-%e4%b8%8b","status":"publish","type":"post","link":"https:\/\/tw.newtonstudio.com\/?p=554","title":{"rendered":"\u4f7f\u7528PHP\u4f86\u8655\u7406Silverlight (SOAP) (\u4e0b)"},"content":{"rendered":"<p>\u9019\u4e00\u7bc7\u5c07\u4ecb\u7d39\u5982\u4f55\u8b93Silverlight\u5728\u4e8b\u4ef6\u89f8\u767c\u4e4b\u5f8c\u50b3\u8f38\u8cc7\u6599\u7d66PHP\u7684SOAP web service.<\/p>\n<p>STEP1: \u5728VS2010\u7684Silverlight\u5c08\u6848\u6309\u53f3\u9375 &gt; Add Service Reference<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-555\" style=\"border: 1px solid black;\" title=\"step3\" src=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step3.jpg\" alt=\"step3\" width=\"449\" height=\"479\" srcset=\"https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step3.jpg 449w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step3-281x300.jpg 281w\" sizes=\"auto, (max-width: 449px) 100vw, 449px\" \/><\/p>\n<p>STEP2: \u78ba\u8a8d\u4f60\u7684wsdl \u5df2\u7d93\u4e0a\u50b3\u5230web server\u4e0a\u4e4b\u5f8c, \u5c07\u4ed6\u7684\u8def\u5f91\u8f38\u5165\u5728 &#8220;Address&#8221;\u7684\u6b04\u4f4d\u4e4b\u4e2d. \u4e26\u6309\u4e0b &#8220;Go&#8221;, \u5c31\u53ef\u4ee5\u770b\u5230ageService\u7684SOAP\u51fa\u73fe\u5728Services\u7684\u6b04\u4f4d\u4e2d.<\/p>\n<p>\u6b64\u5916, \u70ba\u4e86\u65b9\u4fbf\u8d77\u898b, \u6211\u5011\u4e5f\u5c07Namespace\u547d\u540d\u7a0b\u6210 &#8220;AgeService&#8221; (\u9019\u540d\u5b57\u5c07\u6703\u5728xaml.cs\u4e2d\u518d\u5ea6\u7528\u5230)<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-556\" style=\"border: 1px solid black;\" title=\"step4\" src=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step4.jpg\" alt=\"step4\" width=\"506\" srcset=\"https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step4.jpg 806w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step4-300x239.jpg 300w\" sizes=\"(max-width: 806px) 100vw, 806px\" \/><\/p>\n<p>Step3 : \u6309\u4e0bOK\u4e4b\u5f8c\u5c31\u6703\u767c\u73fe\u5c08\u6848\u6a94\u4e2d\u51fa\u73fe\u5169\u500b\u65b0\u7684\u6a94\u6848, \u4e00\u500b\u662fAgeService, \u53e6\u4e00\u500b\u662fconfig\u6a94. \u96d9\u64caconfig\u6a94.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-557\" style=\"border: 1px solid black;\" title=\"step5\" src=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step5.jpg\" alt=\"step5\" width=\"425\" height=\"520\" srcset=\"https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step5.jpg 425w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step5-245x300.jpg 245w\" sizes=\"auto, (max-width: 425px) 100vw, 425px\" \/><\/p>\n<p>Step4: \u4f60\u6703\u767c\u73fe\u525b\u525b\u8a2d\u5b9a\u7684\u6771\u897f\u5df2\u7d93\u88ab\u8a18\u9304\u5230Config\u6a94\u88e1\u9762\u53bb\u4e86.<\/p>\n<p><img decoding=\"async\" class=\"alignnone size-full wp-image-558\" style=\"border: 1px solid black;\" title=\"step6\" src=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step6.jpg\" alt=\"step6\" width=\"520\" srcset=\"https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step6.jpg 920w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/step6-300x156.jpg 300w\" sizes=\"(max-width: 920px) 100vw, 920px\" \/><\/p>\n<p>STEP5: \u63a5\u4e0b\u4f86\u662f\u8655\u7406XAML.CS\u4e2d\u7684\u4e8b\u4ef6, \u5176\u4e2d\u5305\u542b\u4e86\u5169\u500bfunction\u7684CODE:<\/p>\n<pre class=\"brush: c#; highlight: [10, 19];\">namespace SilverlightApplication2\r\n{\r\n    public partial class MainPage : UserControl\r\n    {\r\n        public MainPage()\r\n        {\r\n            InitializeComponent();\r\n        }\r\n\r\n        private void Button_Click(object sender, RoutedEventArgs e)\r\n        {\r\n\r\n            AgeService.ageServicePortTypeClient client = new AgeService.ageServicePortTypeClient();\r\n            client.getAgeCompleted += new EventHandler(client_getAgeCompleted);\r\n            client.getAgeAsync(txtName.Text);\r\n            HtmlPage.Window.Alert(txtName.Text);\r\n        }\r\n\r\n        void client_getAgeCompleted(object sender, SilverlightApplication2.AgeService.getAgeCompletedEventArgs e)\r\n        {\r\n            HtmlPage.Window.Alert(e.Result.ToString());\r\n        }\r\n    }\r\n}<\/pre>\n<p>STEP6: \u5c07Silverlight Application\u518dBUILD\u4e00\u6b21, \u4e26\u5c07\u65b0\u7684XAP\u6a94\u4e0a\u50b3\u5230\u9060\u7aef\u4e3b\u6a5f\u4e0a.<\/p>\n<p>STEP7: \u518dRUN\u4e00\u6b21index.php, \u4e26\u8f38\u5165\u95dc\u9375\u5b57 &#8220;alfie&#8221; \u5247\u8f38\u51fa&#8221;27&#8243;, \u9019\u6a23\u5c31\u5927\u529f\u544a\u6210\u4e86!<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-563\" style=\"border: 1px solid black;\" title=\"last\" src=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/last.jpg\" alt=\"last\" width=\"563\" height=\"262\" srcset=\"https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/last.jpg 563w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/last-300x139.jpg 300w\" sizes=\"auto, (max-width: 563px) 100vw, 563px\" \/><\/p>\n<p>\u6a94\u6848\u4e4b\u9593\u7684\u5c0d\u7167\u8868:<br \/>\n<a href=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/comparison.jpg\" target=\"_blank\"><img decoding=\"async\" class=\"alignnone size-full wp-image-564\" style=\"border: 1px solid black;\" title=\"comparison\" src=\"http:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/comparison.jpg\" alt=\"comparison\" width=\"500\" srcset=\"https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/comparison.jpg 900w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/comparison-150x150.jpg 150w, https:\/\/tw.newtonstudio.com\/wp-content\/uploads\/2010\/08\/comparison-300x300.jpg 300w\" sizes=\"(max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9019\u4e00\u7bc7\u5c07\u4ecb\u7d39\u5982\u4f55\u8b93Silverlight\u5728\u4e8b\u4ef6\u89f8\u767c\u4e4b\u5f8c\u50b3\u8f38\u8cc7\u6599\u7d66PHP\u7684SOAP web service. S [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,43],"tags":[70,171],"class_list":["post-554","post","type-post","status-publish","format-standard","hentry","category-php-","category-silverlight-20","tag-php","tag-silverlight"],"_links":{"self":[{"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts\/554","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=554"}],"version-history":[{"count":7,"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions"}],"predecessor-version":[{"id":568,"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=\/wp\/v2\/posts\/554\/revisions\/568"}],"wp:attachment":[{"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=554"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=554"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tw.newtonstudio.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=554"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}