Created
March 22, 2014 07:10
-
-
Save bogomolov-dev/9702508 to your computer and use it in GitHub Desktop.
SOAP Service mit einem SOAP Client in PHP nutzen - http://www.starstormdesign.de/soap-service-mit-einem-soap-client-php-nutzen/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"require": { | |
[...] | |
"besimple/soap": "0.2.*" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<xsd:complexType name="getBankType"> | |
<xsd:sequence> | |
<xsd:element name="blz" type="xsd:string"/> | |
</xsd:sequence> | |
</xsd:complexType> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
array (size=2) | |
0 => string 'getBankResponseType getBank(getBankType $parameters)' (length=52) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Ssd\SoapExample; | |
class GetBankResponseType | |
{ | |
/** | |
* @var \Ssd\SoapExample\DetailsType | |
*/ | |
protected $details; | |
// Getter und Setter | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment