SugarCRM SOAP server and ASP client

Yesterday I tried to implement a creation of new lead via ASP web site. I’m a Linux geek. So, my colleague assisted me on ASP side.
First of all, I was pleasantly surprised that SugarCRM provides WSDL to build SOAP client. It isn’t so important in case Perl or even Java (this is amazing) but it’s impossible to create SOAP client on ASP without WSDL (that’s why I hate MS). The colleague created ASP SOAP client, I prepared a simple Perl SOAP client and we started test them. In case of English symbols everything worked fine. But Greek data were corrupted. I changed encoding ISO-8859-1 to UTF-8 in the all nusoap classes (note – there are many places where encoding type is hardcoded. Just make a grep by ‘ISO-8859-1’ and find them):

var $soap_defencoding = 'UTF-8';
//var $soap_defencoding = 'ISO-8859-1';

But result was the same. Greek letters were displayed as symbols ‘?’.
Then I tried to use Perl client. It worked fine with both languages. After digging XML code I found that all Greek symbols were encoded as ‘SOAP-ENC: base64’ instead of ‘xsd:string’. Module SOAP::Lite did it automatically. But ASP client used WSDL and coded them as ‘xsd:string’ according to its definitions.
After changing definitions of lead properties in WSDL to ‘SOAP-ENC: base64’ ASP client started send correct data. WSDL definitions are in SOAP.php:

$server->register( 'create_lead',
array('user_name' => 'xsd:string',
'password' => 'xsd:string',
'first_name' => 'SOAP-ENC:base64', //'xsd:string',
'last_name' => 'SOAP-ENC:base64', //'xsd:string',
'email_address ' => 'xsd:string'),
array('return'=>'xsd:string'),
$NAMESPACE);

Maybe it seems like hack. But it resolved our problem.

Leave a Reply

Your email address will not be published. Required fields are marked *