当前位置: 首页 > news >正文

公司网站是否做地方分站百度一下首页问问

公司网站是否做地方分站,百度一下首页问问,广告联盟建设个人网站,做美工一般要收藏哪些网站原文:SOAP with TrinityCore | TrinityCore MMo Project Wiki 如何使用SOAP与TC交互 SOAP代表简单对象访问协议,是一种类似于REST的基于标准的web服务访问协议的旧形式。只要必要的配置到位,您就可以利用SOAP向TrinityCore服务器发送命令。 …

原文:SOAP with TrinityCore | TrinityCore MMo Project Wiki

 

如何使用SOAP与TC交互

SOAP代表简单对象访问协议,是一种类似于REST的基于标准的web服务访问协议的旧形式。只要必要的配置到位,您就可以利用SOAP向TrinityCore服务器发送命令。
理解SOAP的一个好方法是将其与当代REST进行比较。以下文章很好地解释了这一点——https://smartbear.com/blog/soap-vs-rest-whats-the-difference/.
两者之间的主要区别在于,SOAP完全依赖于XML来提供响应和接受有效载荷。PHP提供了一些使此过程更容易的方法,但根据您的使用情况,您可能需要熟悉XML。

配置


worldserver.conf
确保配置文件中的设置设置正确。

#    SOAP.Enable
#        Description: Enable soap service.
#        Default:     0 - (Disabled)
#                     1 - (Enabled)
SOAP.Enabled = 1#    SOAP.IP
#        Description: Bind SOAP service to IP/hostname.
#        Default:     "127.0.0.1" - (Bind to localhost)
SOAP.IP = "127.0.0.1"#    SOAP.Port
#        Description: TCP port to reach the SOAP service.
#        Default:     7878
SOAP.Port = 7878

考虑到您的特定RBAC访问配置,您还需要一个有权使用GM命令的用户帐户。专门为此目的创建一个受限访问帐户,而不是一个人使用的帐户,这可能是一个好主意。

注意:在撰写本文时,TC 335a仅支持HTTP,因此请注意不要以这种方式发送机密(密码等)。假设传递的任何内容都是明文形式,任何人都可以阅读。
如果您计划通过SOAP远程连接,您绝对应该采取措施确保安全连接。一种潜在的方法是通过apache或nginx通过反向SSL代理。但是,这不在本指南的范围内,将不包括在内。

用于原型制作的HTTP客户端


有一些客户端可以快速建立连接并测试控制台命令:
postman:https://www.postman.com/(网络、桌面代理/客户端)
insomnia:https://insomnia.rest/
夜莺nightingale:https://nightingale.rest/
它们都提供了各种各样的细节,但最终的工作原理大致相同。感谢Jackpoz为Postman提供的具体步骤-https://www.postman.com/.
Postman有两种风格:web界面(以及可以安装以执行localhost请求的代理)和完全客户端桌面应用程序。这两种情况下的说明是相同的。
在“我的工作区”下,找到“导入”按钮。您将使用原始文本选项。
将以下JSON复制并粘贴到文本框中。请确保将item.request.auth.basic下的凭据更新为前面提到的GM用户。

{"info": {"name": "TC SOAP","schema": "https://schema.getpostman.com/json/collection/v2.0.0/collection.json"},"item": [{"name": "server info","request": {"auth": {"type": "basic","basic": {"username": "CHANGEME","password": "CHANGEME","showPassword": false}},"method": "POST","header": [],"body": {"mode": "raw","raw": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ns1=\"urn:TC\">\r\n<SOAP-ENV:Body>\r\n<ns1:executeCommand>\r\n<command>server info</command>\r\n</ns1:executeCommand>\r\n</SOAP-ENV:Body>\r\n</SOAP-ENV:Envelope>","options": {"raw": {"language": "xml"}}},"url": "http://127.0.0.1:7878"},"response": []}]
}

您应该将TC SOAP视为要导入的集合。单击“导入”。
这将使用正确的HTTP方法(POST)以及“授权”和“正文”选项卡下的详细信息填充新集合。
在Body选项卡下,注意XML负载和为您预先填充的服务器信息命令。
单击“发送”按钮将提交请求,并提供XML响应。
在Postman界面的右侧,一个</>符号将打开代码片段,可以将请求转换为您选择的语言。
¶使用PHP
要使用PHP与TrinityCore交互,您需要确保安装了PHP-soap扩展。还要确保您使用的是仍在积极支持的PHP版本。代码示例在PHP7.4到PHP8.1上进行了测试。
在所有这些示例中,urn:TC URI都是必需的参数,因为我们没有提供WSDL文档。
SoapClient-https://www.php.net/manual/en/class.soapclient.php

$command  = 'server info';$opts = ['http' => ['header' => "Authorization: Basic " . base64_encode("USERNAME:PASSWORD")]];$client = new SoapClient($wsdl = null, ['stream_context' => stream_context_create($opts),'location' => 'http://127.0.0.1:7878','uri' => 'urn:TC',
]);try {$result = $client->executeCommand(new SoapParam($command, 'command'));
} catch (\Exception $e) {die($e->getMessage());
}echo $result;

Note that we are passing a HTTP basic authorization header with base64 encoded username and password (separated by a colon). Alternatively, you could omit the stream_context parameter, and instead include a (login) username and password in your SoapClient configuration.

$command  = 'server info';$client = new SoapClient($wsdl = null, ['location' => 'http://127.0.0.1:7878','uri' => 'urn:TC','login' => 'USERNAME','password' => 'PASSWORD',
]);try {$result = $client->executeCommand(new SoapParam($command, 'command'));
} catch (Exception $e) {die($e->getMessage());
}echo $result;

Either approach is fine - but don't be fooled! Base 64 encoding does not inherently make it more secure.

Remember that the SOAP client can only recognize failures to connect, or misconfigurations. It will not know if you've provided an invalid command. So it's up to you to parse the results and decide if the intended result was a success or not. Output will be just as if you performed the command on the console.

Lastly, if you'd rather not rely on the SOAP extension or client, you can form the XML payload and parse the resulting XML response yourself. You'll still need the cURL extension, but this is usually available if not enabled by default.

<?xml version="1.0" encoding="utf-8"?>
<SOAP-ENV:Envelopexmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="urn:TC"><SOAP-ENV:Body><ns1:executeCommand><command>server info</command></ns1:executeCommand></SOAP-ENV:Body>
</SOAP-ENV:Envelope>
$curl = curl_init();curl_setopt_array($curl, [CURLOPT_POSTFIELDS => $payload, // $payload is the XML provided aboveCURLOPT_URL => 'http://127.0.0.1:7878',CURLOPT_TIMEOUT => 0,CURLOPT_CUSTOMREQUEST => 'POST',CURLOPT_HTTPHEADER => ["Authorization: Basic " . base64_encode("{$user}:{$pass}"),'Content-Type: application/xml',],
]);$response = curl_exec($curl);
curl_close($curl);
echo $response;

 

 

http://www.ds6.com.cn/news/69893.html

相关文章:

  • 嘉兴港区建设局网站百度网盘电脑版登录入口
  • 特色网站模板2023新闻热点事件
  • 网站开发拖延交货算诈骗吗企业网站设计模板
  • 怎么才服务器上做网站网络公司的推广
  • 传奇私服发布网网站建设北京发生大事了
  • 先做亚马逊网站怎么操作百度识图网页版在线
  • 郑州最好的男科医院有哪些seo方法图片
  • 成都高新区工商注册代办站长工具seo查询
  • 公司网站案例展示中文搜索引擎有哪些平台
  • 做ppt的网站 知乎怎么在网上做广告宣传
  • 微信 公众号 微网站开发百度下载正版
  • adobe做网站的网络做推广广告公司
  • 做医美设计的网站香港旺道旺国际集团
  • 国外wordpress电影模板山西seo和网络推广
  • 做网站手机模板app茂名网络推广
  • php动态网站开发架构深圳网站关键词
  • 网站没有关键词让百度收录自己的网站
  • 做的网站怎么提交到百度上去网络软文发布
  • 哪个网站做推广效果好360指数查询工具
  • 做购物网站建设的公司竞价sem托管公司
  • 西安专业网站建设如何注册百度账号
  • 天津做网站的公司怎么样seo内容优化
  • 学网站制作多少钱网站关键字排名优化
  • 利川网站建设上海百度关键词搜索推广服务
  • 网站建设前的规划百度广告多少钱
  • wordpress可以做淘宝客seo中国官网
  • 免费请美女做爰网站网红推广一般怎么收费
  • 沈阳海外模板建站湖南网站建设加盟代理
  • 500网站建设网站seo优化步骤
  • 网站建设构思网站优化 秦皇岛