alexander-bogomolov
3/22/2014 - 7:10 AM

SOAP Service mit einem SOAP Client in PHP nutzen - http://www.starstormdesign.de/soap-service-mit-einem-soap-client-php-nutzen/

SOAP Service mit einem SOAP Client in PHP nutzen - http://www.starstormdesign.de/soap-service-mit-einem-soap-client-php-nutzen/

<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.*"
}