{"id":221,"date":"2010-06-06T10:43:01","date_gmt":"2010-06-06T02:43:01","guid":{"rendered":"http:\/\/inout.asia\/?p=221"},"modified":"2010-06-06T10:43:01","modified_gmt":"2010-06-06T02:43:01","slug":"%e8%92%8b%e5%bd%aaweb-service%e7%9a%84%e8%af%a6%e7%bb%86%e6%95%99%e7%a8%8b%e5%92%8c%e5%8d%8f%e8%ae%ae%e5%88%86%e6%9e%90","status":"publish","type":"post","link":"https:\/\/blog.my0513.com\/?p=221","title":{"rendered":"\u848b\u5f6a:Web Service\u7684\u8be6\u7ec6\u6559\u7a0b\u548c\u534f\u8bae\u5206\u6790"},"content":{"rendered":"<h1>Web\u00a0Service\u6280\u672f\u5185\u5e55<\/h1>\n<p>&#8211;Web Service\u7684\u8be6\u7ec6\u6559\u7a0b\u548c\u534f\u8bae\u5206\u6790<\/p>\n<p>2010\/2\/25\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u848b\u5f6a\u00a0\u4e8e\u5357\u4eac<\/p>\n<h1>1.\u00a0Web\u00a0Service\u7684\u4ecb\u7ecd<\/h1>\n<h2>1.1 Web Service\u5230\u5e95\u662f\u4ec0\u4e48\uff1f<\/h2>\n<p>\u7814\u7a76\u4e00\u4e0b\u5f53\u524d\u7684\u5e94\u7528\u7a0b\u5e8f\u5f00\u53d1\uff0c\u4f60\u4f1a\u53d1\u73b0\u4e00\u4e2a\u7edd\u5bf9\u7684\u503e\u5411\uff1a\u4eba\u4eec\u5f00\u59cb\u504f\u7231\u57fa\u4e8e\u6d4f\u89c8\u5668\u7684\u7626\u5ba2\u6237\u5e94\u7528\u7a0b\u5e8f\u3002\u8fd9\u5f53\u7136\u4e0d\u662f\u56e0\u4e3a\u7626\u5ba2\u6237\u80fd\u591f\u63d0\u4f9b\u66f4\u597d\u7684\u7528\u6237\u754c\u9762\uff0c\u800c\u662f\u56e0\u4e3a\u5b83\u80fd\u591f\u907f\u514d\u82b1\u5728\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u53d1\u5e03\u4e0a\u7684\u9ad8\u6210\u672c\u3002\u53d1\u5e03\u684c\u9762\u5e94\u7528\u7a0b\u5e8f\u6210\u672c\u5f88\u9ad8\uff0c\u4e00\u534a\u662f\u56e0\u4e3a\u5e94\u7528\u7a0b\u5e8f\u5b89\u88c5\u548c\u914d\u7f6e\u7684\u95ee\u9898\uff0c\u53e6\u4e00\u534a\u662f\u56e0\u4e3a\u5ba2\u6237\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u901a\u4fe1\u7684\u95ee\u9898\u3002<\/p>\n<p>\u4f20\u7edf\u7684<a title=\"Windows\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-161577-1-1.htm\">Windows<\/a>\u5bcc\u5ba2\u6237\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528DCOM\u6765\u4e0e\u670d\u52a1\u5668\u8fdb\u884c\u901a\u4fe1\u548c\u8c03\u7528\u8fdc\u7a0b\u5bf9\u8c61\u3002\u914d\u7f6e\u597dDCOM\u4f7f\u5176\u5728\u4e00\u4e2a\u5927\u578b\u7684\u7f51\u7edc\u4e2d\u6b63\u5e38\u5de5\u4f5c\u5c06\u662f\u4e00\u4e2a\u6781\u5bcc\u6311\u6218\u6027\u7684\u5de5\u4f5c\uff0c\u540c\u65f6\u4e5f\u662f\u8bb8\u591aIT\u5de5\u7a0b\u5e08\u7684\u5669\u68a6\u3002\u4e8b\u5b9e\u4e0a\uff0c\u8bb8\u591aIT\u5de5\u7a0b\u5e08\u5b81\u613f\u5fcd\u53d7\u6d4f\u89c8\u5668\u6240\u5e26\u6765\u7684\u529f\u80fd\u9650\u5236\uff0c\u4e5f\u4e0d\u613f\u5728\u5c40\u57df\u7f51\u4e0a\u53bb\u8fd0\u884c\u4e00\u4e2aDCOM\u3002\u5728\u6211\u770b\u6765\uff0c\u7ed3\u679c\u5c31\u662f\u4e00\u4e2a\u53d1\u5e03\u5bb9\u6613\uff0c\u4f46\u5f00\u53d1\u96be\u5ea6\u5927\u800c\u4e14\u7528\u6237\u754c\u9762\u6781\u5176\u53d7\u9650\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u6781\u7aef\u7684\u8bf4\uff0c\u5c31\u662f\u4f60\u82b1\u4e86\u66f4\u591a\u7684\u8d44\u91d1\u548c\u65f6\u95f4\uff0c\u5374\u5f00\u53d1\u51fa\u4ece\u7528\u6237\u770b\u6765\u529f\u80fd\u66f4\u5f31\u7684\u5e94\u7528\u7a0b\u5e8f\u3002\u4e0d\u4fe1\u4f60\u95ee\u95ee\u4f60\u7684\u4f1a\u8ba1\u5e08\u5bf9\u65b0\u7684\u57fa\u4e8e\u6d4f\u89c8\u5668\u7684\u4f1a\u8ba1\u8f6f\u4ef6\u6709\u4ec0\u4e48\u60f3\u6cd5\uff1a\u7edd\u5927\u591a\u6570\u5546\u7528\u7a0b\u5e8f\u7528\u6237\u5e0c\u671b\u4f7f\u7528\u66f4\u52a0\u53cb\u597d\u7684<a title=\"Windows\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-161577-1-1.htm\">Windows<\/a>\u7528\u6237\u754c\u9762\u3002<\/p>\n<p>\u5173\u4e8e\u5ba2\u6237\u7aef\u4e0e\u670d\u52a1\u5668\u7684\u901a\u4fe1\u95ee\u9898\uff0c\u4e00\u4e2a\u5b8c\u7f8e\u7684\u89e3\u51b3\u65b9\u6cd5\u662f\u4f7f\u7528HTTP\u534f\u8bae\u6765\u901a\u4fe1\u3002\u8fd9\u662f\u56e0\u4e3a\u4efb\u4f55\u8fd0\u884c<a title=\"Web\u6d4f\u89c8\u5668\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-5541-1-1.htm\">Web\u6d4f\u89c8\u5668<\/a>\u7684\u673a\u5668\u90fd\u5728\u4f7f\u7528HTTP\u534f\u8bae\u3002\u540c\u65f6\uff0c\u5f53\u524d\u8bb8\u591a\u9632\u706b\u5899\u4e5f\u914d\u7f6e\u4e3a\u53ea\u5141\u8bb8HTTP\u8fde\u63a5\u3002<\/p>\n<p>\u8bb8\u591a\u5546\u7528\u7a0b\u5e8f\u8fd8\u9762\u4e34\u53e6\u4e00\u4e2a\u95ee\u9898\uff0c\u90a3\u5c31\u662f\u4e0e\u5176\u4ed6\u7a0b\u5e8f\u7684\u4e92\u64cd\u4f5c\u6027\u3002\u5982\u679c\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u662f\u4f7f\u7528COM\u6216.NET\u8bed\u8a00\u5199\u7684\uff0c\u5e76\u4e14\u90fd\u8fd0\u884c\u5728<a title=\"Windows\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-161577-1-1.htm\">Windows<\/a>\u5e73\u53f0\u4e0a\uff0c\u90a3\u5c31\u5929\u4e0b\u592a\u5e73\u4e86\u3002\u7136\u800c\uff0c\u4e8b\u5b9e\u4e0a\u5927\u591a\u6570\u5546\u4e1a\u6570\u636e\u4ecd\u7136\u5728\u5927\u578b\u4e3b\u673a\u4e0a\u4ee5\u975e\u5173\u7cfb\u6587\u4ef6(VSAM)\u7684\u5f62\u5f0f\u5b58\u653e\uff0c\u5e76\u7531COBOL\u8bed\u8a00\u7f16\u5199\u7684\u5927\u578b\u673a\u7a0b\u5e8f\u8bbf\u95ee\u3002\u800c\u4e14\uff0c\u76ee\u524d\u8fd8\u6709\u5f88\u591a\u5546\u7528\u7a0b\u5e8f\u7ee7\u7eed\u5728\u4f7f\u7528C++\u3001Java\u3001Visual Basic\u548c\u5176\u4ed6\u5404\u79cd\u5404\u6837\u7684\u8bed\u8a00\u7f16\u5199\u3002\u73b0\u5728\uff0c\u9664\u4e86\u6700\u7b80\u5355\u7684\u7a0b\u5e8f\u4e4b\u5916\uff0c\u6240\u6709\u7684\u5e94\u7528\u7a0b\u5e8f\u90fd\u9700\u8981\u4e0e\u8fd0\u884c\u5728\u5176\u4ed6\u5f02\u6784\u5e73\u53f0\u4e0a\u7684\u5e94\u7528\u7a0b\u5e8f\u96c6\u6210\u5e76\u8fdb\u884c\u6570\u636e\u4ea4\u6362\u3002\u8fd9\u6837\u7684\u4efb\u52a1\u901a\u5e38\u90fd\u662f\u7531\u7279\u6b8a\u7684\u65b9\u6cd5\uff0c\u5982\u6587\u4ef6\u4f20\u8f93\u548c\u5206\u6790\uff0c\u6d88\u606f\u961f\u5217\uff0c\u8fd8\u6709\u4ec5\u9002\u7528\u4e8e\u67d0\u4e9b\u60c5\u51b5\u7684\u7684API\uff0c\u5982IBM\u7684&#8221;\u9ad8\u7ea7\u7a0b\u5e8f\u5230\u7a0b\u5e8f\u4ea4\u6d41(APPC)&#8221;\u7b49\u6765\u5b8c\u6210\u7684\u3002\u5728\u4ee5\u524d\uff0c\u6ca1\u6709\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\u901a\u4fe1\u6807\u51c6\uff0c\u662f\u72ec\u7acb\u4e8e\u5e73\u53f0\u3001\u7ec4\u5efa\u6a21\u578b\u548c\u7f16\u7a0b\u8bed\u8a00\u7684\u3002\u53ea\u6709\u901a\u8fc7<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\uff0c\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u624d\u80fd\u591f\u81ea\u7531\u7684\u7528HTTP\u8fdb\u884c\u901a\u4fe1\uff0c\u4e0d\u8bba\u4e24\u4e2a\u7a0b\u5e8f\u7684\u5e73\u53f0\u548c\u7f16\u7a0b\u8bed\u8a00\u662f\u4ec0\u4e48\u3002<\/p>\n<p><strong>\u4ec0<\/strong><strong>\u4e48<\/strong><strong>\u662f<\/strong><strong><a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a><\/strong><\/p>\n<p>\u5bf9\u8fd9\u4e2a\u95ee\u9898\uff0c\u6211\u4eec\u81f3\u5c11\u6709\u4e24\u79cd\u7b54\u6848\u3002\u4ece\u8868\u9762\u4e0a\u770b\uff0c<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \u5c31\u662f\u4e00\u4e2a\u5e94\u7528\u7a0b\u5e8f\uff0c\u5b83\u5411\u5916\u754c\u66b4\u9732\u51fa\u4e00\u4e2a\u80fd\u591f\u901a\u8fc7Web\u8fdb\u884c\u8c03\u7528\u7684API\u3002\u8fd9\u5c31\u662f\u8bf4\uff0c\u4f60\u80fd\u591f\u7528\u7f16\u7a0b\u7684\u65b9\u6cd5\u901a\u8fc7Web\u6765\u8c03\u7528\u8fd9\u4e2a\u5e94\u7528\u7a0b\u5e8f\u3002\u6211\u4eec\u628a\u8c03\u7528\u8fd9\u4e2a<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \u7684\u5e94\u7528\u7a0b\u5e8f\u53eb\u505a\u5ba2\u6237\u3002\u4f8b\u5982\uff0c\u4f60\u60f3\u521b\u5efa\u4e00\u4e2a<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \uff0c\u5b83\u7684\u4f5c\u7528\u662f\u8fd4\u56de\u5f53\u524d\u7684\u5929\u6c14\u60c5\u51b5\u3002\u90a3\u4e48\u4f60\u53ef\u5df2\u5efa\u7acb\u4e00\u4e2aASP\u9875\u9762\uff0c\u5b83\u63a5\u53d7\u90ae\u653f\u7f16\u7801\u4f5c\u4e3a\u67e5\u8be2\u5b57\u7b26\u4e32\uff0c\u7136\u540e\u8fd4\u56de\u4e00\u4e2a\u7531\u9017\u53f7\u9694\u5f00\u7684\u5b57\u7b26\u4e32\uff0c\u5305\u542b\u4e86\u5f53\u524d\u7684\u6c14\u6e29\u548c\u5929\u6c14\u3002\u8981\u8c03\u7528\u8fd9\u4e2aASP\u9875\u9762\uff0c\u5ba2\u6237\u7aef\u9700\u8981\u53d1\u9001\u4e0b\u9762\u7684\u8fd9\u4e2aHTTP GET\u8bf7\u6c42\uff1a<\/p>\n<p>http:\/\/host.company.com\/weather.asp?zipcode=20171<\/p>\n<p>\u8fd4\u56de\u7684\u6570\u636e\u5c31\u5e94\u8be5\u662f\u8fd9\u6837\uff1a<\/p>\n<p>\u8fd9\u4e2aASP\u9875\u9762\u5c31\u5e94\u8be5\u53ef\u4ee5\u7b97\u4f5c\u662f<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \u4e86\u3002\u56e0\u4e3a\u5b83\u57fa\u4e8eHTTP GET\u8bf7\u6c42\uff0c\u66b4\u9732\u51fa\u4e86\u4e00\u4e2a\u53ef\u4ee5\u901a\u8fc7Web\u8c03\u7528\u7684API\u3002\u5f53\u7136\uff0c<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \u8fd8\u6709\u66f4\u591a\u7684\u4e1c\u897f\u3002<\/p>\n<p>\u4e0b\u9762\u662f\u5bf9<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \u66f4\u7cbe\u786e\u7684\u89e3\u91ca\uff1a\u00a0<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>s\u662f\u5efa\u7acb\u53ef\u4e92\u64cd\u4f5c\u7684\u5206\u5e03\u5f0f\u5e94\u7528\u7a0b\u5e8f\u7684\u65b0\u5e73\u53f0\u3002\u4f5c\u4e3a\u4e00\u4e2a<a title=\"Windows\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-161577-1-1.htm\">Windows<\/a>\u7a0b\u5e8f\u5458\uff0c\u4f60\u53ef\u80fd\u5df2\u7ecf\u7528COM\u6216DCOM\u5efa\u7acb\u8fc7\u57fa\u4e8e\u7ec4\u4ef6\u7684\u5206\u5e03\u5f0f\u5e94\u7528\u7a0b\u5e8f\u3002COM\u662f\u4e00\u4e2a\u975e\u5e38\u597d\u7684\u7ec4\u4ef6\u6280\u672f\uff0c\u4f46\u662f\u6211\u4eec\u4e5f\u5f88\u5bb9\u6613\u4e3e\u51faCOM\u5e76\u4e0d\u80fd\u6ee1\u8db3\u8981\u6c42\u7684\u60c5\u51b5\u3002<\/p>\n<p><a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u662f\u4e00\u5957\u6807\u51c6\uff0c\u5b83\u5b9a\u4e49\u4e86\u5e94\u7528\u7a0b\u5e8f\u5982\u4f55\u5728Web\u4e0a\u5b9e\u73b0\u4e92\u64cd\u4f5c\u6027\u3002\u4f60\u53ef\u4ee5\u7528\u4efb\u4f55\u4f60\u559c\u6b22\u7684\u8bed\u8a00\uff0c\u5728\u4efb\u4f55\u4f60\u559c\u6b22\u7684\u5e73\u53f0\u4e0a\u5199<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a> \uff0c\u53ea\u8981\u6211\u4eec\u53ef\u4ee5\u901a\u8fc7<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u6807\u51c6\u5bf9\u8fd9\u4e9b\u670d\u52a1\u8fdb\u884c\u67e5\u8be2\u548c\u8bbf\u95ee\u3002<\/p>\n<p><strong>\u65b0\u5e73\u53f0<\/strong><\/p>\n<p><a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u9700\u8981\u4e00\u5957\u534f\u8bae\u6765\u5b9e\u73b0\u5206\u5e03\u5f0f\u5e94\u7528\u7a0b\u5e8f\u7684\u521b\u5efa\u3002\u4efb\u4f55\u5e73\u53f0\u90fd\u6709\u5b83\u7684\u6570\u636e\u8868\u793a\u65b9\u6cd5\u548c\u7c7b\u578b\u7cfb\u7edf\u3002\u8981\u5b9e\u73b0\u4e92\u64cd\u4f5c\u6027\uff0c<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u5fc5\u987b\u63d0\u4f9b\u4e00\u5957\u6807\u51c6\u7684\u7c7b\u578b\u7cfb\u7edf\uff0c\u7528\u4e8e\u6c9f\u901a\u4e0d\u540c\u5e73\u53f0\u3001\u7f16\u7a0b\u8bed\u8a00\u548c\u7ec4\u4ef6\u6a21\u578b\u4e2d\u7684\u4e0d\u540c\u7c7b\u578b\u7cfb\u7edf\u3002\u5728\u4f20\u7edf\u7684\u5206\u5e03\u5f0f\u7cfb\u7edf\u4e2d\uff0c\u57fa\u4e8e\u754c\u9762(interface)\u7684\u5e73\u53f0\u63d0\u4f9b\u4e86\u4e00\u4e9b\u65b9\u6cd5\u6765\u63cf\u8ff0\u754c\u9762\u3001\u65b9\u6cd5\u548c\u53c2\u6570(\u8bd1\u6ce8\uff1a\u5982COM\u548cCOBAR\u4e2d\u7684IDL\u8bed\u8a00)\u3002\u540c\u6837\u7684\uff0c<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u4e5f\u5fc5\u987b\u63d0\u4f9b\u4e00\u79cd\u6807\u51c6\u6765\u63cf\u8ff0<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\uff0c\u8ba9\u5ba2\u6237\u53ef\u4ee5\u5f97\u5230\u8db3\u591f\u7684\u4fe1\u606f\u6765\u8c03\u7528\u8fd9\u4e2a<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u3002\u6700\u540e\uff0c\u6211\u4eec\u8fd8\u5fc5\u987b\u6709\u4e00\u79cd\u65b9\u6cd5\u6765\u5bf9\u8fd9\u4e2a<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u8fdb\u884c\u8fdc\u7a0b\u8c03\u7528\u3002\u8fd9\u79cd\u65b9\u6cd5\u5b9e\u9645\u662f\u4e00\u79cd\u8fdc\u7a0b\u8fc7\u7a0b\u8c03\u7528\u534f\u8bae(RPC)\u3002\u4e3a\u4e86\u8fbe\u5230\u4e92\u64cd\u4f5c\u6027\uff0c\u8fd9\u79cdRPC\u534f\u8bae\u8fd8\u5fc5\u987b\u4e0e\u5e73\u53f0\u548c\u7f16\u7a0b\u8bed\u8a00\u65e0\u5173\u3002\u4e0b\u9762\u51e0\u4e2a\u5c0f\u8282\u5c31\u7b80\u8981\u4ecb\u7ecd\u4e86\u7ec4\u6210<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u7684\u8fd9\u4e09\u4e2a\u6280\u672f\u3002<\/p>\n<p><strong>XML<\/strong><strong>\u548c<\/strong><strong>XSD<\/strong><\/p>\n<p>\u53ef\u6269\u5c55\u7684\u6807\u8bb0\u8bed\u8a00(XML)\u662f<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u4e2d\u8868\u793a\u6570\u636e\u7684\u57fa\u672c\u683c\u5f0f\u3002\u9664\u4e86\u6613\u4e8e\u5efa\u7acb\u548c\u6613\u4e8e\u5206\u6790\u5916\uff0cXML\u4e3b\u8981\u7684\u4f18\u70b9\u5728\u4e8e\u5b83\u65e2\u662f\u5e73\u53f0\u65e0\u5173\u7684\uff0c\u53c8\u662f\u5382\u5546\u65e0\u5173\u7684\u3002\u65e0\u5173\u6027\u662f\u6bd4\u6280\u672f\u4f18\u8d8a\u6027\u66f4\u91cd\u8981\u7684\uff1a\u8f6f\u4ef6\u5382\u5546\u662f\u4e0d\u4f1a\u9009\u62e9\u4e00\u4e2a\u7531\u7ade\u4e89\u5bf9\u624b\u6240\u53d1\u660e\u7684\u6280\u672f\u7684\u3002<\/p>\n<p>XML\u89e3\u51b3\u4e86\u6570\u636e\u8868\u793a\u7684\u95ee\u9898\uff0c\u4f46\u5b83\u6ca1\u6709\u5b9a\u4e49\u4e00\u5957\u6807\u51c6\u7684\u6570\u636e\u7c7b\u578b\uff0c\u66f4\u6ca1\u6709\u8bf4\u600e\u4e48\u53bb\u6269\u5c55\u8fd9\u5957\u6570\u636e\u7c7b\u578b\u3002\u4f8b\u5982\uff0c\u6574\u5f62\u6570\u5230\u5e95\u4ee3\u8868\u4ec0\u4e48?16\u4f4d\uff0c32\u4f4d\uff0c\u8fd8\u662f64\u4f4d?\u8fd9\u4e9b\u7ec6\u8282\u5bf9\u5b9e\u73b0\u4e92\u64cd\u4f5c\u6027\u90fd\u662f\u5f88\u91cd\u8981\u7684\u3002W3C\u5236\u5b9a\u7684XML Schema(XSD)\u5c31\u662f\u4e13\u95e8\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\u7684\u4e00\u5957\u6807\u51c6\u3002\u5b83\u5b9a\u4e49\u4e86\u4e00\u5957\u6807\u51c6\u7684\u6570\u636e\u7c7b\u578b\uff0c\u5e76\u7ed9\u51fa\u4e86\u4e00\u79cd\u8bed\u8a00\u6765\u6269\u5c55\u8fd9\u5957\u6570\u636e\u7c7b\u578b\u3002<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5e73\u53f0\u5c31\u662f\u7528XSD\u6765\u4f5c\u4e3a\u5176\u6570\u636e\u7c7b\u578b\u7cfb\u7edf\u7684\u3002\u5f53\u4f60\u7528\u67d0\u79cd\u8bed\u8a00(\u5982VB.NET\u6216C#)\u6765\u6784\u9020\u4e00\u4e2a<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u65f6\uff0c\u4e3a\u4e86\u7b26\u5408<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u6807\u51c6\uff0c\u6240\u6709\u4f60\u4f7f\u7528\u7684\u6570\u636e\u7c7b\u578b\u90fd\u5fc5\u987b\u88ab\u8f6c\u6362\u4e3aXSD\u7c7b\u578b\u3002\u4f60\u7528\u7684\u5de5\u5177\u53ef\u80fd\u5df2\u7ecf\u81ea\u52a8\u5e2e\u4f60\u5b8c\u6210\u4e86\u8fd9\u4e2a\u8f6c\u6362\uff0c\u4f46\u4f60\u5f88\u53ef\u80fd\u4f1a\u6839\u636e\u4f60\u7684\u9700\u8981\u4fee\u6539\u4e00\u4e0b\u8f6c\u6362\u8fc7\u7a0b\u3002\u5728\u7b2c\u4e8c\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u6df1\u5165XSD\uff0c\u5b66\u4e60\u600e\u6837\u8f6c\u6362\u81ea\u5b9a\u4e49\u7684\u6570\u636e\u7c7b\u578b(\u4f8b\u5982\u7c7b)\u5230XSD\u7684\u7c7b\u578b\u3002<\/p>\n<p><strong>SOAP<\/strong><\/p>\n<p><a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5efa\u597d\u4ee5\u540e\uff0c\u4f60\u6216\u8005\u5176\u4ed6\u4eba\u5c31\u4f1a\u53bb\u8c03\u7528\u5b83\u3002\u7b80\u5355\u5bf9\u8c61\u8bbf\u95ee\u534f\u8bae(SOAP)\u63d0\u4f9b\u4e86\u6807\u51c6\u7684RPC\u65b9\u6cd5\u6765\u8c03\u7528<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u3002\u5b9e\u9645\u4e0a\uff0cSOAP\u5728\u8fd9\u91cc\u6709\u70b9\u7528\u8bcd\u4e0d\u5f53\uff1a\u5b83\u610f\u5473\u7740\u4e0b\u9762\u7684<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u662f\u4ee5\u5bf9\u8c61\u7684\u65b9\u5f0f\u8868\u793a\u7684\uff0c\u4f46\u4e8b\u5b9e\u5e76\u4e0d\u4e00\u5b9a\u5982\u6b64\uff1a\u4f60\u5b8c\u5168\u53ef\u4ee5\u628a\u4f60\u7684<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u5199\u6210\u4e00\u7cfb\u5217\u7684C\u51fd\u6570\uff0c\u5e76\u4ecd\u7136\u4f7f\u7528SOAP\u8fdb\u884c\u8c03\u7528\u3002SOAP\u89c4\u8303\u5b9a\u4e49\u4e86SOAP\u6d88\u606f\u7684\u683c\u5f0f\uff0c\u4ee5\u53ca\u600e\u6837\u901a\u8fc7HTTP\u534f\u8bae\u6765\u4f7f\u7528SOAP\u3002SOAP\u4e5f\u662f\u57fa\u4e8eXML\u548cXSD\u7684\uff0cXML\u662fSOAP\u7684\u6570\u636e\u7f16\u7801\u65b9\u5f0f\u3002\u7b2c\u4e09\u7ae0\u6211\u4eec\u4f1a\u8ba8\u8bbaSOAP\uff0c\u5e76\u7ed3\u8bc6SOAP\u6d88\u606f\u7684\u5404\u79cd\u5143\u7d20\u3002<\/p>\n<p><strong>WSDL<\/strong><\/p>\n<p>\u4f60\u4f1a\u600e\u6837\u5411\u522b\u4eba\u4ecb\u7ecd\u4f60\u7684<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u6709\u4ec0\u4e48\u529f\u80fd\uff0c\u4ee5\u53ca\u6bcf\u4e2a\u51fd\u6570\u8c03\u7528\u65f6\u7684\u53c2\u6570\u5462?\u4f60\u53ef\u80fd\u4f1a\u81ea\u5df1\u5199\u4e00\u5957\u6587\u6863\uff0c\u4f60\u751a\u81f3\u53ef\u80fd\u4f1a\u53e3\u5934\u4e0a\u544a\u8bc9\u9700\u8981\u4f7f\u7528\u4f60\u7684<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u7684\u4eba\u3002\u8fd9\u4e9b\u975e\u6b63\u5f0f\u7684\u65b9\u6cd5\u81f3\u5c11\u90fd\u6709\u4e00\u4e2a\u4e25\u91cd\u7684\u95ee\u9898\uff1a\u5f53\u7a0b\u5e8f\u5458\u5750\u5230\u7535\u8111\u524d\uff0c\u60f3\u8981\u4f7f\u7528\u4f60\u7684<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u7684\u65f6\u5019\uff0c\u4ed6\u4eec\u7684\u5de5\u5177(\u5982Visual Studio)\u65e0\u6cd5\u7ed9\u4ed6\u4eec\u63d0\u4f9b\u4efb\u4f55\u5e2e\u52a9\uff0c\u56e0\u4e3a\u8fd9\u4e9b\u5de5\u5177\u6839\u672c\u5c31\u4e0d\u4e86\u89e3\u4f60\u7684Web<\/p>\n<p>service\u3002\u89e3\u51b3\u65b9\u6cd5\u662f\uff1a\u7528\u673a\u5668\u80fd\u9605\u8bfb\u7684\u65b9\u5f0f\u63d0\u4f9b\u4e00\u4e2a\u6b63\u5f0f\u7684\u63cf\u8ff0\u6587\u6863\u3002<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u63cf\u8ff0\u8bed\u8a00(WSDL)\u5c31\u662f\u8fd9\u6837\u4e00\u4e2a\u57fa\u4e8eXML\u7684\u8bed\u8a00\uff0c\u7528\u4e8e\u63cf\u8ff0<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u53ca\u5176\u51fd\u6570\u3001\u53c2\u6570\u548c\u8fd4\u56de\u503c\u3002\u56e0\u4e3a\u662f\u57fa\u4e8eXML\u7684\uff0c\u6240\u4ee5WSDL\u65e2\u662f\u673a\u5668\u53ef\u9605\u8bfb\u7684\uff0c\u53c8\u662f\u4eba\u53ef\u9605\u8bfb\u7684\uff0c\u8fd9\u5c06\u662f\u4e00\u4e2a\u5f88\u5927\u7684\u597d\u5904\u3002\u4e00\u4e9b\u6700\u65b0\u7684\u5f00\u53d1\u5de5\u5177\u65e2\u80fd\u6839\u636e\u4f60\u7684<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u751f\u6210WSDL\u6587\u6863\uff0c\u53c8\u80fd\u5bfc\u5165WSDL\u6587\u6863\uff0c\u751f\u6210\u8c03\u7528\u76f8\u5e94<a title=\"Web Service\" href=\"http:\/\/server.zdnet.com.cn\/files\/list-0-0-83880-1-1.htm\">Web Service<\/a>\u7684\u4ee3\u7801\u3002<\/p>\n<p><strong> <\/strong><strong>\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a<\/strong><strong>Web Service<\/strong><strong>\u5c31\u662f\u9ad8\u7ea7\u7248\u7684<\/strong><strong>DCOM<\/strong><strong>\u548c<\/strong><strong>CORBA<\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<h2>1.2 Web Service\u7684\u4f53\u7cfb\u7ed3\u6784\u56fe<\/h2>\n<p><strong> <\/strong>\u901a\u8fc7\u4e0a\u56fe\uff0c\u6211\u4eec\u80fd\u770b\u51fa\u6765\uff0cWebService\u7684\u8fd0\u884c\u673a\u5236\u6709\u70b9\u7c7b\u4f3c\u4e8eCORBA\u3002<\/p>\n<p>1.\u901a\u8fc7WSDL\u63cf\u8ff0WebService<\/p>\n<p>2.\u901a\u8fc7SOAP\u5728\u4e92\u8054\u7f51\u73af\u5883\u5185\u4f20\u9012\u6570\u636e<\/p>\n<p>3.\u901a\u8fc7JAXB\u5b9e\u73b0Java\u548cXML\u4e4b\u95f4\u7684\u4e92\u76f8\u8f6c\u6362\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>\u5177\u4f53\u7684<\/strong><strong>Web Service<\/strong><strong>\u7684\u4f53\u7cfb\u7ed3\u6784\u53ef\u4ee5\u53c2\u7167\u4ee5\u4e0b\u6587\u4ef6\uff1a<\/strong><strong> <\/strong><\/p>\n<p>======================================================<\/p>\n<p>\u300a<strong>\u6df1\u5165\u6d45\u51fa<\/strong><strong>JAX-WS 2.0<\/strong>\u300b<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/11\/5306034.aspx\">http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/11\/5306034.aspx<\/a><\/p>\n<p>\u300a<strong>SOA<\/strong><strong>\u6280<\/strong><strong>\u672f<\/strong><strong>\u7814\u7a76\u4e4b<\/strong><strong> <\/strong><strong>\u56fe<\/strong><strong>\u89e3<\/strong><strong>JAX-WS<\/strong><strong>\u6280<\/strong><strong>\u672f<\/strong>\u300b<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/10\/5305049.aspx\">http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/10\/5305049.aspx<\/a><\/p>\n<p>\u300a<strong>\u624b\u628a\u624b\u6559\u4f60\u5728<\/strong><strong>Interstage<\/strong><strong>\u4e0a\u90e8\u7f72<\/strong><strong>WebService<\/strong>\u300b<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/22\/5317356.aspx\">http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/22\/5317356.aspx<\/a><\/p>\n<p>======================================================<\/p>\n<p>.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>1.3\u00a0\u4e00\u4e2a\u7b80\u5355\u7684WebService\u8fd0\u884c\u5b9e\u4f8b<\/h2>\n<p>WebService\u4ee3\u7801\uff1a<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>package<\/strong> stock.server;<\/p>\n<p>@javax.jws.WebService<\/p>\n<p><strong>public<\/strong> <strong>class<\/strong> StockQuoteProvider\u00a0{<\/p>\n<p><strong>public<\/strong> StockQuoteProvider () {<\/p>\n<p>}<\/p>\n<p><strong>public<\/strong> <strong>float<\/strong> getLastTradePrice (String tickerSymbol) {<\/p>\n<p><strong>return<\/strong> &#8220;abc&#8221;.equals(tickerSymbol)? 1234.0f : 0.0f;<\/p>\n<p>}<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5ba2\u6237\u7aef\u4ee3\u7801\uff1a<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>import<\/strong> java.lang.annotation.Annotation;<\/p>\n<p><strong>import<\/strong> stock.server.*;<\/p>\n<p><strong>import<\/strong> javax.xml.ws.Service;<\/p>\n<p><strong>public<\/strong> <strong>class<\/strong> StockQuoteClient {<\/p>\n<p><strong>public<\/strong> <strong>static<\/strong> <strong>void<\/strong> main(String[] args)\u00a0<strong>throws<\/strong> Exception {<\/p>\n<p>StockQuoteProviderService service =\u00a0<strong>new<\/strong> StockQuoteProviderService();<\/p>\n<p>StockQuoteProvider port = service.getStockQuoteProviderPort();<\/p>\n<p>System.<em>out<\/em>.println(port.getLastTradePrice(args[0]));<\/p>\n<p>}<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>2.\u00a0Web\u00a0Service\u6280\u672f\u7814\u7a76\u7684\u73af\u5883\u51c6\u5907<\/h1>\n<h2>2.1\u00a0\u5b89\u88c5\u8fd0\u884c\u73af\u5883<\/h2>\n<p>\u63a8\u8350\u5b89\u88c5GlassFish\u670d\u52a1\u5668\uff0c\u5177\u4f53\u5b89\u88c5\u65b9\u6cd5\u53ef\u4ee5\u53c2\u89c1\u4ee5\u4e0b\u6587\u7ae0\uff1a<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">\u300a<strong><a href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/01\/28\/5264913.aspx\">\u624b\u628a\u624b\u6559\u4f60\u00a0\u600e\u4e48\u00a0\u5b89\u88c5\u00a0GlassFish<\/a><\/strong>\u300b<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/01\/28\/5264913.aspx\">http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/01\/28\/5264913.aspx<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2.2\u00a0\u4e0b\u8f7dWebService API(JAX-WS)\u7684\u6e90\u4ee3\u7801<\/h2>\n<p>\u5177\u4f53\u7684\u4e0b\u8f7dURL\u53c2\u89c1\u4ee5\u4e0b\u5730\u5740\uff1a<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><a href=\"https:\/\/jax-ws-sources.dev.java.net\/source\/browse\/jax-ws-sources\/\">https:\/\/jax-ws-sources.dev.java.net\/source\/browse\/jax-ws-sources\/<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>2.3\u00a0\u90e8\u7f72\u670d\u52a1\u5668\u7aef<\/h2>\n<p>1.\u628a1.3\u4e2d\u7684\u670d\u52a1\u5668\u7aef\u90e8\u7f72\u5230GlassFish\u4e2d<\/p>\n<p>2.\u7528wsimport\u547d\u4ee4\u751f\u6210stub\u4e2d\u95f4\u7a0b\u5e8f<\/p>\n<p>3.\u628a1.3\u4e2d\u7684\u5ba2\u6237\u7aef\u4ee3\u7801\u548cstub\u4ee3\u7801\uff0c\u4ee5\u53ca2.2\u4e0b\u8f7d\u7684WebService\u6e90\u4ee3\u7801\u90e8\u7f72\u5230Eclipse\u5de5\u7a0b\u4e2d\uff0c\u5c31\u53ef\u4ee5DEBUG\u4e86\u3002<\/p>\n<p>\u5177\u4f53\u7684\u53ef\u4ee5\u53c2\u7167\u4ee5\u4e0b\u6587\u7ae0\uff1a<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">\u300a<strong>SOA<\/strong><strong>\u6280<\/strong><strong>\u672f<\/strong><strong>\u7814\u7a76\u4e4b<\/strong><strong> <\/strong><strong>\u56fe<\/strong><strong>\u89e3<\/strong><strong>JAX-WS<\/strong><strong>\u6280<\/strong><strong>\u672f<\/strong>\u300b<\/p>\n<p><a href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/10\/5305049.aspx\">http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/10\/5305049.aspx<\/a><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h1>3.\u00a0Web\u00a0Service\u7684\u6280\u672f\u5185\u5e55<\/h1>\n<h2>3.1\u00a0\u5ba2\u6237\u7aef\u662f\u5982\u4f55\u548cWSDL\u5efa\u7acb\u5173\u7cfb\u7684\uff1f<\/h2>\n<p>1.\u00a0\u9996\u5148\uff0c\u6211\u4eec\u770b\u5230\u5ba2\u6237\u7aef\u7a0b\u5e8f\u4e2d\u6709\u4ee5\u4e0b\u8fd9\u6837\u4e00\u884c<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">StockQuoteProviderService\u00a0service =\u00a0<strong>new<\/strong><strong> <\/strong><\/p>\n<p>StockQuoteProviderService();<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>public<\/strong> StockQuoteProviderService() {<\/p>\n<p><strong>super<\/strong>(<em>STOCKQUOTEPROVIDERSERVICE_WSDL_LOCATION<\/em>,\u00a0<strong>new<\/strong> QName(&#8220;http:\/\/server.stock\/&#8221;,\u00a0&#8220;StockQuoteProviderService&#8221;));<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>3.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.spi.ProviderImpl\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">@Override<\/p>\n<p><strong>public<\/strong> ServiceDelegate createServiceDelegate( URL wsdlDocumentLocation, QName serviceName,\u00a0Class\u00a0serviceClass) {<\/p>\n<p><strong>return<\/strong> <strong>new<\/strong> WSServiceDelegate(wsdlDocumentLocation, serviceName,\u00a0serviceClass);<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>4.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.clientWSServiceDelegate\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">\/**<\/p>\n<p>*\u00a0<strong>@param<\/strong> serviceClass<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Either\u00a0{@link Service}.class\u00a0or\u00a0other\u00a0generated\u00a0service-derived\u00a0classes.<\/p>\n<p>*\/<\/p>\n<p><strong>public<\/strong> WSServiceDelegate(@Nullable\u00a0Source wsdl,\u00a0@NotNull\u00a0QName serviceName,\u00a0@NotNull\u00a0<strong>final<\/strong> Class&lt;?\u00a0<strong>extends<\/strong> Service&gt; serviceClass) {<\/p>\n<p>\uff5e\u7701\u7565\uff5e<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>5.\u00a0\u800c\u5176\u4e2d\u6700\u5173\u952e\u7684\u5c31\u662f\u4ee5\u4e0b\u8fd9\u6bb5\uff0c\u89e3\u6790\u9605\u8bfbWSDL\u7684\u4ee3\u7801\uff0c\u8fd9\u6bb5\u4ee3\u7801\u4e3b\u8981\u662f\u7528XMLStream\u6765\u6784\u5efaWSDL\u4ee3\u7801\uff0c\u4e0d\u8db3\u4e3a\u5947\u3002<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"581\" valign=\"top\">WSDLServiceImpl\u00a0service=<strong>null<\/strong>;<\/p>\n<p><strong>if<\/strong> (wsdl !=\u00a0<strong>null<\/strong>) {<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p>URL url = wsdl.getSystemId()==<strong>null<\/strong> ?\u00a0<strong>null<\/strong> :\u00a0<strong>new<\/strong> URL(wsdl.getSystemId());<\/p>\n<p>WSDLModelImpl model = parseWSDL(url, wsdl);<\/p>\n<p>service = model.getService(<strong>this<\/strong>.serviceName);<\/p>\n<p><strong>if<\/strong> (service ==\u00a0<strong>null<\/strong>)<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> WebServiceException(<\/p>\n<p>ClientMessages.<em>INVALID_SERVICE_NAME<\/em>(<strong>this<\/strong>.serviceName,<\/p>\n<p>buildNameList(model.getServices().keySet())));<\/p>\n<p>\/\/ fill in statically known ports<\/p>\n<p><strong>for<\/strong> (WSDLPortImpl port : service.getPorts())<\/p>\n<p>ports.put(port.getName(),\u00a0<strong>new<\/strong> PortInfo(<strong>this<\/strong>, port));<\/p>\n<p>}\u00a0<strong>catch<\/strong> (MalformedURLException e) {<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> WebServiceException(ClientMessages.<em>INVALID_WSDL_URL<\/em>(wsdl.getSystemId()), e);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p><strong>this<\/strong>.wsdlService\u00a0= service;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>3.2\u00a0\u5ba2\u6237\u7aef\u662f\u5982\u4f55\u548cSEI\u5efa\u7acb\u5173\u7cfb\u7684\uff1f<\/h2>\n<p>1.\u00a0\u9996\u5148\uff0c\u6211\u4eec\u770b\u5230\u5ba2\u6237\u7aef\u7a0b\u5e8f\u4e2d\u6709\u4ee5\u4e0b\u8fd9\u6837\u4e00\u884c<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">StockQuoteProvider port = service.getStockQuoteProviderPort();<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.clientWSServiceDelegate\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>private<\/strong> &lt;T&gt; T\u00a0getPort(WSEndpointReference wsepr, QName portName, Class&lt;T&gt; portInterface,<\/p>\n<p>WebServiceFeature&#8230; features) {<\/p>\n<p>SEIPortInfo spi = addSEI(portName, portInterface, features);<\/p>\n<p><strong>return<\/strong> createEndpointIFBaseProxy(wsepr,portName,portInterface,features, spi);<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>3.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.clientWSServiceDelegate\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">\/**<\/p>\n<p>*\u00a0Creates\u00a0a\u00a0new\u00a0pipeline\u00a0for\u00a0the\u00a0given\u00a0port\u00a0name.<\/p>\n<p>*\/<\/p>\n<p><strong>private<\/strong> Tube\u00a0createPipeline(PortInfo portInfo, WSBinding binding) {<\/p>\n<p>\/\/Check all required WSDL extensions are understood<\/p>\n<p>checkAllWSDLExtensionsUnderstood(portInfo,binding);<\/p>\n<p>SEIModel seiModel =\u00a0<strong>null<\/strong>;<\/p>\n<p><strong>if<\/strong>(portInfo\u00a0<strong>instanceof<\/strong> SEIPortInfo) {<\/p>\n<p>seiModel = ((SEIPortInfo)portInfo).model;<\/p>\n<p>}<\/p>\n<p>BindingID bindingId = portInfo.bindingId;<\/p>\n<p>TubelineAssembler assembler =\u00a0TubelineAssemblerFactory.create(<\/p>\n<p>Thread.<em>currentThread<\/em>().getContextClassLoader(), bindingId);<\/p>\n<p><strong>if<\/strong> (assembler ==\u00a0<strong>null<\/strong>)<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> WebServiceException(&#8220;Unable to process bindingID=&#8221;\u00a0+ bindingId);\u00a0\u00a0\u00a0\u00a0\/\/\u00a0<strong>TODO<\/strong>: i18n<\/p>\n<p><strong>return<\/strong> assembler.createClient(<\/p>\n<p><strong>new<\/strong> ClientTubeAssemblerContext(<\/p>\n<p>portInfo.targetEndpoint,<\/p>\n<p>portInfo.portModel,<\/p>\n<p><strong>this<\/strong>, binding,\u00a0container,((BindingImpl)binding).createCodec(),seiModel));<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u5728\u8fd9\u6bb5\u4ee3\u7801\u4e2d\uff0c\u4f7f\u7528\u4e86<\/strong><strong>TUBE<\/strong><strong>\u6280\u672f\uff0c\u628a\u5ba2\u6237\u7aef\u548c\u670d\u52a1\u5668\u4e4b\u95f4\u5efa\u7acb\u4e86\u5173\u7cfb\u3002<\/strong><strong> <\/strong><\/p>\n<p>4.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.util.pipe.StandaloneTubeAssembler\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">@NotNull<\/p>\n<p><strong>public<\/strong> Tube createClient(ClientTubeAssemblerContext context) {<\/p>\n<p>Tube head = context.createTransportTube();<\/p>\n<p>head = context.createSecurityTube(head);<\/p>\n<p><strong>if<\/strong> (<em>dump<\/em>) {<\/p>\n<p>\/\/ for debugging inject a dump pipe. this is left in the production code,<\/p>\n<p>\/\/ as it would be very handy for a trouble-shooting at the production site.<\/p>\n<p>head = context.createDumpTube(&#8220;client&#8221;, System.<em>out<\/em>, head);<\/p>\n<p>}<\/p>\n<p>head = context.createWsaTube(head);<\/p>\n<p>head = context.createClientMUTube(head);<\/p>\n<p>head = context.createValidationTube(head);<\/p>\n<p><strong>return<\/strong> context.createHandlerTube(head);<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u5728\u4ee5\u4e0a\u4ee3\u7801\u4e2d\uff0c\u5f00\u59cb\u548c<\/strong><strong>SOAP<\/strong><strong>\u7ed1\u5b9a\uff0c\u51c6\u5907\u53d1\u9001\u8bf7\u6c42\u548c\u8c03\u7528\u51fd\u6570\u7b49\u7b49\u3002<\/strong><strong> <\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<h2>3.3\u00a0\u5ba2\u6237\u7aef\u662f\u5982\u4f55\u53d1\u9001\u8bf7\u6c42\u7684\uff1f<\/h2>\n<p>1.\u00a0\u9996\u5148\uff0c\u6211\u4eec\u770b\u5230\u5ba2\u6237\u7aef\u7a0b\u5e8f\u4e2d\u6709\u4ee5\u4e0b\u8fd9\u6837\u4e00\u884c<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">port.getLastTradePrice(args[0])<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.client.sei.SEIStub\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>public<\/strong> Object invoke(Object proxy, Method method, Object[] args)<strong>throws<\/strong> Throwable {<\/p>\n<p>MethodHandler handler =\u00a0methodHandlers.get(method);<\/p>\n<p><strong>if<\/strong> (handler !=\u00a0<strong>null<\/strong>) {<\/p>\n<p><strong>return<\/strong> handler.invoke(proxy, args);<\/p>\n<p>}\u00a0<strong>else<\/strong> {<\/p>\n<p>\/\/ we handle the other method invocations by ourselves<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p><strong>return<\/strong> method.invoke(<strong>this<\/strong>, args);<\/p>\n<p>}\u00a0<strong>catch<\/strong> (IllegalAccessException e) {<\/p>\n<p>\/\/ impossible<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> AssertionError(e);<\/p>\n<p>}\u00a0<strong>catch<\/strong> (IllegalArgumentException e) {<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> AssertionError(e);<\/p>\n<p>}\u00a0<strong>catch<\/strong> (InvocationTargetException e) {<\/p>\n<p><strong>throw<\/strong> e.getCause();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<strong> <\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>3.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.client.stub\u7684(\u4e2d\u95f4\u7701\u53bb\u4e862\u5c42\u4e0d\u91cd\u8981\u7684\u4ee3\u7801)<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">\/**<\/p>\n<p>*\u00a0Passes\u00a0a\u00a0message\u00a0to\u00a0a\u00a0pipe\u00a0for\u00a0processing.<\/p>\n<p>*\u00a0&lt;p&gt;<\/p>\n<p>*\u00a0Unlike\u00a0{@link Tube}\u00a0instances,<\/p>\n<p>*\u00a0this\u00a0method\u00a0is\u00a0thread-safe\u00a0and\u00a0can\u00a0be\u00a0invoked\u00a0from<\/p>\n<p>*\u00a0multiple\u00a0threads\u00a0concurrently.<\/p>\n<p>*<\/p>\n<p>*\u00a0<strong>@param<\/strong> packet\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0The\u00a0message\u00a0to\u00a0be\u00a0sent\u00a0to\u00a0the\u00a0server<\/p>\n<p>*\u00a0<strong>@param<\/strong> requestContext\u00a0The\u00a0{@link RequestContext}\u00a0when\u00a0this\u00a0invocation\u00a0is\u00a0originally\u00a0scheduled.<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0This\u00a0must\u00a0be\u00a0the\u00a0same\u00a0object\u00a0as\u00a0{@link #requestContext}\u00a0for\u00a0synchronous<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0invocations,\u00a0but\u00a0for\u00a0asynchronous\u00a0invocations,\u00a0it\u00a0needs\u00a0to\u00a0be\u00a0a\u00a0snapshot<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0captured\u00a0at\u00a0the\u00a0point\u00a0of\u00a0invocation,\u00a0to\u00a0correctly\u00a0satisfy\u00a0the\u00a0spec\u00a0requirement.<\/p>\n<p>*\u00a0<strong>@param<\/strong> receiver\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Receives\u00a0the\u00a0{@link ResponseContext}.\u00a0Since\u00a0the\u00a0spec\u00a0requires<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0that\u00a0the\u00a0asynchronous\u00a0invocations\u00a0must\u00a0not\u00a0update\u00a0response\u00a0context,<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0depending\u00a0on\u00a0the\u00a0mode\u00a0of\u00a0invocationthey\u00a0have\u00a0to\u00a0go\u00a0to\u00a0different\u00a0places.<\/p>\n<p>*\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0So\u00a0we\u00a0take\u00a0a\u00a0setter\u00a0that\u00a0abstracts\u00a0that\u00a0away.<\/p>\n<p>*\/<\/p>\n<p><strong>protected<\/strong> <strong>final<\/strong> Packet process(Packet packet, RequestContext requestContext, ResponseContextReceiver receiver) {<\/p>\n<p>configureRequestPacket(packet, requestContext);<\/p>\n<p>Pool&lt;Tube&gt; pool =\u00a0tubes;<\/p>\n<p><strong>if<\/strong> (pool ==\u00a0<strong>null<\/strong>)<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> WebServiceException(&#8220;close method has already been invoked&#8221;);\u00a0\/\/\u00a0<strong>TODO<\/strong>: i18n<\/p>\n<p>Fiber fiber =\u00a0engine.createFiber();<\/p>\n<p>\/\/ then send it away!<\/p>\n<p>Tube tube = pool.take();<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p><strong>return<\/strong> fiber.runSync(tube, packet);<\/p>\n<p>}\u00a0<strong>finally<\/strong> {<\/p>\n<p>\/\/ this allows us to capture the packet even when the call failed with an exception.<\/p>\n<p>\/\/ when the call fails with an exception it&#8217;s no longer a &#8216;reply&#8217; but it may provide some information<\/p>\n<p>\/\/ about what went wrong.<\/p>\n<p>\/\/ note that Packet can still be updated after<\/p>\n<p>\/\/ ResponseContext is created.<\/p>\n<p>Packet reply = (fiber.getPacket() ==\u00a0<strong>null<\/strong>) ? packet : fiber.getPacket();<\/p>\n<p>receiver.setResponseContext(<strong>new<\/strong> ResponseContext(reply));<\/p>\n<p>pool.recycle(tube);<\/p>\n<p>}<\/p>\n<p>}<strong> <\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>4.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.api.pipe.\u00a0__doRun\u7684(\u4e2d\u95f4\u7701\u53bb\u4e863\u5c42\u4e0d\u91cd\u8981\u7684\u4ee3\u7801)<\/p>\n<p><strong>\u8fd9\u6bb5\u4ee3\u7801\u5f00\u59cb\u53d1\u9001\u6253\u6210\u6570\u636e\u5305\u7684<\/strong><strong>http<\/strong><strong>\u8bf7\u6c42<\/strong><strong> <\/strong><\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\">\/**<\/p>\n<p>*\u00a0To\u00a0be\u00a0invoked\u00a0from\u00a0{@link #doRun(Tube)}.<\/p>\n<p>*<\/p>\n<p>*\u00a0<strong>@see<\/strong> #doRun(Tube)<\/p>\n<p>*\/<\/p>\n<p><strong>private<\/strong> Tube __doRun(Tube next) {<\/p>\n<p><strong>final<\/strong> Fiber old =\u00a0<em>CURRENT_FIBER<\/em>.get();<\/p>\n<p><em>CURRENT_FIBER<\/em>.set(<strong>this<\/strong>);<\/p>\n<p>\/\/ if true, lots of debug messages to show what&#8217;s being executed<\/p>\n<p><strong>final<\/strong> <strong>boolean<\/strong> traceEnabled =\u00a0<em>LOGGER<\/em>.isLoggable(Level.<em>FINER<\/em>);<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p><strong>while<\/strong>(!isBlocking() &amp;&amp; !needsToReenter) {<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p>NextAction na;<\/p>\n<p>Tube last;<\/p>\n<p><strong>if<\/strong>(throwable!=<strong>null<\/strong>) {<\/p>\n<p><strong>if<\/strong>(contsSize==0) {<\/p>\n<p>\/\/ nothing else to execute. we are done.<\/p>\n<p><strong>return<\/strong> <strong>null<\/strong>;<\/p>\n<p>}<\/p>\n<p>last = popCont();<\/p>\n<p><strong>if<\/strong>(traceEnabled)<\/p>\n<p><em>LOGGER<\/em>.finer(getName()+&#8217; &#8216;+last+&#8221;.processException(&#8220;+throwable+&#8217;)&#8217;);<\/p>\n<p>na = last.processException(throwable);<\/p>\n<p>}\u00a0<strong>else<\/strong> {<\/p>\n<p><strong>if<\/strong>(next!=<strong>null<\/strong>) {<\/p>\n<p><strong>if<\/strong>(traceEnabled)<\/p>\n<p><em>LOGGER<\/em>.finer(getName()+&#8217; &#8216;+next+&#8221;.processRequest(&#8220;+packet+&#8217;)&#8217;);<\/p>\n<p>na = next.processRequest(packet);<\/p>\n<p>last = next;<\/p>\n<p>}\u00a0<strong>else<\/strong> {<\/p>\n<p><strong>if<\/strong>(contsSize==0) {<\/p>\n<p>\/\/ nothing else to execute. we are done.<\/p>\n<p><strong>return<\/strong> <strong>null<\/strong>;<\/p>\n<p>}<\/p>\n<p>last = popCont();<\/p>\n<p><strong>if<\/strong>(traceEnabled)<\/p>\n<p><em>LOGGER<\/em>.finer(getName()+&#8217; &#8216;+last+&#8221;.processResponse(&#8220;+packet+&#8217;)&#8217;);<\/p>\n<p>na = last.processResponse(packet);<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p><strong> <\/strong><strong>\uff5e\u7701\u7565\uff5e<\/strong><strong> <\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>5.\u00a0\u8fd9\u884c\u4ee3\u7801\uff0c\u4f1a\u8c03\u7528\u5230com.sun.xml.ws.encoding.\u00a0StreamSOAPCodec\u7684(\u4e2d\u95f4\u7701\u53bb\u4e86\u65e0\u6570\u5c42\u4e0d\u91cd\u8981\u7684\u4ee3\u7801)\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>public<\/strong> ContentType encode(Packet packet, OutputStream out) {<\/p>\n<p><strong>if<\/strong> (packet.getMessage() !=\u00a0<strong>null<\/strong>) {<\/p>\n<p>XMLStreamWriter writer = XMLStreamWriterFactory.<em>create<\/em>(out);<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p>packet.getMessage().writeTo(writer);<\/p>\n<p>writer.flush();<\/p>\n<p>}\u00a0<strong>catch<\/strong> (XMLStreamException e) {<\/p>\n<p><strong>throw<\/strong> <strong>new<\/strong> WebServiceException(e);<\/p>\n<p>}<\/p>\n<p>XMLStreamWriterFactory.<em>recycle<\/em>(writer);<\/p>\n<p>}<\/p>\n<p><strong>return<\/strong> getContentType(packet.soapAction);<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u5927\u5bb6\u53ef\u4ee5\u770b\u5230\uff0c\u4ed6\u53d1\u51fa\u8bf7\u6c42\u4e86\u3002<\/strong><strong> <\/strong><\/p>\n<h2>3.4\u00a0\u670d\u52a1\u5668\u7aef\u662f\u5982\u4f55\u63a5\u53d7\u8bf7\u6c42\u7684\uff1f<\/h2>\n<p>1.\u00a0\u9996\u5148\uff0c\u670d\u52a1\u5668\u7aef\u6709\u4e00\u4e2a\u540d\u53ebJAXWSServlet\u7684Servlet\u5e38\u9a7b\u670d\u52a1\u5668\uff0c\u76d1\u542c\u8bf7\u6c42\u3002\u6240\u4ee5\uff0c\u8bf7\u6c42\u4f1a\u9996\u5148\u88ab\u8f6c\u53d1\u7ed9com.sun.enterprise.webservice.JAXWSServlet\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>protected<\/strong> <strong>void<\/strong> doPost(HttpServletRequest request,<\/p>\n<p>HttpServletResponse response)<\/p>\n<p><strong>throws<\/strong> ServletException ,IOException{<\/p>\n<p>\/**<\/p>\n<p>*\u00a0This\u00a0requirement\u00a0came\u00a0from\u00a0the\u00a0jbi\u00a0team.\u00a0If\u00a0the\u00a0WebServiceEndpoint<\/p>\n<p>*\u00a0is\u00a0a\u00a0jbi\u00a0endpoint\u00a0which\u00a0is\u00a0private\u00a0throw\u00a0an\u00a0error\u00a0whenever\u00a0a\u00a0get<\/p>\n<p>*\u00a0or\u00a0a\u00a0post\u00a0request\u00a0is\u00a0made<\/p>\n<p>*\/<\/p>\n<p>Endpoint endpt =<\/p>\n<p>wsEngine_.getEndpoint(request.getServletPath());<\/p>\n<p>\uff5e\u7701\u7565\uff5e<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>2.\u6700\u540e\uff0c\u4ee3\u7801\u4f1a\u8c03\u8f6c\u5230\u4ee5\u4e0bcom.sun.xml.ws.transport.http.HttpAdapter\u7684<\/p>\n<table border=\"1\" cellspacing=\"0\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"580\" valign=\"top\"><strong>final<\/strong> <strong>class<\/strong> HttpToolkit\u00a0<strong>extends<\/strong> Adapter.Toolkit\u00a0{<\/p>\n<p><strong>public<\/strong> <strong>void<\/strong> handle(WSHTTPConnection con)\u00a0<strong>throws<\/strong> IOException {<\/p>\n<p><strong>boolean<\/strong> invoke =\u00a0<strong>false<\/strong>;<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p>Packet packet =\u00a0<strong>new<\/strong> Packet();<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p>packet = decodePacket(con,\u00a0codec);<\/p>\n<p>invoke =\u00a0<strong>true<\/strong>;<\/p>\n<p>}\u00a0<strong>catch<\/strong>(ExceptionHasMessage e) {<\/p>\n<p><em>LOGGER<\/em>.log(Level.<em>SEVERE<\/em>,\u00a0&#8220;JAXWS2015: An ExceptionHasMessage occurred. &#8221;\u00a0+ e.getMessage(), e);<\/p>\n<p>packet.setMessage(e.getFaultMessage());<\/p>\n<p>}\u00a0<strong>catch<\/strong>(UnsupportedMediaException e) {<\/p>\n<p><em>LOGGER<\/em>.log(Level.<em>SEVERE<\/em>,\u00a0&#8220;JAXWS2016: An UnsupportedMediaException occurred. &#8221;\u00a0+ e.getMessage(), e);<\/p>\n<p>con.setStatus(WSHTTPConnection.<em>UNSUPPORTED_MEDIA<\/em>);<\/p>\n<p>}\u00a0<strong>catch<\/strong>(Exception e) {<\/p>\n<p><em>LOGGER<\/em>.log(Level.<em>SEVERE<\/em>,\u00a0&#8220;JAXWS2017: A ServerRtException occurred. &#8221;\u00a0+ e.getMessage(), e);<\/p>\n<p>con.setStatus(HttpURLConnection.<em>HTTP_INTERNAL_ERROR<\/em>);<\/p>\n<p>}<\/p>\n<p><strong>if<\/strong> (invoke) {<\/p>\n<p><strong>try<\/strong> {<\/p>\n<p>packet =\u00a0head.process(packet, con.getWebServiceContextDelegate(),<\/p>\n<p>packet.transportBackChannel);<\/p>\n<p>}\u00a0<strong>catch<\/strong>(Exception e) {<\/p>\n<p><em>LOGGER<\/em>.log(Level.<em>SEVERE<\/em>,\u00a0&#8220;JAXWS2018: An Exception occurred. &#8221;\u00a0+ e.getMessage(), e);<\/p>\n<p><strong>if<\/strong> (!con.isClosed()) {<\/p>\n<p>writeInternalServerError(con);<\/p>\n<p>}<\/p>\n<p><strong>return<\/strong>;<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>encodePacket(packet, con,\u00a0codec);<\/p>\n<p>}\u00a0<strong>finally<\/strong> {<\/p>\n<p><strong>if<\/strong> (!con.isClosed()) {<\/p>\n<p>con.close();<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/p>\n<p>}<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u4ee5\u4e0a\u4ee3\u7801\u5206\u4e3a\u4e09\u5757\u5927\u7684\u5904\u7406\uff0c\u5206\u522b\u662f<\/p>\n<p>packet = decodePacket(con,\u00a0codec);<\/p>\n<p>packet =\u00a0head.process(packet, con.getWebServiceContextDelegate(),<\/p>\n<p>packet.transportBackChannel);<\/p>\n<p>encodePacket(packet, con,\u00a0codec);<\/p>\n<p><strong>\u7528\u6765\u89e3\u6790\u6570\u636e\u5305\uff0c\u8c03\u7528\u670d\u52a1\uff0c\u53d1\u9001\u56de\u590d\u6570\u636e\u5305\u3002\u8fd9\u91cc\u5c31\u4e0d\u8be6\u7ec6\u4ecb\u7ecd\u4e86\u3002<\/strong><strong> <\/strong><\/p>\n<h1>4.\u00a0\u603b\u7ed3<\/h1>\n<p><strong>\u5e0c\u671b\u80fd\u591f\u901a\u8fc7\u8fd9\u6837\u7684\u6587\u7ae0\uff0c\u66f4\u6e05\u6670\u7684\uff0c\u76f4\u767d\u7684\u628aWebService\u7684\u8be6\u7ec6\u6280\u672f\u5185\u5e55\u516c\u5e03\u7ed9\u5927\u5bb6\uff0c\u4e3a\u5f00\u6e90\u8f6f\u4ef6\u8fd0\u52a8\u4f5c\u4e00\u4efd\u81ea\u5df1\u7684\u8d21\u732e\u3002<\/strong><\/p>\n<p><strong> <\/strong><\/p>\n<p><strong>##<\/strong><strong>\u4ee5\u4e0a<\/strong><strong>##<\/strong><\/p>\n<p>\u53d1\u8868\u4e8e @ 2010\u5e7402\u670825\u65e5\u300011:44:00\u00a0|\u00a0<a title=\"\u8bc4\u8bba\" href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/25\/5325361.aspx#FeedBack\">\u8bc4\u8bba(\u00a087\u00a0) <\/a>|\u00a0<a href=\"mailto:webmaster@csdn.net?subject=Article%20Report!!!&amp;body=Author:nanjingjiangbiao%0D%0AURL:http:\/\/blog.csdn.net\/ArticleContent.aspx?UserName=nanjingjiangbiao&amp;Entryid=5325361\">\u4e3e\u62a5<\/a>|\u00a0<cite><a title=\"\u6536\u85cf\u5230\u6211\u7684\u7f51\u6458\u4e2d\uff0c\u5e76\u5206\u4eab\u7ed9\u6211\u7684\u670b\u53cb\" href=\"http:\/\/blog.csdn.net\/nanjingjiangbiao\/archive\/2010\/02\/25\/5325361.aspx\">\u6536\u85cf<\/a><\/cite><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Web\u00a0Service\u6280\u672f\u5185\u5e55 &#8211;Web Service\u7684\u8be6\u7ec6\u6559\u7a0b\u548c\u534f\u8bae\u5206\u6790 2010\/2\/25\u00a0 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-221","post","type-post","status-publish","format-standard","hentry","category-1"],"_links":{"self":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts\/221","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=221"}],"version-history":[{"count":0,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=\/wp\/v2\/posts\/221\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=221"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=221"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.my0513.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=221"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}