Error consuming Web Service: SOAP-ENV:Client Inter

2019-08-24 02:47发布

问题:

I had to consume a Web Service in php (Zend Framework), everything seems to be fine, but when I wanted to retrieve the response from the server through a try catch system like this:

try{
    $response = $client->METHOD_TO_CONSUME(array(
            'DATA1' => $data1,
            'DATA2' => $data2
            )
        );
} catch (SoapFault $e) {
    Mage::log("Fault Message: " . $e->getMessage());
    Mage::log("Fault Code: " . $e->faultcode . ' ' . $e->faultstring . ' ' . $e->detail);
    Mage::log("Fault: " . (string) $e);
}

But then i got this error: SOAP-ENV:Client SOAP-ENV:Client Internal Server Error SoapDoc::CheckNameSpace: Wrong xml name space

First i thought it was a problem with the WSDL, but then i made some test with SoapUi, and everything worked perfectly. I don't have any idea what it could be happening?

回答1:

After hours of investigation, i solved it, the problem was the Soap version, by default, Zend uses Soap 1.2. When i changed it to the 1.1 version, everything works perfectly.

$params = array(
            'soapVersion' => SOAP_1_1
        );

 $client = new Zend_Soap_Client($url, $params);

I hope help somebody with this :D

Greetings