简体   繁体   English

Nusoap PHP客户端-错误500

[英]Nusoap PHP Client - Error 500

Hi i'm trying to get some data through a WSDL file using NuSoap. 嗨,我正在尝试使用NuSoap通过WSDL文件获取一些数据。

the path to the wsdl file and the endpoint are below in the example. 在示例中,wsdl文件的路径和端点在下面。

So far what I have is the following: 到目前为止,我所拥有的是:

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());
            }

The problem is that I'm getting an Internal Server Error 500 when trying to get the data. 问题是尝试获取数据时出现内部服务器错误500。 The Password and Username are correct (tried with the SoapUI App and there I'm getting all the data.) 密码和用户名正确(已与SoapUI App尝试过,在那里我可以获取所有数据。)

For the User and Password I tried to set a SoapHeader like in the example above and I also tried with the following, both not working. 对于用户名和密码,我尝试像上面的示例一样设置SoapHeader,并且还尝试了以下操作,但两者均不起作用。

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

The endpoint should also be correct and I get the same header as the SoapUI app. 端点也应该是正确的,并且我得到与SoapUI应用相同的标题。 I can't think of any other problems or solutions. 我想不出任何其他问题或解决方案。

This is my Soap request: 这是我的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>

and this one my Soap response: 这是我的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>

Does anyone has any idea what I'm doing wrong? 有人知道我在做什么错吗? I appreciate every help since I'm sitting for hours on that problem. 感谢您的帮助,因为我已经花了几个小时来解决这个问题。

Thank you very much 非常感谢你

What version of PHP are you using? 您正在使用哪个版本的PHP? I think nusoap does not support PHP 7, and I'm also 500 errors when trying to run nusoap on a server with PHP 7. 我认为nusoap不支持PHP 7,并且在使用PHP 7的服务器上尝试运行nusoap时也出现了500个错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM