PHP soap Error "Looks like we got no XML document"

Source: Internet
Author: User
Today I was thinking of using soap to develop a related interface to call a cooperative company, but encountered this error. After a long period of troubleshooting, Google also looked for a long time, but are not the problems I encountered. However, I finally found it to be related to the size of the amount of data transmitted by SoapServer (I do not know if the description is appropriate). When I fetch 10 data from the database, I can easily use soapclient to get the data, but when I query 1000 data from the database, I get an error ("Fatal error:uncaught SoapFault Exception: [ Client] looks like we got no XML document in ... ")! If I run the person.class.php program directly, the full XML document can be displayed. Is there a relationship between the environment configuration of this server? I don't know much about soap, I'm just learning to sell it now. It is hoped that experienced predecessors can guide twos. Thank you so much!
Here is my program code:




 Query ($strGetList); $results = Array (); $xmlString = "
 query ($ strGetList);
$ results = array ();
$ xmlString = "\ n";
$ xmlString. = "\ n";
while ($ rows = $ GLOBALS ['le']-> fetch_assoc ()) {
$ results [] = $ rows;
}
foreach ($ results as $ key => $ val) {
$ xmlString. = "\ n";
foreach ($ val as $ k => $ v) {
if (strlen ($ v)> 0) {
$ v = htmlspecialchars ($ v);
$ xmlString. = "$ v \ n";
}
}
$ xmlString. = "\ n";
}
$ xmlString. = "\ n";
return $ xmlString;
}
}
// $ p = new person;
// echo $ p-> getInfo (); // All data can be displayed in the tested xml

--- Dividing line ---

'abcd', 'encoding' => 'UTF-8'));
$ server-> setClass ('person');
$ server-> handle ();

--- Dividing line ---

'http://192.168.1.126:102/server.php',
'uri' => 'abcd',
  'encoding' => 'UTF-8',
));
$ s1 = $ soap-> __ soapCall ('getInfo', array ());
echo $ s1;
} catch (Exction $ e) {
echo $ e-> getMessage ();
}




Reply content:



Today I was thinking of using soap to develop a related interface to call a cooperative company, but encountered this error. After a long period of troubleshooting, Google also looked for a long time, but are not the problems I encountered. However, I finally found it to be related to the size of the amount of data transmitted by SoapServer (I do not know if the description is appropriate). When I fetch 10 data from the database, I can easily use soapclient to get the data, but when I query 1000 data from the database, I get an error ("Fatal error:uncaught SoapFault Exception: [ Client] looks like we got no XML document in ... ")! If I run the person.class.php program directly, the full XML document can be displayed. Is there a relationship between the environment configuration of this server? I don't know much about soap, I'm just learning to sell it now. It is hoped that experienced predecessors can guide twos. Thank you so much!
Here is my program code:


 Query ($strGetList); $results = Array (); $xmlString = "
 query ($ strGetList);
$ results = array ();
$ xmlString = "\ n";
$ xmlString. = "\ n";
while ($ rows = $ GLOBALS ['le']-> fetch_assoc ()) {
$ results [] = $ rows;
}
foreach ($ results as $ key => $ val) {
$ xmlString. = "\ n";
foreach ($ val as $ k => $ v) {
if (strlen ($ v)> 0) {
$ v = htmlspecialchars ($ v);
$ xmlString. = "$ v \ n";
}
}
$ xmlString. = "\ n";
}
$ xmlString. = "\ n";
return $ xmlString;
}
}
// $ p = new person;
// echo $ p-> getInfo (); // All data can be displayed in the tested xml

--- Dividing line ---

'abcd', 'encoding' => 'UTF-8'));
$ server-> setClass ('person');
$ server-> handle ();

--- Dividing line ---

'http://192.168.1.126:102/server.php',
'uri' => 'abcd',
  'encoding' => 'UTF-8',
));
$ s1 = $ soap-> __ soapCall ('getInfo', array ());
echo $ s1;
} catch (Exction $ e) {
echo $ e-> getMessage ();
}




From SoapClient's exception "[Client] looks like we got no XML document" should be a response problem, so first of all is to see what the response message is, there are several scenarios to help you locate the problem:


    1. Simply, you can use SOAPUI to see if the response is really a problem? Are you not responding?
    2. Geek a little, homemade a mock client to check the response message, the ordinary SOAP protocol is not difficult, simply post a small XML HTTP protocol to the server on the line, the code should be within 20 lines
    3. I usually use a little bit, because soap is the HTTP transport protocol, so you can crawl the entire HTTP Response, check whether its content conforms to XML format. Crawl mode can be used tcpdump (Linux command line) or Httptracer (Java cross-platform, easy to use, my favorite)
    4. Direct point of view soapclient.php source code, I remember the words of the small volume, find the string "looks like we got no XML document", and then go back to the XML parsing that paragraph, Output the original content before parsing to see what's wrong with the response content





Do not use SOAP, send the interface to your data dump out to see. It is estimated that the network transmission of what the problem, the data is not captured, XML is incomplete, can not be resolved.






Did you solve the problem? Ask for guidance

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.