【问题标题】:PHP SOAP with parameters ConnectedSoapFault exception: [a:DeserializationFailed]带有参数的 PHP SOAP ConnectedSoapFault 异常:[a:DeserializationFailed]
【发布时间】:2017-05-27 19:50:00
【问题描述】:

我的朋友们,我想知道我在代码中做错了什么,它继续给出反序列化错误。当我正确设置所有参数时,它会显示一个类错误(stdClass)。这是 SOAP UI 和 PHP 代码中的 wsdl 打印。我在评论中留下了我已经尝试过的选项。

<pre>
 $soapParams = array('login' => 'master',
                  'password' => 'master',
            'authentication' => SOAP_AUTHENTICATION_BASIC,
                     'trace' => 1,
                 'exceptions' => 0 );

$client = new SoapClient("http://189.60.63.128:8061/wsDataServe/MEX?wsdl",$soapParams); 

//$result = $client->__soapCall("ReadView",$params);
//$result = $client->__soapCall("ReadView",array('DataServerName' => 'EduAlunoData', 'Filtro'=>'?', 'Contexto'=>'?'));
//$result=$client->__call("ReadView", ['ReadView' => ['DataServerName' => 'EduAlunoData', 'Filtro' => '1=1','Contexto'=>'?']]);

$result=$client->__soapCall("ReadView", ['DataServerName' => "EduAlunoData", 'Filtro' => '1=1','Contexto'=>'?']);
print $result;
</pre>

Image of the WSDL from SOAP UI

【问题讨论】:

  • 这是错误:ConnectedSoapFault 异常:[a:DeserializationFailed] 格式化程序在尝试反序列化消息时抛出异常:反序列化操作“ReadView”的请求消息正文时出错。应来自命名空间“schemas.xmlsoap.org/soap/envelope”的结束元素“正文”。从命名空间“”中找到元素“param1”。第 2 行,位置 151。在 C:\xampp\htdocs\soap\soap.php:79 堆栈跟踪:#0 C:\xampp\htdocs\soap\soap.php(79): SoapClient->__soapCall('ReadView' , 数组) #1 {main}
  • 这是正确的代码:$result = $client->ReadView($params);我用过 var_dump($client->__getTypes());用于了解结构“struct ReadView { string DataServerName; string Filtro; string Contexto; }”

标签: php web-services soap wsdl soap-client


【解决方案1】:

我解决了问题:

<?php

$soapParams = array('login' => 'master',
'password' => 'master',
'authentication' => SOAP_AUTHENTICATION_BASIC,
'trace' => 1,
'exceptions' => 0
);

$params = array();
$client = new SoapClient("http://200.30.20.120:8051/wsDataServer/MEX?wsdl", $soapParams); 
echo "Connected"; 

$params = array('DataServerName' => 'EduAlunoData', 'Filtro'=>'1=1', 'Contexto'=>'?');
var_dump($params);

$result = $client->ReadView($params);
echo "Response:\n" . $client->__getLastResponse() . "<br><br>";

//echo "<br>";
//echo "REQUEST:\n" . $client->__getLastRequest() . "<br><br>";
//echo "REQUEST HEADERS:\n" . $client->__getLastRequestHeaders() . "<br><br>";
//echo "RESPONSE HEADERS:\n" . $client->__getLastResponseHeaders() . "<br><br>";
//var_dump($client->__getTypes());
//var_dump($client->__getFunctions());


//print $result;


?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-30
    • 2018-08-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多