{"id":95,"date":"2025-04-30T18:12:25","date_gmt":"2025-04-30T10:12:25","guid":{"rendered":"https:\/\/lib.kimsor.top\/?p=95"},"modified":"2025-04-30T18:12:25","modified_gmt":"2025-04-30T10:12:25","slug":"java%e5%af%b9%e6%8e%a5webservice%e6%8e%a5%e5%8f%a3%e6%a1%88%e4%be%8b","status":"publish","type":"post","link":"https:\/\/lib.kimsor.top\/?p=95","title":{"rendered":"JAVA\u5bf9\u63a5WebService\u63a5\u53e3\u6848\u4f8b"},"content":{"rendered":"\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u63a8\u8350\u4f7f\u7528SOAPUI\u8fd9\u4e2a\u8f6f\u4ef6\u8fdb\u884cwebservice\u63a5\u53e3\u6d4b\u8bd5<\/p>\n\n\n\n<p><strong>1\u3001\u6253\u5f00soapui\uff0c<\/strong><strong>\u9009\u62e9New SOAP Project<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"486\" src=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-22-1024x486.png\" alt=\"\" class=\"wp-image-98\" srcset=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-22-1024x486.png 1024w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-22-300x142.png 300w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-22-768x365.png 768w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-22.png 1512w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>2\u3001\u8f93\u5165\u9879\u76ee\u540d\u548cwebservice\u670d\u52a1\u5730\u5740\uff0c\u9879\u76ee\u540d\u968f\u4fbf\u8f93\u5165\u5373\u53ef\uff0c\u8fd9\u91cc\u4f7f\u7528\u7684wsdl\u793a\u4f8b\u5730\u5740\u662fhttp:\/\/www.webxml.com.cn\/WebServices\/WeatherWebService.asmx?wsdl<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"626\" src=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-24-1024x626.png\" alt=\"\" class=\"wp-image-100\" srcset=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-24-1024x626.png 1024w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-24-300x183.png 300w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-24-768x469.png 768w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-24.png 1072w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>3\u3001\u5de6\u4fa7projects\u5c31\u51fa\u73b0\u4e86\u670d\u52a1\u4ee5\u53ca\u76f8\u5173\u65b9\u6cd5<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"578\" src=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-25-1024x578.png\" alt=\"\" class=\"wp-image-101\" srcset=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-25-1024x578.png 1024w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-25-300x169.png 300w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-25-768x434.png 768w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-25.png 1047w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>4\u3001\u6211\u4eec\u8fd9\u91cc\u968f\u673a\u9009\u4e86\u7b2c\u4e00\u4e2a\u65b9\u6cd5\u53f3\u952eNew request\uff0c\u5e76\u7ed9\u5176\u8bbe\u7f6e\u540d\u79f0\u4e3aRequest 2<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"787\" height=\"554\" src=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-26.png\" alt=\"\" class=\"wp-image-102\" srcset=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-26.png 787w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-26-300x211.png 300w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-26-768x541.png 768w\" sizes=\"auto, (max-width: 787px) 100vw, 787px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"557\" src=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-27-1024x557.png\" alt=\"\" class=\"wp-image-105\" srcset=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-27-1024x557.png 1024w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-27-300x163.png 300w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-27-768x418.png 768w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-27.png 1184w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>5\u3001\u7136\u540e\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e86<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"670\" src=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-28-1024x670.png\" alt=\"\" class=\"wp-image-106\" srcset=\"https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-28-1024x670.png 1024w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-28-300x196.png 300w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-28-768x502.png 768w, https:\/\/lib.kimsor.top\/wp-content\/uploads\/2025\/04\/image-28.png 1199w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5b9e\u9645\u9047\u5230\u6848\u4f8b<\/h3>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4e0b\u9762\u7684\u4ee3\u7801\u662f\u6211\u5bf9\u63a5\u5230\u4e00\u4e2awebservice\u63a5\u53e3\u6240\u7f16\u5199\u7684\uff0c\u8fd9\u91cc\u6709\u4e2a\u5f88\u5927\u7684\u5751\uff0c\u6211\u8bf7\u6c42\u5934\u76f4\u63a5\u4f7f\u7528text\/xml\u6ca1\u6709\u6548\u679c\uff0c\u53cd\u800c\u7528application\/soap+xml\u5219\u8bf7\u6c42\u6210\u529f<\/p>\n\n\n\n<pre class=\"wp-block-code has-border-color has-pale-cyan-blue-background-color has-background\" style=\"border-color:#8ed1fc;border-width:12px;border-radius:18px\"><code>String url = \"http:\/\/x.x.x.x:80\/soap\/JHIPLIB.SOAP.BS.Service.cls?CfgItem=JH\";\n        Map&lt;String, String> map = new HashMap&lt;>();\n        String innerXml = \"&lt;soapenv:Envelope xmlns:soapenv=\\\"http:\/\/schemas.xmlsoap.org\/soap\/envelope\/\\\" xmlns:good=\\\"http:\/\/goodwillcis.com\\\" xmlns:bjg=\\\"http:\/\/bjgoodwillcis.com\\\">\" +\n                \"&lt;soapenv:Body>\" +\n                \"&lt;bjg:Send>\" +\n                \"&lt;bjg:pInput>\" +\n                \"&lt;!&#91;CDATA&#91;&lt;REQUEST>&lt;SESSION_ID>\"+token+\"&lt;\/SESSION_ID>&lt;SYSTEM_CODE>xxx&lt;\/SYSTEM_CODE>&lt;\/REQUEST>]]>\" +\n                \"&lt;\/bjg:pInput>\" +\n                \"&lt;\/bjg:Send>\" +\n                \"&lt;\/soapenv:Body>\" +\n                \"&lt;\/soapenv:Envelope>\";\n\n        try (CloseableHttpClient httpClient = HttpClients.createDefault()) {\n            HttpPost httpPost = new HttpPost(url);\n            httpPost.setHeader(\"Content-Type\",\"application\/soap+xml; charset=utf-8\");\n            httpPost.setEntity(new StringEntity(innerXml));\n\n            String entity = \"\";\n            try(CloseableHttpResponse response = httpClient.execute(httpPost)){\n                entity = EntityUtils.toString(response.getEntity());\n            }catch (Exception e){\n                e.printStackTrace();\n            }\n} catch (Exception e) {\n            e.printStackTrace();\n            logger.error(\"\u767b\u5f55\u5f02\u5e38\uff0c\u5f02\u5e38\u4e3a:\" + e);\n        }<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u63a8\u8350\u4f7f\u7528SOAPUI\u8fd9\u4e2a\u8f6f\u4ef6\u8fdb\u884cwebservice\u63a5\u53e3\u6d4b\u8bd5 1\u3001\u6253\u5f00soapui\uff0c\u9009\u62e9New SOAP Pr [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,5],"tags":[],"class_list":["post-95","post","type-post","status-publish","format-standard","hentry","category-springboot","category-5"],"_links":{"self":[{"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=\/wp\/v2\/posts\/95","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=95"}],"version-history":[{"count":4,"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions"}],"predecessor-version":[{"id":108,"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=\/wp\/v2\/posts\/95\/revisions\/108"}],"wp:attachment":[{"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=95"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=95"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lib.kimsor.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=95"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}