0

wsdl2php を使用して PHP で Web サービスを操作しようとしていますが、うまくいきません。生成された Web サービスのクライアント コードと結果は次のとおりです。

class CreateProfile {

  public $firstname;
  public $email;
  public $lastname;
  public $mobile;
  public $password;
  public $provider;
  public $uniqueID;
  public $username;
}

class CreateProfileResponse {

  public $CreateProfileResult;
}

class Profile_WebService extends SoapClient {

  private static $classmap = array(

  'CreateProfile' => 'CreateProfile',
  'CreateProfileResponse' => 'CreateProfileResponse',
);

public function Profile_WebService($wsdl = "http://domain/wcfservice/Profile.WebService.asmx?WSDL", $options = array()) {
foreach(self::$classmap as $key => $value) {
  if(!isset($options['classmap'][$key])) {
    $options['classmap'][$key] = $value;
  }
}
parent::__construct($wsdl, $options);
}


public function CreateProfile(CreateProfile $parameters) {
  return $this->__soapCall('CreateProfile', array($parameters),       array(
          'uri' => 'http://domain/',
          'soapaction' => ''
         )
     );
  }

}

私はそれを次のように使いたい:

$client = new Profile_WebService();
$client->CreateProfile(array('provider' => 'ENERGIZER','username' => 'ENGtest1','password' => '1369','uniqueId' => '102030405062'));

しかし、それは言い続けます:

PHP Catchable fatal error:  Argument 1 passed to Profile_WebService::CreateProfile() must be an instance of CreateProfile, array given, called.

教えていただけますか?

4

3 に答える 3

0

CreateProfile()type の関数 1 パラメーターで期待するように PHP に指示していますCreateProfile

しかし、この行$client->CreateProfile(array('provider' => 'ENERGIZER','username' => 'ENGtest1','password' => '1369','uniqueId' => '102030405062'));では、配列型の変数を渡しています。

object次のように、その配列を type に型キャストする必要があります。

$client->CreateProfile((object) array('provider' => 'ENERGIZER','username' => 'ENGtest1','password' => '1369','uniqueId' => '102030405062'));
于 2013-01-26T09:03:38.517 に答える