微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

总是得到“操作‘’未在此服务的 WSDL 中定义”作为 POSTMAN 中的响应

如何解决总是得到“操作‘’未在此服务的 WSDL 中定义”作为 POSTMAN 中的响应

我正在尝试从 POSTMAN 调用肥皂服务。每次我收到类似“此服务的 WSDL 中未定义操作”之类的响应时。

我使用的是 PHP 7.4.9 和 NUSoap 0.9.5。请帮我找出我做错了什么?提前致谢。

例如,我的服务如下

<?PHP
// Pull in the NuSOAP code
require_once('./lib/nusoap.0.9.5.bak.PHP');
// Create the server instance
$server = new soap_server();
// Initialize WSDL support
$server->configureWSDL('hellowsdl','urn:hellowsdl');
// Register the method to expose
$server->register('hello',// method name
    array('name' => 'xsd:string'),// input parameters
    array('return' => 'xsd:string'),// output parameters
    'urn:hellowsdl',// namespace
    'urn:hellowsdl#hello',// soapaction
    'rpc',// style
    'encoded',// use
    'Says hello to the caller'            // documentation
);
// Define the method as a PHP function
function hello($name) {
        return 'Hello,' . $name;
}
// Use the request to (try to) invoke the service
$HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
$server->service($HTTP_RAW_POST_DATA);
?>

我在邮递员中的请求如下: 方法:邮寄 网址:http://localhost:8080/nusoap/hellowsdl.PHP 请求:

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
                   xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
                   xmlns:si="http://soapinterop.org/xsd"
                   xmlns:tns="urn:hellowsdl">
    <SOAP-ENV:Body>
        <tns:hello xmlns:tns="urn:hellowsdl">
            <name xsi:type="xsd:string">Scott</name>
        </tns:hello>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

邮递员的回复

<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
  xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
    <SOAP-ENV:Body>
        <SOAP-ENV:Fault>
            <faultcode xsi:type="xsd:string">SOAP-ENV:Client</faultcode>
            <faultactor xsi:type="xsd:string"></faultactor>
            <faultstring xsi:type="xsd:string">Operation &apos;&apos; is not defined in the WSDL for this service</faultstring>
            <detail xsi:type="xsd:string"></detail>
        </SOAP-ENV:Fault>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。