承接 raigu/x-road-soap-envelope-builder 相关项目开发

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

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

raigu/x-road-soap-envelope-builder

最新稳定版本:v2.0.1

Composer 安装命令:

composer require raigu/x-road-soap-envelope-builder

包简介

PHP library for generating X-Road SOAP envelope.

README 文档

README

Latest Stable Version License: MIT Build Status codecov Scrutinizer

x-road-soap-envelope-builder

PHP library for generating a SOAP envelope for X-Road request.

Requirements

  • php ^8.0
  • DOM extension

(For PHP ^PHP7.2 use version 1.1.1)

Installation

$ composer require raigu/x-road-soap-envelope-builder

Usage

Building SOAP envelope for X-Road request

$builder = \Raigu\XRoad\SoapEnvelope\SoapEnvelopeBuilder::create()
    ->withService('EE/GOV/70008440/rr/RR437/v1')
    ->withClient('EE/COM/12213008/gathering')
    ->withBody(<<<EOD
        <prod:RR437 xmlns:prod="http://rr.x-road.eu/producer">
            <request>
                <Isikukood>00000000000</Isikukood>
            </request>
        </prod:RR437>
EOD;
    );

$envelope = $builder->build();

echo $envelope;

The method's withBody input parameter can be generated from WSDL using free tools like WSDL Analyzer or SOAP UI. The WSDL-s can be found in X-Road catalog.

See short (1:34) demo video how to acquire WSDL and generate a request body.

Builder methods

Method name Mandatory Description
withService Y service id.
Format: {xRoadInstance}/{memberClass}/{memberCode}/(subsystemCode}/{serviceCode}/{serviceVersion}
withClient Y client id.
Format: {xRoadInstance}/{memberClass}/{memberCode}/(subsystemCode}
withBody Y X-Road service request witch is but into the X-Road message body. See short video how you can find the WSDL based on service id and generate body from WSDL. If you use SoapUI make sure you do not miss the XML proper namespace definition.
withUserId N natural person code who is initiating the request. Format: {isoCountryCode2Alfa}/{personCode}. Optional.
withRepresentedParty N Party who is represented by client. See X-Road Third Party Representation Extension for more info.
Format: [{partyClass}/]{partyCode}. Optional.

Making X-Road request

In following samples assign your X-Road security server URL to $securityServerUrl.

Using Guzzle

$client = new \Guzzle\Http\Client();
$request = $client->post(
    $securityServerUrl,
    [ 
        'Content-Type' => 'text/xml',
        'SOAPAction' => ''
    ],
    $envelope
);

$response = $client->send($request);

echo $response->getBody();

Using curl

$ch = curl_init();

curl_setopt($ch, CURLOPT_URL, $securityServerUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $envelope);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Content-Type' => 'text/xml',
        'SOAPAction' => ''
    ]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

$output = curl_exec($ch);

curl_close($ch);

echo $output;

References

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-04-25

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固