NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
XML error parsing SOAP payload on line 1: Mismatched SOLVED


Joined: 01 Jun 2017
Posts: 1
Location: Argentina
Reply with quote
Hello
I had problems with the error "XML error parsing SOAP payload on line 1: Mismatched tag".
After analyzing with Debug () I discovered that the SOAP Response message was truncated in 3 characters, leaving the string "ENV: Envelo" at the end and the characters "pe>" being lost.
The error occurred when the BODY had a length greater than 8192 characters.

A basic but effective solution:

According to what I researched and tested, when the SOAP Response BODY is greater than 8192 characters, the "Content-Length:" value returned in the Response header (incoming_headers ['content-length']) is wrong, it is 3 bytes shorter, so when function getResponse () excecute the fread () function, the variable $ data is truncated at end, Leaving always the string "ENV: Envelo".
What the patch does is correct, on client side, the length.
The revision of the code should be continued to see, at server side, to know what is wrong in calculating the length.

Original Code (Line 3054 in nusoap.php version = '0.9.5'
Code:

   function getResponse(){
      ....
      while (($strlen < $content_length) && (!feof($this->fp))) {
             $readlen = min(8192, $content_length - $strlen);
            $tmp = fread($this->fp, $readlen);


Patched code:
Code:

   function getResponse(){
      ....
      while (($strlen < $content_length) && (!feof($this->fp))) {
             $readlen = min(8192, $content_length - $strlen);
            // add 01/06/2017 claudiocepeda@hotmail.com -------------------------
            if ($readlen < 8192) {$readlen = $readlen + 3;}
            // -----------------------------------------------------------------------------         
            $tmp = fread($this->fp, $readlen);


Very Happy
View user's profileFind all posts by Klaudio36Send private message
Site Admin

Joined: 13 Jul 2003
Posts: 8328
Reply with quote
Can you reproduce the problem with official samples for client and server?
Thanks for the attempt to fix, but this will not go. We can't afford adding arbitrary numbers to the read length. Why 3? Why not 303? From what you posted it looks like either $content_length or $strlen or both have wrong values and therefore fread won't read up to the end of file leave 3 symbols. If that's correct, we need to figure out which one is wrong and why.

_________________
The PHP IDE team
View user's profileFind all posts by dmitriSend private messageVisit poster's website
XML error parsing SOAP payload on line 1: Mismatched SOLVED
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic