【发布时间】:2014-03-18 13:31:14
【问题描述】:
在我的 PHP 应用程序中提交表单后,我将一些值存储在这样的数组中
if(isset($_POST['submitArticle']))
{
$artikel = $_POST['article'];
$aantal = $_POST['quantity'];
$a=0;
$art = array();
$quan = array();
foreach($artikel as $key => $value)
{
$art[] = $artikel[$a];
$quan[] = $aantal[$a];
$a++;
}
$artikelArguments = array_combine($art, $quan);
现在我在我的 C# 应用程序中调用一个方法,并将我的新数组作为参数:
$client->getArticle($artikelArguments);
我在 C# 中的方法如下所示:
public List<string> getArticle(List<KeyValuePair<int, int>> articles)
{
//Get articles based on ID
foreach (KeyValuePair<int, int> art in articles)
{
现在文章总是为空,所以值不会被传递,或者 C# 无法处理我的 PHP 数组。有人有什么建议吗?
Fatal error: Uncaught SoapFault exception: [a:InternalServiceFault]
【问题讨论】:
-
也许它无法将其转换为
List<KeyValuePair<int, int>>,我将首先将其更改为object,并确保您的c#方法被调用。 -
我一开始使用对象,因为 PHP 返回糟糕的变量,但我的 WCF 服务无法处理。
-
WSDL的getArticle操作看起来如何?你能发布wsdl:operation标签包含吗? -
你是这个意思?