承接 vaclavvanik/soap-binding 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

vaclavvanik/soap-binding

最新稳定版本:0.3.0

Composer 安装命令:

composer require vaclavvanik/soap-binding

包简介

Binding SOAP messages to PSR-7 HTTP messages

README 文档

README

This package provides binding SOAP messages to PSR-7 HTTP messages. The main purpose of this library is to use it together with PSR-18 HTTP Client.

Install

You can install this package via composer.

composer require vaclavvanik/soap-binding

This package needs PSR-17 HTTP Factories implementation. You can use e.g. Laminas Diactoros.

composer require vaclavvanik/soap-binding laminas/laminas-diactoros

Usage

Binding::request() embeds SOAP request messages into PSR-7 HTTP requests.

<?php

declare(strict_types=1);

use Laminas\Diactoros\RequestFactory;
use Laminas\Diactoros\Request\Serializer;
use Laminas\Diactoros\StreamFactory;
use VaclavVanik\Soap\Binding\InterpreterBinding;
use VaclavVanik\Soap\Binding\PsrRequestFactory;
use VaclavVanik\Soap\Interpreter\PhpInterpreter;

$factory = new PsrRequestFactory(new RequestFactory(), new StreamFactory());
$interpreter = PhpInterpreter::fromWsdl('http://www.dneonline.com/calculator.asmx?wsdl');

$httpBinding = new InterpreterBinding($interpreter, $factory);
$psrRequest = $httpBinding->request('Add', ['Add' => ['intA' => 1, 'intB' => 3]]);

echo Serializer::toString($psrRequest);

Output:

POST /calculator.asmx HTTP/1.1
SOAPAction: http://tempuri.org/Add
Content-Type: text/xml; charset="utf-8"
Host: www.dneonline.com

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://tempuri.org/">
    <SOAP-ENV:Body>
        <ns1:Add>
            <ns1:intA>1</ns1:intA>
            <ns1:intB>3</ns1:intB>
        </ns1:Add>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Binding::response() embeds PSR-7 HTTP response into SOAP response object.

Send $psrRequest created above with any PSR HTTP Client and get SOAP response.

<?php
//$psrResponse = $client->sendRequest($psrRequest);

$result = $httpBinding->response('Add', $psrResponse);

print_r($result->getResult());

Output:

stdClass Object
(
    [AddResult] => 4
)

Exceptions

Run check - coding standards and php-unit

Install dependencies:

make install

Run check:

make check

Changelog

Please see CHANGELOG for more information what has changed recently.

License

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

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-12-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固