定制 tbpixel/soap-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tbpixel/soap-client

Composer 安装命令:

composer require tbpixel/soap-client

包简介

A WSDL supported SOAP client.

README 文档

README

A WSDL supported SOAP client built on top of PSR-7 and PSR-18.

Content

Installation

Note that this package is still in-development and is subject to breaking changes.

You can install this package via composer:

composer require tbpixel/soap-client

NOTE: Version 0.2.0 pulled in Guzzle as the HTTP client of choice. Starting at 0.3.0, the soap-client only relies on PSR-18. If you'd still like the convenience of using Guzzle without PSR-18 I'd recommend pulling version 0.2.0 with composer require tbpixel/soap-client:^0.2.0.

Rational

If you (like me) have to work with SOAP in 2019, you may find yourself in a tight spot when working with aggregate soap actions. If a particular soap action provides a lot of data, then not only will PHP's built-in soap client load the entire string response into memory but it will also instantiate a massive array of stdClass objects based on the response.

The above consumes a great deal of memory resources and can make it even more of a headache to deal with SOAP than it already is. This package aims to help with that by providing a PHP Soap Client built on top of PSR-18.

This, combined with another package I'm developing called XML Streamer, allows for some greatly improved memory management when working with soap API's.

Examples

If you just want to get started quickly, the ClientFactory class will do most of the heavy lifting.

use TBPixel\SoapClient\ClientFactory;

// @var \Psr\Http\Client\ClientInterface $http
$client = ClientFactory::new($http, 'http://example.com/service.wsdl');

// $response is a \Psr\Http\Message\StreamInterface
$response = $client->call('MyAction', [
    'foo' => 'bar',
]);

Creating your own handler

By inspecting the ClientFactory class, you'll notice it does a lot of setup that gets quite tedious. The following steps are taken:

  1. A soap client is created. This is used to get available wsdl functions and types, as well as to throw an exception when an invalid WSDL file is parsed.
  2. A soap request formatter is created; this is what turns your action and body into a WSDL compatible soap request string.
  3. A PSR-18 compatible handler is created.
  4. A new Client is created and returned.

That's quite a lot of boilerplate. This is because it allows package internals to be extended and changed quickly while limiting the impact of package integrations.

Thankfully creating a client is easy. The TBPixel\SoapClient\Handler interface is ultimately what is passed to the client for handling requests. If PSR-18 doesn't suit your needs, you can just build your own client that implements the interface and pass it in instead!

Contributing

Please see CONTRIBUTING for details.

Changelog

Please see CHANGELOG for more information on what has changed recently.

Support Me

Hi! I'm a developer living in Vancouver, BC and boy is the housing market tough. If you wanna support me, consider following me on Twitter @TBPixel, or consider buying me a coffee.

License

The MIT License (MIT). Please see License File for more information.

tbpixel/soap-client 适用场景与选型建议

tbpixel/soap-client 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 80 次下载、GitHub Stars 达 0, 最近一次更新时间为 2019 年 03 月 04 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 tbpixel/soap-client 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tbpixel/soap-client 我们能提供哪些服务?
定制开发 / 二次开发

基于 tbpixel/soap-client 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 80
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 5
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-03-04