0

I'm trying to create a Soap connection. The error I'm getting is:

SOAP Fault: (faultcode: Client faultstring: looks like we got no XML document)

I have my code below. Any suggestions of where to look from here?

$myproxy = new SoapClient('https://example.com/index.php/api/v2_soap/index/?wsdl');
try {
  $sess = $myproxy->login('user','password');
} catch(Soapfault $err) {
  $error_message = "SOAP Error: (faultcode: {$err->faultcode}\n" ."faultstring: {$err->faultstring})";
  echo $error_message;
}

I've tried troubleshooting the WSDL file by going to https://example.com/index.php/api/v2_soap/index/?wsdl, saving it as an XML file and running it through wsdl-analyzer.com. The error I got was:

The structure of your WSDL is types (1) message (12) portType (1) binding (1) service (1) message (288) But should be types messages portTypes bindings services

1 Answer 1

0

Try using the __getLastResponse() method in the catch block. This method examines the server response. The $myproxy->__getLastResponse(); displays the error message that is thrown during the last SOAP response which will lead you in the right direction.

And, also include the array('trace' => 1) param while initializing the SoapClient.

$myproxy = new SoapClient(
'https://example.com/index.php/api/v2_soap/index/?wsdl', 
array('trace' => 1)
);
try {
  $sess = $myproxy->login('user','password');
} catch(Soapfault $err) {
  echo $myproxy->__getLastResponse();
}
1
  • #7 /home/site/public_html/index.php(68): Mage::run('', 'store') #8 {main} which corresponds with: $mageRunCode = isset($_SERVER['MAGE_RUN_CODE']) ? $_SERVER['MAGE_RUN_CODE'] : ''; $mageRunType = isset($_SERVER['MAGE_RUN_TYPE']) ? $_SERVER['MAGE_RUN_TYPE'] : 'store'; Mage::run($mageRunCode, $mageRunType);
    – Tom
    Jul 18, 2018 at 13:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.