Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SOS ! String could not be parsed as XML #31

Open
RocheR2D2 opened this issue Apr 22, 2018 · 6 comments
Open

SOS ! String could not be parsed as XML #31

RocheR2D2 opened this issue Apr 22, 2018 · 6 comments

Comments

@RocheR2D2
Copy link

RocheR2D2 commented Apr 22, 2018

in vendor\chartblocks\php-ssrs\library\SSRS\Soap\ServerException.php (line 12)

public $faultcode;    
public $faultstring;    
public $faultactor;    
  static function fromResponse($string) {        
            $xml = new \SimpleXMLElement($string);        
            $ns = $xml->getNamespaces(true);        
            $soap = $xml->children($ns['soap']);        
            $body = $soap->Body->children($ns['soap']);        
                if (isset($body->Fault)) {

Please help Thanks !!!

@rb-cohen
Copy link
Member

Could you echo out $string before line 12 and just check it is valid XML/what the response was?

@RocheR2D2
Copy link
Author

RocheR2D2 commented Apr 23, 2018

Hi, thanks, I use symonfy , and in my controller,

public function indexAction(Request $request)
{
    $ssrs = new Report("http://LAPTOP-48KMKF8K:8090/ReportService", array('username' => 'xxxx', 'password' => 'xxxx'));

    dump($ssrs);

    die();

    return $this->render('reports/index.html.twig', [
        'ssrs' => $ssrs
    ]);

and the result:

ReportingController.php on line 30:
Report {#663 ▼
+servicePath: "ReportService2010.asmx"
+executionPath: "ReportExecution2005.asmx"
+options: array:4 [▼
"cache_wsdl_path" => null
"cache_wsdl_expiry" => 86400
"curl_options" => []
"hijackActionUrls" => false
]
#_baseUri: "http://LAPTOP-48KMKF8K:8090/ReportService"
#_username: "xxxx"
#_passwd: "xxxx"
#_soapService: null
#_soapExecution: null
#_executionNameSpace: "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices"
#_headerExecutionLayout: "%s"
#_sessionId: null

I don't understant why _soapService is null. And i can't call the function << $ssrs->listChildren('/Report Folder');>> , it will give me error " String could not be parsed as XML"

THANKS !!!!

@rb-cohen
Copy link
Member

It is the $string variable in vendor\chartblocks\php-ssrs\library\SSRS\Soap\ServerException.php we need to dump out.

So from your first code sample, we'd want to change it to the following temporarily just to see what your response is.

public $faultcode;    
public $faultstring;    
public $faultactor;    
  static function fromResponse($string) {        
            var_dump($string);
            exit;

            $xml = new \SimpleXMLElement($string);        
            $ns = $xml->getNamespaces(true);        
            $soap = $xml->children($ns['soap']);        
            $body = $soap->Body->children($ns['soap']);        
                if (isset($body->Fault)) {

We may need to make some changes to the library to handle non-XML response a little better but it would help to see what sort of response you're getting.

@RocheR2D2
Copy link
Author

ok thanks a lot. I tried to dump it. This is the result:

string(0) ""

@leith
Copy link
Contributor

leith commented May 28, 2019

@RocheR2D2 does my fix on #33 resolve your issue?

@RocheR2D2
Copy link
Author

RocheR2D2 commented May 28, 2019 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants