PHP肥皂呼叫和响应

时间:2016-05-18 16:20:09

标签: php soap soap-client

我正在打肥皂:

$client = new SoapClient('http://test.com/collect/test.wsdl');

然后我使用:

var_dump($client->__getTypes()); 

返回以下内容:

2array(43) {
  [0]=>
  string(52) "struct ProcessBrokerLead {
 BrokerRequest request;
}"
  [1]=>
  string(77) "struct ProcessBrokerLeadResponse {
 BrokerResponse ProcessBrokerLeadResult;
}"
  [2]=>
  string(8) "int char"
  [3]=>
  string(17) "duration duration"
  [4]=>
  string(11) "string guid"
  [5]=>
  string(118) "struct BrokerRequest {
 ExternalReference ExternalReference;
 LoanRequest LoanRequest;
 ArrayOfApplicant Applicants;
}"
  [6]=>
  string(249) "struct ExternalReference {
 string IntroducerReference;
 string SubAffiliate;
 string Campaign;
 string ApplicationReference;
 boolean IsSpeculative;
 boolean IsInteractive;
 boolean HasConsentedToCreditSearch;
 boolean HasConsentedForDataSharing;
}"
  [7]=>
  string(211) "struct LoanRequest {
 decimal LoanAmount;
 int LoanTerm;
 InstalmentType PaymentFrequency;
 boolean IsSecured;
 Purpose Purpose;
 ArrayOfSecurity Securities;
 DayOfWeek RepaymentDay;
 decimal InstalmentAmount;

如何访问此数据

我试过了

$res = $client->ProcessBrokerLead();
print_r($res);

我只是继续犯错误,我对SOAP很新,我真的可以使用一些帮助

1 个答案:

答案 0 :(得分:0)

从该输出中获取的ProcessBrokerLead是数据类型,而不是方法调用或操作。

要找出您可以执行的操作,您可以使用:

var_dump($client->__getFunctions());

输出将告诉您响应数据类型以及每个操作需要使用的参数数据类型。

然后使用var_dump($client->__getTypes());获取有关每种数据类型的详细信息。

struct视为与class具有相同意义的事情会有所帮助。例如,您拥有名为ProcessBrokerLead的此数据结构(类),并且该结构内部是名为request的属性。 request本身就是另一个名为BrokerRequest的数据结构。