debuss-a/mtomsoapclient
Composer 安装命令:
composer require debuss-a/mtomsoapclient
包简介
This class overrides SoapClient::__doRequest() method to implement MTOM for PHP. It decodes XML and integrate attachments in the XML response.
关键字:
README 文档
README
Small PHP Soap class to deal with MTOM technology, fetching binaries as base64 string.
This class overrides SoapClient::__doRequest() method to implement MTOM for PHP.
It decodes XML and integrate attachments in the XML response.
It replaces the
<xop:Include href="cid:d08bab58-dfea-43f0-8520-477d4c5e0677-103@cxf.apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/>
By the binary code contained in attachment
Content-ID: <d08bab58-dfea-43f0-8520-477d4c5e0677-103@cxf.apache.org>
Personal Note
The class is not perfect and not so optimized but it works for most cases and you can modify it as you wish to make it better.
Enjoy !
Installation
Via composer :
$ composer require debuss-a/mtomsoapclient
Example
Use it the same as a normal Soap call :
$client = new MTOMSoapClient($webservice, array( 'trace' => true, 'exceptions' => true, 'soap_version' => SOAP_1_1, 'encoding' => 'utf-8' )); $result = $client->__call( $method, $parameters ); if (!$result instanceof stdClass) { throw new Exception('Soap call response is not a valid stdClass instance.'); } var_dump($result->path->to->my->data);
Explanation
It will turn this answer (normal Soap Response, MTOM is not parsed by Soap) :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:generateLabelResponse xmlns:ns2="http://sls.ws.webservice.fr"> <return> <messages> <id>0</id> <messageContent>La requete a ete traitee avec succes</messageContent> <type>INFOS</type> </messages> <labelResponse> <label> <xop:Include href="cid:983c41d7-d699-4373-b8da-4815099ef250-3880@cxf.apache.org" xmlns:xop="http://www.w3.org/2004/08/xop/include"/> </label> <parcelNumber>6A11353659111</parcelNumber> </labelResponse> </return> </ns2:generateLabelResponse> </soap:Body> </soap:Envelope>
To this (MTOMSoap Response, tags are replaced by there base64 values) :
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> <soap:Body> <ns2:generateLabelResponse xmlns:ns2="http://sls.ws.webservice.fr"> <return> <messages> <id>0</id> <messageContent>La requete a ete traitee avec succes</messageContent> <type>INFOS</type> </messages> <labelResponse> <label>EENUfn5DRCx+Q0NefkNUfg0KXlhBDQpeUF[... ZPL code shortened for the sake of this Readme.md ...]</label> <parcelNumber>6A12097564594</parcelNumber> </labelResponse> </return> </ns2:generateLabelResponse> </soap:Body> </soap:Envelope>
A var_dump() of _$result = $client->__call($url, $params) will look like this (Note : SoapClient auto base64_decode()) :
object(stdClass)[2] public 'return' => object(stdClass)[3] public 'messages' => object(stdClass)[4] public 'id' => string '0' (length=1) public 'messageContent' => string 'La requete a ete traitee avec succes' (length=41) public 'type' => string 'INFOS' (length=5) public 'labelResponse' => object(stdClass)[5] public 'label' => string '�CT~~CD,~CC^~CT~ ^XA ^PW799 ^FO0,0^GFA,11264,11264,00088,:Z64: eJzt2UFv2zYUAGByKqIW8MKrD4bUnnbVsEsGuGH+wf[... ZPL code shortened for the sake of this Readme.md ...]' (length=5856) public 'parcelNumber' => string '6A12097564600' (length=13)
debuss-a/mtomsoapclient 适用场景与选型建议
debuss-a/mtomsoapclient 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 172.66k 次下载、GitHub Stars 达 34, 最近一次更新时间为 2016 年 10 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「soap」 「soapclient」 「mtom」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 debuss-a/mtomsoapclient 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 debuss-a/mtomsoapclient 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 debuss-a/mtomsoapclient 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Simple, async SOAP webservice client library, built on top of ReactPHP
Wrapper around PHP SoapClient class
cURL and cURL based Soap-Client for PHP
A PHP client for the Salesforce SOAP API
PHP SoapClient wrapper class
platform connector generator for Webservices.nl
统计信息
- 总下载量: 172.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 35
- 点击次数: 29
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2016-10-31