PHP Akamai SOAP 异常
我正在发出 SOAP 请求,它成功返回您可以调用的函数列表。
我正在调用 PurgeRequest 方法并收到以下错误
异常:类 com.idoox.soap.DemarshallException:输入架构 与 SOAP 消息中的类型不同 - 预期 字符串@http://www.w3.org/1999/XMLSchema;得到 地图@http://xml.apache.org/xml-soap"
我尝试使用 SOAP UI 并获得成功的响应 id。但是,我的 PHP 请求失败了..有人可以告诉我这个错误是关于什么的以及如何解决吗?解决这个问题。一位参考文献说这是因为传递了空数组,但我确信该参数不为空。
if(class_exists('SoapClient'))
{
$client = new SoapClient('https://ccuapi.akamai.com/ccuapi.wsdl',
array(
'trace' => 1,
'exceptions' => 0,
'features' => SOAP_USE_XSI_ARRAY_TYPE
)
);
echo '<pre>';
var_dump($client->__getFunctions());
try {
$purgeResult = $client->purgeRequest($username,$password,'',$opt,$url);
}
catch(SoapFault $e){
echo "Exception\n";
}
echo '<pre>';
var_dump($purgeResult);
}
I am making a SOAP request and it successfully return the function list which you can call.
I am calling PurgeRequest method and receiving following error
Exception: class com.idoox.soap.DemarshallException: Type in schema
differs from type in SOAP message - expected
string@http://www.w3.org/1999/XMLSchema; got
Map@http://xml.apache.org/xml-soap"
I tried with SOAP UI and get the successful response id. But, my PHP request is failing..Can some one tell me what this error is about and how to resolve this. one reference say it is because of passing the empty array but I am sure that parameter is not empty.
if(class_exists('SoapClient'))
{
$client = new SoapClient('https://ccuapi.akamai.com/ccuapi.wsdl',
array(
'trace' => 1,
'exceptions' => 0,
'features' => SOAP_USE_XSI_ARRAY_TYPE
)
);
echo '<pre>';
var_dump($client->__getFunctions());
try {
$purgeResult = $client->purgeRequest($username,$password,'',$opt,$url);
}
catch(SoapFault $e){
echo "Exception\n";
}
echo '<pre>';
var_dump($purgeResult);
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
它对我有用,但我没有登录(当然)。我得到正常的 SOAP 异常:
当我在 $opt 中传递空字符串时,或者
当我在 $opt 和 $url 中传递空数组时。
无论如何,您的问题似乎是由于不同的 SOAP xsd 标头造成的。该服务需要 http://www.w3.org/1999/XMLSchema 标头,您的脚本似乎正在传递http://xml.apache.org/xml-soap。
服务 WSDL 定义了它:
您需要确保您的客户端尊重这一点并正确设置它。
请发布您的输出
(紧接在 之后
)
我的看起来像这样:
看,此请求具有 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
另外请确保您使用正确的 SOAP 版本
,并且 SOAP 扩展中的 __doRequest() 方法未被覆盖发送自定义标头,例如 此处。
It works for me, but I'm not logging in (of course). I get normal SOAP exceptions:
when I pass an empty string in $opt, or
when I pass empty arrays in $opt and $url.
Anyway, your issue seems to be due to different SOAP xsd headers. The service expects http://www.w3.org/1999/XMLSchema header, your script seems to be passing http://xml.apache.org/xml-soap.
Service WSDL defines it:
You need to make sure your client respects this and sets it properly.
Please post output of your
(right after
)
mine looks like this:
see, this request features xmlns:xsd="http://www.w3.org/2001/XMLSchema"
Also make sure you are using right SOAP version
and your __doRequest() method in SOAP extension is not overriden to send custom headers, like here.