PHP SoapFault 在soapUI 中不符合WSDL 架构?
我今天遇到了一个奇怪的问题,它是这样的:
我正在设置测试套件来对我的 Web 服务进行质量检查,这是 用 PHP5 编写 - 使用 SoapFault 类等。
我使用该类向客户端返回错误消息。示例:
if (!$this->CheckHost(getenv('REMOTE_ADDR')))
{
return new SoapFault(S_CLIENT, S_STRING_IP, "", S_DETAIL_IP);
}
如果客户端未经授权,则返回 SoapFault...
现在,如果我在 soapUI 3.0 中添加架构合规性断言。 1 它告诉 我发现返回的消息不符合它的 wsdl 文件。
WSDL 文件是我编写的,实际上不包含描述 实际 SoapFault 类的。需要这样吗?以为不是因为 无论如何,SoapFault 在 Soap 1.1 中已被指定。
实际响应如下所示:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>ERR_102</faultstring>
<faultactor/>
<detail>IP error message</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
soapUI 错误消息是:
仅包含元素的元素“详细信息” 内容类型不能有文本内容。
有人暗示我做错了什么吗?
蒂亚
K
I came across a strange one today, it goes like this:
I'm setting up test suites for QAing a web service of mine, which is
written in PHP5 - making use of the class SoapFault among others.
I use the class to return error message to the clients. Example:
if (!$this->CheckHost(getenv('REMOTE_ADDR')))
{
return new SoapFault(S_CLIENT, S_STRING_IP, "", S_DETAIL_IP);
}
Returning a SoapFault if the client is not authorized...
Now, if I add an Schema Compliance assertion in soapUI 3.0.1 it tells
me that the returned message is not compliant to it's wsdl file.
The WSDL-file is written by me and does in deed not contain a description
of the actual SoapFault class. Would that be needed? Thought not because
SoapFault is spezified in Soap 1.1 anyways.
The actual response looks like this:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Client</faultcode>
<faultstring>ERR_102</faultstring>
<faultactor/>
<detail>IP error message</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The soapUI error message is:
Element 'detail' with element-only
content type cannot have text content.
Does anyone have a hint what I'm doing wrong?
tia
K
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Soap 1.1 xml 架构 (http://schemas.xmlsoap.org/soap/envelope/) 将详细信息元素定义为
它不能仅包含文本(如您的错误所示)。尝试将响应更改为类似
希望这有帮助!
问候,
/奥莱
eviware.com
The soap 1.1 xml schema (http://schemas.xmlsoap.org/soap/envelope/) defines the detail element as
meaning that it can not contain just text as in your fault. Try changing the response to something like
Hope this helps!
regards,
/Ole
eviware.com