Due to the version problem, there may be an error in uncaught soapfault exception: [Client] looks like we got no XML document. One of the reasons is that when sending and receiving, a warning is sent together with the data, resulting in a format error
When I used PHP to write soapserver, I couldn’t get the return value correctly. I found several solutions on the Internet, but they didn’t work until someone reminded me that there was something wrong with the data sent, so I could select the data manually
Rewrite
classSoapClientNewextendsSoapClient
{
publicfunction__doRequest($request,$location,$action,$version,$one_way=0)
{
$request=parent::__doRequest($request,$location,$action,$version,$one_way);
$start=strpos($request,'<soap');//Do the processing according to the actual situation.... , if it starts with <?xml, change it to <?xml
$end=strrpos($request,'>');
returnsubstr($request,$start,$end-$start+1);
}
}
Call
$client=newSoapClientNew($url);
can solve the problem
add a few lines to the code,
classSoapClientNewextendsSoapClient
{
publicfunction__doRequest($request,$location,$action,$version,$one_way=0)
{
$request=parent::__doRequest($request,$location,$action,$version,$one_way);
$myfile=fopen("newfile.txt","w")ordie("Unabletoopenfile!");
$txt=$request;
fwrite($myfile,$txt);
fclose($myfile);
$start=strpos($request,'<?xml');//Do the processing according to the actual situation.... , if it starts with <?xml, change it to <?xml
$end=strrpos($request,'>');
returnsubstr($request,$start,$end-$start+1);
}
}
it can be found that the data to be sent generated by the function becomes
<br/>
<b>Deprecated</b>:Automaticallypopulating$HTTP_RAW_POST_DATAisdeprecatedandwillberemovedinafutureversion.Toavoidthiswarningset'always_populate_raw_post_data'to'-1'inphp.iniandusethephp://inputstreaminstead.in<b>Unknown</b>online<b>0</b><br/>
<br/>
<b>Warning</b>:Cannotmodifyheaderinformation-headersalreadysentin<b>Unknown</b>online<b>0</b><br/>
<?xmlversion="1.0"encoding="UTF-8"?>
<SOAP-ENV:Envelopexmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns1="http://localhost/zlf/server.php"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Body><ns1:sayhelloResponse><returnxsi:type="xsd:string">hello!zlfamazing</return></ns1:sayhelloResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
the front warning is the cause of soap error. In addition to appeal settlement, follow the prompts to add always in php.ini file_ populate_ raw_ post_ If the semicolon in front of data = - 1 is removed and warning disappears, the problem of error reporting can also be solved
Similar Posts:
- There is no solution to the problem of expression. Interactions in behavior development
- An error occurred during local report processing: report definition has an invalid target namespace
- How to Solve Error: The content of element type “web-app” must match “(icon?display
- Attribute application@label value=(xxx) from AndroidManifest.xml:8:16-37 is also present at [com.github.adrielcafe:AndroidAudioConverter:0.0.8] AndroidManifest.xml:11:18-50 value=(@string/app_name)
- maven web web.xmlThe markup in the document following the root element must be well-formed.
- The requested resource [/servlet] in JavaWeb is not available [How to Solve]
- Maven [error] no longer supports source option 5. Please use version 7 or later
- The prefix “mvc” for element “mvc:annotation-driven” is not bound Error
- [Solved] PHP Error: always_populate_raw_post_data = -1
- Java web about web.xml 3.1