php - Symantec Messaging 网关添加域肥皂请求
问题描述
我正在尝试在 php 中生成以下 XML 块以将其发送到 SMG 肥皂服务器。我怎样才能做到这一点?
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dom="http://schemas.symantec.com/jaxws/domainProvisioningService">
<soapenv:Header/>
<soapenv:Body>
<dom:AddDomains>
<dom:domains>
<domain name="domain1.com" local="true">
</domain>
<domain name="domain2.com" local="true">
</domain>
</dom:domains>
</dom:AddDomains>
</soapenv:Body>
</soapenv:Envelope>
解决方案
我执行了以下 php 块并创建了所需的输出:
$xmldom = new DOMDocument();
$domainsAttr = $xmldom->createElement( "domains" );
$domainAttr = $xmldom->createElement( "domain" );
$domainAttr->setAttribute( "name", "test.com" );
$domainAttr->setAttribute( "local", "true" );
$domainsAttr->appendChild( $domainAttr );
$xmldom->appendChild( $domainsAttr );
这是所需的输出:
<domains><domain name="test.com" local="true"/></domains>
我省略了要在此处发布的剩余代码,但是当我执行代码时,出现以下错误:
Cannot find dispatch method for {}domains
推荐阅读
- java - Maven - 在编译时发现类类型
- python - 如何平滑 z 值并减少其在 python 中的变化?
- php - 使用 html encode(yii2) 显示数据库中的数据
- python - 带有 python 子进程的 WSL
- nlp - 有没有办法将 spacy 标签列入白名单?
- google-apps-script - 无法在 Google 表格中设置值
- php - 在 WooCommerce 电子邮件通知中将发件人姓名更改为客户账单全名
- html - 是否可以在 transform: translateX 中使用 %vw?
- python - pybind11:通过值/引用将 numpy 数组传递给 c++
- css - 修复了滚动时移动设备上的背景缩放