[英]How to make a PHP SOAP call using the SoapClient class
我习惯于编写 PHP 代码,但不经常使用面向对象的编码。 我现在需要与 SOAP(作为客户端)交互,但无法正确使用语法。 我有一个 WSDL 文件,它允许我使用 SoapClient 类正确设置新连接。 但是,我实际上无法进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL 文档中定义了两个函数,但我只需要一个(下面的“FirstFunction”)。 这是我运行的脚本以获取有关可用函数和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我想用数据调用 FirstFunction:
什么是正确的语法? 我一直在尝试各种选择,但看起来肥皂结构非常灵活,所以有很多方法可以做到这一点。 说明书上也查不出来。。。
更新 1:尝试来自 MMK 的样本:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但我得到了这样的回应: Object has no 'Contact' property
。 正如您在getTypes()
的输出中看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式明确我的参数包括 Contact 数据,但问题是:如何?
更新 2:我也试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下的错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
我习惯于编写PHP代码,但并不经常使用面向对象的编码。 现在,我需要与SOAP(作为客户端)进行交互,并且无法正确获取语法。 我有一个WSDL文件,该文件允许我使用SoapClient类正确设置新连接。 但是,我无法真正进行正确的调用并返回数据。 我需要发送以下(简化的)数据:
WSDL文档中定义了两个函数,但是我只需要一个(下面的“ FirstFunction”)。 这是我运行的脚本,以获取有关可用功能和类型的信息:
$client = new SoapClient("http://example.com/webservices?wsdl");
var_dump($client->__getFunctions());
var_dump($client->__getTypes());
这是它生成的输出:
array(
[0] => "FirstFunction Function1(FirstFunction $parameters)",
[1] => "SecondFunction Function2(SecondFunction $parameters)",
);
array(
[0] => struct Contact {
id id;
name name;
}
[1] => string "string description"
[2] => string "int amount"
}
假设我要使用数据调用FirstFunction:
正确的语法是什么? 我一直在尝试各种各样的选项,但肥皂结构似乎非常灵活,因此有很多方法可以做到这一点。 也无法从手册中找出答案...
更新1:尝试从MMK的示例:
$client = new SoapClient("http://example.com/webservices?wsdl");
$params = array(
"id" => 100,
"name" => "John",
"description" => "Barrel of Oil",
"amount" => 500,
);
$response = $client->__soapCall("Function1", array($params));
但是我得到这样的答复: Object has no 'Contact' property
。 如您在getTypes()
的输出中所看到的,有一个名为Contact
的struct
,所以我想我需要以某种方式弄清楚我的参数包括Contact数据,但是问题是:如何?
更新2:我也尝试过这些结构,同样的错误。
$params = array(
array(
"id" => 100,
"name" => "John",
),
"Barrel of Oil",
500,
);
也:
$params = array(
"Contact" => array(
"id" => 100,
"name" => "John",
),
"description" => "Barrel of Oil",
"amount" => 500,
);
两种情况下均出现错误:对象没有“联系人”属性
下面的代码可能会有所帮助
$wsdl ='My_WSDL_Service.wsdl";
$options = array(
'login' => 'user-name',
'password' => 'Password',
);
try {
$client = new SoapClient($wsdl, $options);
$params = array(
'para1' => $para1,
'para2' => $para2
);
$res = $client->My_WSDL_Service($params);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.