{"id":172,"date":"2009-07-03T16:36:57","date_gmt":"2009-07-03T08:36:57","guid":{"rendered":"http:\/\/leegorous.net\/blog\/?p=172"},"modified":"2012-04-08T17:43:00","modified_gmt":"2012-04-08T09:43:00","slug":"a-bug-in-first-cxf-jaxws-client-example","status":"publish","type":"post","link":"http:\/\/leegorous.net\/blog\/2009\/07\/03\/a-bug-in-first-cxf-jaxws-client-example\/","title":{"rendered":"\u4e00\u4e2a\u659c\u6760\u5f15\u8d77\u7684\u601d\u8003"},"content":{"rendered":"<p>\u6700\u8fd1\u5173\u6ce8 WebService\uff0c\u5c1d\u8bd5CXF\u7684\u4e00\u4e2a <a href=\"http:\/\/svn.apache.org\/repos\/asf\/cxf\/trunk\/distribution\/src\/main\/release\/samples\/java_first_jaxws\/src\/demo\/hw\/client\/Client.java\" target=\"_blank\">Client \u6837\u4f8b<\/a> \u65f6\uff0c\u4fee\u6539\u4e00\u4e0b\uff0c\u8fd0\u884c\uff0c\u603b\u662f\u62a5\u8fd9\u4e2a\u9519\uff1a<br \/>\nCaused by: java.net.MalformedURLException: Invalid address. Endpoint address cannot be null.<br \/>\n&#8230;&#8230;<\/p>\n<p>\u672c\u6765\u60f3\u8df3\u8fc7\u5b83\u4e86\uff0c\u4f46\u662f\u5f88\u7b80\u5355\u7684\u4fee\u6539\uff0c\u5982\u4e0b<\/p>\n<pre name=\"code\" class=\"brush: java\">\r\npublic static final QName SERVIVE_NAME = new QName(\r\n\t\t&quot;http:\/\/ws.leegorous.net&quot;, &quot;Hello&quot;);\r\npublic static final QName PORT_NAME = new QName(\r\n\t\t&quot;http:\/\/ws.leegorous.net&quot;, &quot;HelloPort&quot;);\r\n\r\npublic static void main(String[] args) {\r\n\tService service = Service.create(SERVIVE_NAME);\r\n\r\n\tString endpointAddress = &quot;http:\/\/localhost:9000\/hello&quot;;\r\n\tservice.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,\r\n\t\t\tendpointAddress);\r\n\r\n\tHello srv = service.getPort(Hello.class);\r\n\tSystem.out.println(srv.sayHi(&quot;Leegorous&quot;));\r\n}\r\n<\/pre>\n<p>\u611f\u89c9\u79bb\u771f\u76f8\u5f88\u8fd1\uff0c\u4f46\u600e\u4e48\u90fd\u641e\u4e0d\u7740\u7684\u611f\u89c9\u771f\u662f\u7cdf\u7cd5\uff5e<\/p>\n<p>\u4e8e\u662f\u5f00\u59cb\u8c03\u8bd5\uff0c\u8c03\u8bd5\u4e00\u4e0b\u4e5f\u4e0d\u9519\uff0c\u53ef\u4ee5\u987a\u4fbf\u5927\u6982\u4e86\u89e3\u4e0b\u8fc7\u7a0b\uff0c\u4f46\u662f\u8d8a\u6316\u6398\uff0c\u8d8a\u89c9\u5f97\u5947\u602a\u3002\u5c0f\u8bf4\u7535\u89c6\u91cc\uff0c\u7ecf\u5e38\u5439\u5618\u5f53\u627e\u4e0d\u5230\u65b9\u5411\u65f6\u4e0d\u59a8\u56de\u5230\u539f\u70b9\uff0c\u8fd9\u4e2a\u7684\u539f\u70b9\u5c31\u662f\u6211\u4fee\u6539\u7684\u90e8\u5206\u3002<\/p>\n<p>\u5f88\u5947\u602a\u7684\u53d1\u73b0\u6837\u4f8b\u91cc\u521d\u59cb\u5316QName\u7684\u7b2c\u4e00\u4e2a\u53c2\u6570\u662f\u4ee5&#8221;\/&#8221;\u7ed3\u5c3e\u7684\uff0c\u6211\u60f3\u4e0d\u4f1a\u5427\u3002<br \/>\n\u4e00\u8fb9\u8d28\u7591\u7740\u81ea\u5df1\uff0c\u4e00\u8fb9\u52a0\u4e0a\u659c\u6760\uff0c\u8fd0\u884c\u6d4b\u8bd5\uff0c\u5c45\u7136\u6210\u529f\u4e86\uff01<\/p>\n<pre name=\"code\" class=\"brush: java\">\r\npublic static final QName SERVIVE_NAME = new QName(\r\n\t\t&quot;http:\/\/ws.leegorous.net\/&quot;, &quot;Hello&quot;);\r\npublic static final QName PORT_NAME = new QName(\r\n\t\t&quot;http:\/\/ws.leegorous.net\/&quot;, &quot;HelloPort&quot;);\r\n<\/pre>\n<p>\u5df2\u7ecf\u627e\u5230\u6b65\u5411\u771f\u76f8\u7684\u5165\u53e3\u4e86\u3002\u6216\u8bb8\u662fQName\u7684\u95ee\u9898\uff0c\u4e5f\u53ef\u80fd\u662f\u540e\u9762\u4f7f\u7528\u5b83\u7684\u7a0b\u5e8f\u6709\u95ee\u9898\uff0c\u5177\u4f53\u8fd8\u6709\u5f85\u89e3\u5256\u62a5\u544a\u3002<\/p>\n<p>\u8fd9\u4e2a\u95ee\u9898\u8c8c\u4f3c\u4e0d\u592a\u503c\u5f97\u4e00\u5199\u3002\u4e0d\u8fc7\u5b83\u4f7f\u6211\u60f3\u8d77\u6628\u665a\u53d1\u73b0\u7684\u4e00\u8d77\u4e8b\u4ef6\uff0c\u67d0\u62a5\u6587\u7cfb\u7edf\u5df2\u7ecf\u8fd0\u884c\u4e86\u6570\u5e74\uff0c\u4f46\u5c45\u7136\u8fd8\u6709\u6bd4\u8f83\u4f4e\u7ea7\u7684\u89e3\u6790\u5931\u8d25\uff0c\u800c\u4e14\u6700\u7cdf\u7cd5\u5c31\u662f\u641c\u7d22\u8fc7\u5206\u4f9d\u8d56\u4e8e\u90a3\u4e2a\u51fa\u9519\u7684\u5c5e\u6027\u3002\u800c\u636e\u6211\u89c2\u5bdf\uff0c\u597d\u4e9b\u7cfb\u7edf\u95ee\u9898\u90fd\u662f\u6709\u5404\u79cd\u5404\u6837\u7684\u201c\u5c0f\u201d\u800c\u4e14\u4e0d\u592a\u53ef\u80fd\u53d1\u751f\u7684\u5931\u8bef\u800c\u9020\u6210\u7684\uff0c\u4e5f\u6b63\u662f\u5927\u5bb6\u90fd\u4e0d\u662f\u4ed4\u7ec6\u6536\u96c6\u548c\u5206\u6790\u8bc1\u636e\uff0c\u800c\u662f\u5148\u5165\u4e3a\u4e3b\u7684\u5426\u51b3\u4e86\u5176\u4e9b\u53ef\u80fd\u6027\u8f6c\u800c\u53bb\u601d\u8003\u6240\u8c13\u7684\u66f4\u5927\u53ef\u80fd\u6027\uff0c\u800c\u6d6a\u8d39\u4e86\u5927\u91cf\u7684\u65f6\u95f4\u3002<\/p>\n<p>\u4e0d\u8fc7\u6709\u4e9b\u5148\u5165\u4e3a\u4e3b\u7684\u5370\u8c61\u4f5c\u7528\u662f\u6211\u4eec\u4e0d\u80fd\u5de6\u53f3\u7684\uff0c\u5c31\u5982\u73b0\u5728\u4eba\u4eec\u5728\u4ecb\u7ecd\u6211\u65f6\u4f9d\u7136\u662f\u7528\u7c7b\u4f3c\u4e8e\u201c\u4e00\u4e2aWeb\u754c\u9762\u9ad8\u624b\u201d\uff0c\u751a\u81f3\u662f\u201c\u7f8e\u5de5\u201d\uff0c\u9664\u4e86\u65e0\u5948\uff0c\u8fd8\u80fd\u505a\u4ec0\u4e48\u5462\uff1f<\/p>\n<p>\u96be\u9053\u8df3\u51fa\u6765\u5927\u53eb<br \/>\n<em>\u201cThat&#8217;s so 2007\u201d<\/em> <\/p>\n<p>!##$%^&#038;*()~~<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u5173\u6ce8 WebService\uff0c\u5c1d\u8bd5CXF\u7684\u4e00\u4e2a Client \u6837\u4f8b \u65f6\uff0c\u4fee\u6539\u4e00\u4e0b\uff0c\u8fd0\u884c\uff0c\u603b\u662f\u62a5\u8fd9\u4e2a\u9519\uff1a Ca &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/leegorous.net\/blog\/2009\/07\/03\/a-bug-in-first-cxf-jaxws-client-example\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u4e00\u4e2a\u659c\u6760\u5f15\u8d77\u7684\u601d\u8003\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[77],"tags":[29,28],"_links":{"self":[{"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/posts\/172"}],"collection":[{"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/comments?post=172"}],"version-history":[{"count":11,"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions"}],"predecessor-version":[{"id":1193,"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/posts\/172\/revisions\/1193"}],"wp:attachment":[{"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/media?parent=172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/categories?post=172"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/leegorous.net\/blog\/wp-json\/wp\/v2\/tags?post=172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}