BreeeZe/rpos

When there is Chinese in the soap body, Onvif Device Manager and wireshark will fail to parse it.

Opened this issue · 1 comments

    // modify services/media_service.ts
    port.GetProfiles = (args, cb, headers) => {
      utils.log.info(`GetProfiles:`);
  
      const GetProfilesResponse = { Profiles: [] };
  
      let currentName = "中文";
  
      const profile = {
        Name: currentName,
        attributes: {
          token: 'currentToken'
        }
      };
      GetProfilesResponse.Profiles.push(profile);
      cb(GetProfilesResponse);
    };

ONVIF Device Test Tool will prompt an error message "An error occurred while receiving packet. Expected length: 642, received: 646". And wireshark will split soap response body with the second part showing “Unrecognized text”, while the “Unrecognized text” is exactly 4 bytes.

无标题

So it looks like the code that computes the length of the XML payload is incorrect.