非常に初歩的な質問なのですが、
SOAP APIにPHPで接続することができず困っています。
SOAPのサーバの仕様によって違うのでは?
と思いつつ、何か勘違いをしている可能性を感じ、ヒントをいただけると大変助かります。
以下、コードになります。
php
1<?php 2$client = new SoapClient('https://hogehoge.co.jp/V1/API.svc?wsdl'); 3$client->__setLocation('https://hogehoge.co.jp/V1/API.svc'); 4 5 6$api_key = new SoapHeader('API_KEY','xxxxxxxxxxxxxxxxxx'); 7$api_token = new SoapHeader('API_TOKEN', 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'); 8 9$client->__setSoapHeaders($api_key); 10$client->__setSoapHeaders($api_token); 11 12class GetLeadList extends SoapParam 13{ 14 public $Id; 15 public $StartDate; 16 public $EndDate; 17} 18 19$params = new stdClass(); 20$params->DealershipId = 1; 21$params->StartDate = '2020-09-10T00:00:00Z'; 22$params->EndDate = '2020-09-10T00:00:00Z'; 23 24try { 25 $client->GetLeadList(new GetLeadList()); 26} catch (Exception $e) { 27 var_dump($e); 28}
すると、以下のようなエラーが出てきます。
object(SoapFault)#5 (9) { ["message":protected]=> string(429) "The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs." ["string":"Exception":private]=> string(0) "" ["code":protected]=> int(0) ["file":protected]=> string(25) "/home/tterashima/soap.php" ["line":protected]=> int(27) ["trace":"Exception":private]=> array(1) { [0]=> array(5) { ["file"]=> string(25) "/home/tterashima/soap.php" ["line"]=> int(27) ["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" ["type"]=> string(2) "->" } } ["previous":"Exception":private]=> NULL ["faultstring"]=> string(429) "The server was unable to process the request due to an internal error. For more information about the error, either turn on IncludeExceptionDetailInFaults (either from ServiceBehaviorAttribute or from the <serviceDebug> configuration behavior) on the server in order to send the exception information back to the client, or turn on tracing as per the Microsoft .NET Framework SDK documentation and inspect the server trace logs." ["faultcode"]=> string(22) "a:InternalServiceFault" }
一応、関数リストに関しては以下のように取得できることを確認できています。
array(2) { [0]=> string(44) "GetLeadResponse GetLead(GetLead $parameters)" [1]=> string(56) "GetLeadListResponse GetLeadList(GetLeadList $parameters)" }
以上、よろしくお願いいたします。
あなたの回答
tips
プレビュー