{"componentChunkName":"component---src-templates-microservices-js","path":"/zh/microservices/instancecreate/","result":{"data":{"markdownRemark":{"html":"<h2 id=\"post\"><a href=\"#post\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>POST</h2>\n<h3 id=\"uri\"><a href=\"#uri\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>URI</h3>\n<p><code class=\"gatsby-code-text\">http://{server}:{port}/manager/web/api/service/instances</code></p>\n<h3 id=\"使用的方法\"><a href=\"#%E4%BD%BF%E7%94%A8%E7%9A%84%E6%96%B9%E6%B3%95\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>使用的方法</h3>\n<p>POST</p>\n<h3 id=\"父资源\"><a href=\"#%E7%88%B6%E8%B5%84%E6%BA%90\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>父资源</h3>\n<p>service</p>\n<h3 id=\"介绍\"><a href=\"#%E4%BB%8B%E7%BB%8D\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>介绍</h3>\n<p>通过API发布服务实例。</p>\n<p>支持的表述格式：JSON</p>\n<h3 id=\"http-请求方法\"><a href=\"#http-%E8%AF%B7%E6%B1%82%E6%96%B9%E6%B3%95\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>HTTP 请求方法</h3>\n<p>对如下 URI 执行 HTTP 请求，其中，<code class=\"gatsby-code-text\">{server}</code>是服务网关的服务器名，需用实际服务网关IP替换；<code class=\"gatsby-code-text\">{port}</code>是服务网关端口，需用实际网关端口替换。</p>\n<p><code class=\"gatsby-code-text\">http://{server}:{port}/manager/web/api/service/instances</code></p>\n<h4 id=\"post-请求\"><a href=\"#post-%E8%AF%B7%E6%B1%82\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>POST 请求</h4>\n<p>发布服务实例。</p>\n<h4 id=\"请求头格式\"><a href=\"#%E8%AF%B7%E6%B1%82%E5%A4%B4%E6%A0%BC%E5%BC%8F\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>请求头格式</h4>\n<div class=\"gatsby-highlight\" data-language=\"jsxon\"><pre class=\"gatsby-code-jsxon\"><code class=\"gatsby-code-jsxon\">content-type: application/json\nauthorization: Bearer {access_token}</code></pre></div>\n<h4 id=\"请求参数\"><a href=\"#%E8%AF%B7%E6%B1%82%E5%8F%82%E6%95%B0\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>请求参数</h4>\n<p>发布服务实例需要的参数：</p>\n<table>\n<col style=\"width: 20%;\" />\n<col style=\"width: 20%;\" />\n<col style=\"width: 60%;\" />\n\t<tr class=\"t1st\">\n\t\t<th>名称</th>\n\t\t<th>类型</th>\n\t\t<th>含义</th>\n\t</tr>\n\t<tr class=\"t2Row\">\n\t\t<td>dataSource</td>\n\t\t<td>String</td>\n\t\t<td>数据源类型的名称（请参见<a href=\"../service/\">API->service</a>中的数据源类型名称表）</td>\n\t</tr>\n\t<tr class=\"t1Row\">\n\t\t<td>serviceTypes</td>\n\t\t<td>String[]</td>\n\t\t<td>服务类型的名称（请参见<a href=\"../service/\">API->service</a>中的服务类型名称表）</td>\n\t</tr>\n\t<tr class=\"t1Row\">\n\t\t<td>nodeType</td>\n\t\t<td>String</td>\n\t\t<td>节点类型的名称（请参见<a href=\"../service/\">API->service</a>中的节点类型名称表）</td>\n\t</tr>\n\t<tr class=\"t2Row\">\n\t\t<td>nodeNames</td>\n\t\t<td>String[]</td>\n\t\t<td>服务实例所在服务节点的名称，可输入已有节点名称或重新创建</td>\n\t</tr>\n\t<tr class=\"t1Row\">\n\t\t<td>isCreateNode</td>\n\t\t<td>Boolean</td>\n\t\t<td>是否为新建节点</td>\n\t</tr>\n\t<tr class=\"t2Row\">\n\t\t<td>serviceXml</td>\n\t\t<td>String</td>\n\t\t<td>自定义服务配置（请参见SuperMap iServer帮助文档《iServer体系结构中各层的配置》）</td>\n\t</tr>\n\t<tr class=\"t1Row\" style=\"height: 0px;\">\n\t\t<td>settings</td>\n\t\t<td>String</td>\n\t\t<td>配置服务，根据不同数据源以及发布的服务类型配置。</td>\n\t</tr>\n</table>\n<h4 id=\"响应结构\"><a href=\"#%E5%93%8D%E5%BA%94%E7%BB%93%E6%9E%84\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>响应结构</h4>\n<p>返回服务实例是否发布成功，如果失败会给出错误信息：</p>\n<table>\n<col style=\"width: 20%;\" />\n<col style=\"width: 20%;\" />\n<col style=\"width: 20%;\" />\n<col style=\"width: 40%;\" />\n\t<tr class=\"t1st\" style=\"height: 34px;\">\n\t\t<th colspan=\"2\">字段</th>\n\t\t<th>类型</th>\n\t\t<th>说明</th>\n\t</tr>\n\t<tr class=\"t2Row\" style=\"height: 37px;\">\n\t\t<td colspan=\"2\">isSucceed</td>\n\t\t<td>Boolean</td>\n\t\t<td>是否执行成功，成功为true，失败为false</td>\n\t</tr>\n\t<tr class=\"t1Row\" style=\"height: 37px;\">\n\t\t<td colspan=\"2\">msg</td>\n\t\t<td>String</td>\n\t\t<td>如果执行失败，会显示错误信息；执行成功则为空</td>\n\t</tr>\n\t<tr class=\"t2Row\" style=\"height: 33px;\">\n\t\t<td rowspan=\"2\">serviceInfos</td>\n\t\t<td>componentName</td>\n\t\t<td rowspan=\"2\">String</td>\n\t\t<td>服务组件名称</td>\n\t</tr>\n\t<tr class=\"t1Row\" style=\"height: 34px;\">\n\t\t<td>interfaceName</td>\n\t\t<td>服务接口名称</td>\n\t</tr>\n</table>\n<h4 id=\"响应示例\"><a href=\"#%E5%93%8D%E5%BA%94%E7%A4%BA%E4%BE%8B\" aria-hidden class=\"anchor\"><svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg></a>响应示例</h4>\n<p>在管理员登录的状态下，对<code class=\"gatsby-code-text\">http://192.168.17.139:32507/manager/web/api/service/instances</code>执行POST请求，传入相关参数发布服务实例，如下所示：</p>\n<div class=\"gatsby-highlight\" data-language=\"jsxon\"><pre class=\"gatsby-code-jsxon\"><code class=\"gatsby-code-jsxon\">{\n    //数据源类型：文件型工作空间\n    &quot;dataSource&quot;: &quot;workspace&quot;,\n    //服务类型：REST-地图服务\n    &quot;serviceTypes&quot;:[\n        &quot;map-rest&quot;\n    ],\n    //节点类型：通用节点\n    &quot;nodeType&quot;: &quot;gisapplication&quot;,\n    &quot;nodeNames&quot;:[\n        &quot;Node1&quot;\n    ],\n    &quot;isCreateNode&quot;: true,\n    &quot;serviceXml&quot;: &quot;&quot;,\n    //数据源路径：/data/China400.smwu\n    &quot;settings&quot;:\n    {\n        &quot;workspacePath&quot;: &quot;/data/China400.smwu&quot;,\n        &quot;mapEditable&quot;: &quot;&quot;\n    }\n}</code></pre></div>\n<p>则返回的json格式的响应结果如下：</p>\n<div class=\"gatsby-highlight\" data-language=\"jsxon\"><pre class=\"gatsby-code-jsxon\"><code class=\"gatsby-code-jsxon\">{\n    &quot;isSucceed&quot;: true,\n    &quot;msg&quot;: &quot;&quot;,\n    &quot;serviceInfos&quot;: [\n        {\n            &quot;componentName&quot;: &quot;map-China400-astczjug0f&quot;,\n            &quot;interfaceName&quot;: &quot;rest&quot;,\n            &quot;alias&quot;: &quot;map-China400-astczjug0f-rest&quot;,\n            &quot;createTime&quot;: 1607676383491\n        }\n    ]\n}</code></pre></div>","frontmatter":{"title":"GIS云套件","next":null,"prev":null},"fields":{"path":"content/microservices/instancecreate.zh.md","slug":"/zh/microservices/instancecreate/","langKey":"zh"}}},"pageContext":{"slug":"/zh/microservices/instancecreate/"}}}