My client application is authenticating with a SharePoint website using the Authentication web service in Windows Sharepoint Services 3.0. The client is not written in C# and I craft the SOAP request "manually".

The authentication fails with the PasswordNotMatch LoginErrorCode when the provided password contains special characters. For instance, this password xS-5[V!VQEo!-4 generated by SharePoint fails the authentication.

What kind of encoding/escaping/processing do I need to do on the password when I build the SOAP request for authentication? Here's an example request with the password mentioned above:

<?xml version=\"1.0\" encoding=\"utf-8\"?>
<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">
<soap:Body>
<Login xmlns=\"http://schemas.microsoft.com/sharepoint/soap/\">
<username>my.username</username>
<password>xS-5[V!VQEo!-4</password>
</Login>
</soap:Body>
</soap:Envelope>

Thanks!

link|improve this question
OK, actually, the password I've given doesn't fail authentication. But I guess XML reserved characters would not be accepted, would they? – ptrico Feb 2 at 9:13
It seems very likely that you would need to encode XML reserved characters: <>"& – Kit Menke Feb 2 at 15:43
Hi Kit, yes probably but into what? Their corresponding entity? – ptrico Feb 3 at 4:35
feedback

1 Answer

Looks like you figured it out already but I'm guessing it is the XML reserved characters:

< becomes &lt;
> becomes &gt;
& becomes &amp;
" becomes &quot;
' becomes &apos;

Really though, whatever language you're crafting the SOAP message in probably already has a HTML/XML encode function.

More information and a list of all the entities.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.