function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
henryCHhenryCH 

SOAP/XML Error: Invalid Token

Hi,

I'm still using the PEAR SOAP libraries and never had problems creating SObjects like tasks. But now we moved to a new ISP and after all create calls the XML response seems to be invalid an I get the following error message:

XML error on line 1 col 4 byte 4 not well-formed (invalid token)

When I print out the resulting error object it shows that the sObject was created but the positive xml response seems to cause the mentioned error.

I already tried to set the default character set to utf-8 using PHP's ini_set and Apache's .htaccess directives but that didn't change anything.

Since this is a massive problem for a customer of ours any help is greatly appreciated!

Thanks,

Henry
Mario VMario V
I had the same problem when I upgraded PEAR-SOAP from 0.9.1 to 0.9.4 or some such. Now it seems to be required that you add 'use' => 'literal' to the options parameter of the SOAP calls, at least for method calls that recieve no parameters (like getUserInfo). The proxy class provided in the samples already does this, but I made my own proxy class, and since it seemed to work without all those options I left them out. Maybe that's your problem too. Try something like this:
 
Code:
class MySalesforceSOAPClient extends SOAP_Client {

// ...

    function &getUserInfo() {
        return $this->call ("getUserInfo", $v = null, array ('namespace' => 'urn:partner.soap.sforce.com', 'use' => 'literal');
    }
}

 

Message Edited by Mario V on 08-14-2006 03:29 AM

Message Edited by Mario V on 08-14-2006 03:35 AM

Mario VMario V

Hmm, on second reading, your error is in the create() call, which obviously isn't a parameter-less method... check the PEAR-SOAP version in your new ISP and make sure it's the same you used to develop your application.

It may also be useful to log the SOAP calls, check the response message and see exactly what part of the XML recieved is causing the error. If it does not tell you anything useful, post it here.