PHP / SOAP-Nusoap服务器无响应

时间:2019-11-17 10:07:03

标签: php soap nusoap

我已经使用Nusoap PHP库创建了一个SOAP Web服务。这是服务器代码:

<?php
require_once('nusoap/lib/nusoap.php');
$server = new nusoap_server();
$nameSpace="Name_WEB_Service";
$endpoint = "https://hotsname.com/api.php";
$server->configureWSDL('Name_WSDL', 'urn:'.$nameSpace, $endpoint);
$server->register('getValue',
    array   (
                'x' => 'xsd:string'
            ),  //parameters
    array   (
                'y' => 'xsd:string',
            ),  //output
    'urn:'.$nameSpace,   //namespace
    'urn:'.$nameSpace.'#getValue' //soapaction
    );
$server->service(file_get_contents('php://input'));
exit(); 

要对其进行测试并检查是否一切正常,我正在使用SOAPUI。服务器正在返回带有以下raw的空响应:

HTTP/1.0 500 Internal Server Error
Date: Sun, 17 Nov 2019 09:46:48 GMT
Server: Apache/2.4.6 (Red Hat Enterprise Linux) mod_auth_kerb/5.4 PHP/7.3.10
X-Powered-By: PHP/7.3.10
Content-Length: 0
Connection: close
Content-Type: text/html; charset=UTF-8

问题与 file_get_contents('php:// input')引起,当我将空字符串传递给$ server-> service函数时,服务器返回以下消息:

<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"/>
<faultstring xsi:type="xsd:string">error in msg parsing:xml was empty, didn't parse!</faultstring>
<detail xsi:type="xsd:string"/>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

有什么想法吗?

谢谢。

0 个答案:

没有答案
相关问题