3

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!

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

1 Answer 1

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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