1

I need to test some XML requests manually, i.e. I want to call a webservice method with an XML request previously created. I'm trying to use the SoapClient __doRequest, and all I get back is a blank, empty response.

I already read the documentation, and several other posts here and seems no one has tried this before and the few who asked similar question, got really no response.

Again, the reason of doing it this way it's just a way to test an XMLRequest generated by other tool that is causing problems at certain webservice. So, I can't call the soapclient generated methods, nor I can't call "_call". I need to send my own previously created XML request using SOAPClient. Is this possible? If so how....

$result = $soapClient->__doRequest($docRequest, "http://someservice.asmx", "http://someservice/Login",  soap_1_2, 0);

When I call this I get null at $result without any error.

4

2 に答える 2

3

私はなんとかこのようにそれをすることができました:

class LocalSoapClient extends SoapClient
{
    function __doRequest($request, $location, $action, $version, $one_way = 0) 
    {
        $request = "...."; // your changed XML goes here

        return parent::__doRequest($request, $location, $action, $version, $one_way);
    }
}

$client = new LocalSoapClient($wsdl_url, array('trace' => 1));
$client->__soapCall($function_name, array($service_call_params));

__doRequestを直接呼び出さないことに注意してください。これは、標準の__soapCallを実行したときに実行されます。

于 2013-01-27T22:04:22.300 に答える
1

http://php.net/manual/soapclient.dorequest.phpから

おそらく、あなたの呼び出しは、キャッチする必要がある例外をスローします:

$exception = null; 
$result = parent::__doRequest($request, $location, $action, $version, $one_way); 
if((isset($this->__soap_fault)) && ($this->__soap_fault != null)) { 
        //this is where the exception from __doRequest is stored 
        $exception = $this->__soap_fault; 
} 

if($exception != null) { 
        throw $exception; 
} 
于 2012-11-23T09:11:25.057 に答える