Nusoap PHP 客户端 - 错误 500

Nusoap PHP Client - Error 500

您好,我正在尝试使用 NuSoap 通过 WSDL 文件获取一些数据。

wsdl 文件的路径和端点在示例下方。

到目前为止我有以下内容:

try {
                require_once('../includes/nusoap/lib/nusoap.php');

                $wsdl = 'https://service.stadt-zuerich.ch/jobs-ws/JobServiceV1/JobServiceV1.wsdl';
                $endpoint = 'https://service.stadt-zuerich.ch/jobs-ws/JobServiceV1';
                $username = "xxx";
                $password = "xxx";

                $client = new nusoap_client($wsdl,true);

                $client->setEndpoint($endpoint);
                $client->namespaces = array(
                    'SOAP-ENV'=>"http://schemas.xmlsoap.org/soap/envelope/",
                    'v1'=>"http://egov.stzh.ch/jobs/service/v1"
                );
                $client->setHTTPEncoding ($enc='gzip, deflate');
                $client->loadWSDL();
                $client->soap_defencoding = 'utf-8';

                $header = '<wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd">
                    <wsse:UsernameToken>
                        <wsse:Username>'.$username.'</wsse:Username>
                        <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-token-profile-1.0#PasswordText">'.$password.'</wsse:Password>
                    </wsse:UsernameToken>
                </wsse:Security>';

                $call = 'getJobs';
                $param = array();       
                $result = $client->call($call,$param,'','',$header);

                echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre>';
                echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre>';
                echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre>';

            } catch (SoapFault $e) {
                die($e->getMessage());
            }

问题是我在尝试获取数据时收到内部服务器错误 500。密码和用户名是正确的(尝试使用 SoapUI 应用程序,我得到了所有数据。)

对于用户名和密码,我尝试像上面的示例一样设置 SoapHeader,我也尝试了以下设置,但均无效。

$client->setCredentials($username,$password,'basic');

端点也应该是正确的,我得到与 SoapUI 应用相同的 header。我想不出任何其他问题或解决方案。

这是我的 Soap 请求:

<?xml version="1.0" encoding="utf-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:v1="http://egov.stzh.ch/jobs/service/v1"> <SOAP-ENV:Header> <wsse:Security SOAP-ENV:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wsswssecurity-secext-1.0.xsd"> <wsse:UsernameToken> <wsse:Username>xxx</wsse:Username> <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wssusername-token-profile-1.0#PasswordText">xxx</wsse:Password> </wsse:UsernameToken> </wsse:Security> </SOAP-ENV:Header> <SOAP-ENV:Body> <getJobs xmlns="http://egov.stzh.ch/jobs/service/v1"></getJobs> </SOAP-ENV:Body> </SOAP-ENV:Envelope>

这是我的 Soap 回复:

HTTP/1.1 500 Internal Server Error
Date: Mon, 02 May 2016 16:42:52 GMT
Server: Entry Server
Last-Modified: Wed, 20 Jan 2016 15:39:36 GMT
ETag: "9ed-f19-529c5cb14fe00"
Accept-Ranges: bytes
Content-Length: 3865
Content-Type: text/html
Set-CookieSCDID_S=Zp0F6_uw2M4ClToXcA9L4bu6oav0UeSztcleiUXqkuT8XUl2mDBu1w$$; path=/;     Secure
Connection: close

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="de" xml:lang="de">
<head>
<title>Stadt Z&uuml;rich: Interner Verarbeitungsfehler (Error 500)</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta http-equiv="cache-control" content="no-cache" />
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Expires" content="-1" />
</head>

有人知道我做错了什么吗?我很感激每一个帮助,因为我在这个问题上坐了几个小时。

非常感谢

您使用的 PHP 是什么版本?我认为 nusoap 不支持 PHP 7,当我尝试在 PHP 7.

的服务器上 运行 nusoap 时,我也遇到了 500 个错误