I just saw the following error:

Error contacting VAT verification service: Service return error - XML error parsing SOAP payload on line 2: Invalid character.

This happens while attempting to do VAT validation for a Swedish company that has the character "ö" in its address, which is being returned as part of the SOAP response. Not being familiar with the SOAP Client module in detail, I hacked up a small test script that does an HTTP POST with curl, which breaks if the POST Content-Type header is text/xml; charset=iso-8859-1 but succeeds when it's text/xml; charset=utf-8.

Can someone confirm that soapclient_init_client uses something other than UTF-8 by default, and if so, is there a way to either make the charset configurable, or just use UTF-8?

CommentFileSizeAuthor
#1 soap-utf8.patch1.18 KBwimh

Comments

wimh’s picture

Version: 6.x-2.x-dev » 6.x-3.x-dev
StatusFileSize
new1.18 KB

nuSOAP seems to default to ISO-8859-1. I've attached a patch that allows an alternative encoding to be passed in to soapclient_init_client(), can you give it a try?

bartezz’s picture

Priority: Normal » Major

Tried 6.x-3.x-dev but still encountering the exact same error/issue :(
Checked the manual service and the VAT number is recognized AND correct?

Increased to major as this prevents new accounts from being created :(

Cheers,
Bart

bartezz’s picture

Priority: Major » Normal
Status: Active » Reviewed & tested by the community

Hmmm went into soap module and changed nusoap.php

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

to

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

That solved it... didn't like this hack so changed it back. But the issue is now gone. Seems like the fix above does work but maybe I had some caching issues? Will let you know if I encounter this again!

Cheers