codewordstemexistsresponse

codewordstemexistsresponse

我有一个我不明白的错误。调用下面的函数codewordstemexists()应该创建一个soapclient,它连接到正在运行的soapserver(服务器端没有报告我发现的错误)。

private static function initClient() {
    ini_set("soap.wsdl_cache_enabled", "0");
    $classmap = array(
        'CodewordStemExists' => 'CodewordStemExists',
        'CodewordStemExistsResponse' => 'CodewordStemExistsResponse',
    );
    $client = new \SoapClient("http://..../service.wsdl", array(
        "trace" => true,
        "exceptions" => true,
        "classmap" => $classmap
    ));
    return $client;
}

public static function codewordStemExists($stem) {
    $client = self::initClient();
    try {
        $req = new CodewordStemExists();
        $req->username = "....";
        $req->password = "....";
        $req->codewordStem = $stem;

        $res = $client->codewordStemExists($req);
        return (bool)$res->result;
    }
    catch (\SoapFault $e) {
        var_dump($client->__getLastResponse());

}

/** The result from var_dump: */
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://....">
<SOAP-ENV:Body>
    <ns1:CodewordStemExistsResponse><ns1:result>false</ns1:result>
    </ns1:CodewordStemExistsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

肥皂剧的缺点:
Class 'CodewordStemExistsResponse' not found

启动时需要codewordstemexistsresponse,可以随时实例化它。
有人见过这个吗?谢谢。

最佳答案

检查是否需要正确的命名空间,例如\vendor\CodewordStemExistsResponse

10-08 01:12