json PHP服务中的SOAP服务在PHP中的SOAP客户端 - http://www.starstormdesign.de/soap-service-mit-einem-soap-client- Posted 2021-05-19
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了json PHP服务中的SOAP服务在PHP中的SOAP客户端 - http://www.starstormdesign.de/soap-service-mit-einem-soap-client-相关的知识,希望对你有一定的参考价值。
<xsd:complexType name="getBankResponseType">
<xsd:sequence>
<xsd:element name="details" type="tns:detailsType"/>
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="detailsType">
<xsd:sequence>
<xsd:element minOccurs="0" name="bezeichnung" type="xsd:string"/>
<xsd:element minOccurs="0" name="bic" type="xsd:string"/>
<xsd:element minOccurs="0" name="ort" type="xsd:string"/>
<xsd:element minOccurs="0" name="plz" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
<?php
namespace Ssd\SoapExample;
class GetBankResponseType
{
/**
* @var \Ssd\SoapExample\DetailsType
*/
protected $details;
// Getter und Setter
}
<?php
namespace Ssd\SoapExample;
class DetailsType
{
/**
* @var string
*/
protected $bezeichnung;
/**
* @var string
*/
protected $bic;
/**
* @var string
*/
protected $ort;
/**
* @var string
*/
protected $plz;
// Getter und Setter
public function getGoogleSearchLink()
{
return 'http://google.de/q=' . urlencode($this->bezeichnung);
}
}
<?php
require_once '../../vendor/autoload.php';
require_once 'GetBankResponseType.php';
require_once 'DetailsType.php';
$wsdl = 'http://www.thomas-bayer.com/axis2/services/BLZService?wsdl';
$options = array(
'classmap' => array(
'getBankResponseType' => 'Ssd\\SoapExample\\GetBankResponseType',
'detailsType' => 'Ssd\\SoapExample\\DetailsType',
),
);
$soapClient = new \BeSimple\SoapClient\SoapClient($wsdl, $options);
object(Ssd\SoapExample\GetBankResponseType)[7]
protected 'details' =>
object(Ssd\SoapExample\DetailsType)[6]
protected 'bezeichnung' => string 'Hamburger Bank von 1861 Volksbank' (length=33)
protected 'bic' => string 'GENODEF1HH2' (length=11)
protected 'ort' => string 'Hamburg' (length=7)
protected 'plz' => string '20019' (length=5)
<?php
require_once '../../vendor/autoload.php';
$wsdl = 'http://www.thomas-bayer.com/axis2/services/BLZService?wsdl';
$soapClient = new \BeSimple\SoapClient\SoapClient($wsdl);
var_dump($soapClient->__getFunctions());
array (size=2)
0 => string 'getBankResponseType getBank(getBankType $parameters)' (length=52)
<?php
require_once '../../vendor/autoload.php';
$wsdl = 'http://www.thomas-bayer.com/axis2/services/BLZService?wsdl';
$soapClient = new \BeSimple\SoapClient\SoapClient($wsdl);
$bank = new stdClass();
$bank->blz = '20190003';
var_dump($soapClient->getBank($bank));
<xsd:complexType name="getBankType">
<xsd:sequence>
<xsd:element name="blz" type="xsd:string"/>
</xsd:sequence>
</xsd:complexType>
object(stdClass)[7]
public 'details' =>
object(stdClass)[6]
public 'bezeichnung' => string 'Hamburger Bank von 1861 Volksbank' (length=33)
public 'bic' => string 'GENODEF1HH2' (length=11)
public 'ort' => string 'Hamburg' (length=7)
public 'plz' => string '20019' (length=5)
"require": {
[...]
"besimple/soap": "0.2.*"
}
以上是关于json PHP服务中的SOAP服务在PHP中的SOAP客户端 - http://www.starstormdesign.de/soap-service-mit-einem-soap-client-的主要内容,如果未能解决你的问题,请参考以下文章
需要了解PHP中的SOAP 1.2 Web服务数据调用/发送
PHP Soap 服务器响应格式
python 有没有php里面的soapclient这样的东西
初识php soap 学习过程中的摘抄,便于后期翻阅
在PHP中解析XML SOAP响应
php SOAP 响应编码问题