肥皂没有正确发送,需要得到请求

Opt*_*ime 1 php soap

我有这个类发送SOAP请求(该类还定义了头)

class Personinfo
{
    function __construct() {
        $this->soap = new SoapClient('mysource.wsdl',array('trace' => 1));
    }

    private function build_auth_header() {
        $auth->BrukerID = 'userid';
        $auth->Passord = 'pass';
        $auth->SluttBruker = 'name';
        $auth->Versjon = 'v1-1-0';

        $authvalues = new SoapVar($auth, SOAP_ENC_OBJECT);
        $header =  new SoapHeader('http://www.example.com', "BrukerAutorisasjon", // Rename this to the tag you need
        $authvalues, false);

        $this->soap->__setSoapHeaders(array($header));
    }

    public function hentPersoninfo($params){

        $this->build_auth_header();
        $res = $this->soap->hentPersoninfo($params);
        return $res;
    }
}
Run Code Online (Sandbox Code Playgroud)

问题是我的功能有问题而且响应是错误的.我想知道我的请求发送了什么内容,但我无法弄清楚如何.

我在hentPersoninfo函数中尝试了一个try/catch-block,它调用$this->soap->__getLastRequest但总是为空.

我究竟做错了什么?

Zac*_*ese 5

在我开始以编程方式访问服务之前,我使用SoapUI来确保我知道发送给服务的需求以及我应该期待的内容.

这样,您可以确保问题不在Web服务中和/或您对如何访问Web服务的理解.

在理解了这一点之后,您可以将注意力集中在使相关的SOAP框架完成您需要它做的事情上.