Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
682 views
in Technique[技术] by (71.8m points)

php - Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL

I'm using SSRS SDK for PHP

PHP Version 5.4

WebServer: Centos 6.4

MSSQL Server 2008 R2

When I make

$ssrs_report = new SSRSReport(new Credentials(UID, PASWD), SERVICE_URL);

I got the following error

Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: 
Couldn't load from 'http://172.16.4.63/ReportServerURL/Pages/ReportViewer.aspx?%2fTestFolder%2ftestClaimHdr&rs:Command=Render/ReportExecution2005.asmx?wsdl' : 
Premature end of data in tag html line 1 in /var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php:196 

Stack trace: #0 /var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php(196): 
SoapClient->SoapClient('http://172.16.4...', Array) #1 /var/www/emilio/SSRS/index.php(12): 
SSRSReport->SSRSReport(Object(Credentials), 'http://172.16.4...') #2 {main} thrown in 
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php on line 196

I'm looking how to fix it and get the report trough the soap(SSRS SDK for PHP).

I tried using file_get_content() and curl and both worked fine, then isn't connection problems, I have

  • Soap Client enabled
  • allow_url_fopen is On

this is the line where the sdk call the soap service

$executionServiceUrl="http://172.16.4.63/ReportServerURL?%2fTestFolder%2ftestClaimHdr&rs:Command=Render/ReportExecution2005.asmx?wsdl";
$options = array ( 'login' => 'xxxx\xxxx', 'password' => 'xxxx', )

$this->_soapHandle_Exe = new SoapClient($executionServiceUrl, $options);

Adding

 try {
  $this->_soapHandle_Exe = new SoapClient($executionServiceUrl, $options);
} catch (Exception $e) {
  var_export(libxml_get_last_error());
}

I get the following array:

LibXMLError::__set_state(array(
      'level' => 3,
      'code' => 77,
      'column' => 43325,
      'message' => 'Premature end of data in tag html line 1',
      'file' => 'http://172.16.4.63/ReportServerURL?%2fTestFolder%2ftestClaimHdr&rs:Command=Render/ReportExecution2005.asmx?WSDL',
      'line' => 1,
)

According to xmlerror from libxml2

level 3 = XML_ERR_FATAL = 3 : A fatal error

code 77 = XML_ERR_TAG_NOT_FINISHED = 77 : 77

I have alredy set the Basic authentication in the SSRS SERVER

Update

As @jwhaley58 said I changed to:

define("SERVICE_URL", "http://172.16.4.63/ReportServerURL");
$ssrs_report = new SSRSReport(new Credentials(UID, PASWD), SERVICE_URL);
$ssrs_report->LoadReport2('testClaimHdr',NULL);

and I get:

Fatal error: Uncaught exception 'SSRSReportException' in 
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php:590 Stack trace: #0 
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php(326): 
SSRSReport->ThrowReportException(Object(SoapFault)) #1 /var/www/emilio/SSRS/index.php(15): 
SSRSReport->LoadReport2('testClaimHdr', NULL) #2 {main} thrown in 
/var/www/emilio/app/Libraries/SSRSReport/bin/SSRSReport.php on line 590
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Some gochas that I only found through trial and error are some configuration issues, on the server that is running the reporting server service, make sure that in your file rsreportserver.config has been modified to allow for basic authentication. By default, if I'm understanding it correctly, it wants a more trustworthy connection type, but the sdk needs you to allow simple name and passwords to be passed. This means that needs to be added to your authentication methods in the configuration.

so for example,

In C:Program FilesMicrosoft SQL ServerMSRS11.1Reporting ServicesReportServer sreportserver.config (Different for server and version, but you get the idea.)

<Authentication>
    <AuthenticationTypes>
        <RSWindowsNTLM/>
        <RSWindowsBasic/> ##you need to add this one##
    </AuthenticationTypes>
    <RSWindowsExtendedProtectionLevel>Off</RSWindowsExtendedProtectionLevel>
</Authentication>

IIRC you will have to restart the service for this to take effect.

Also, if you are attempting to RenderAs, some of the template files used to pop the headers have space in them towards the bottom that will prevent you from rendering as Excel, PDF, ect unless that has been fixed since I worked on it.

I'm looking through the code you provided, I may be reading it wrong, but it looks like you are trying to explicitly define the report you're after in the execution url. If that is in fact what you are doing, I believe the fix would be to only define the report base you are connecting to so for your example the url should be http://172.16.4.63/ReportServer/. After that connection is made, you would use the LoadReport2 function to specify which report you need.

Lastly, Where you have the name of the report, it looks like you have a subdirectory called testfolder? if that is still the case, you would need your report name to be "/TestFolder/testClaimHdr" in the call to LoadReport2.

Hope any of that helps.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...