Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

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!

share|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 '12 at 9:13
    
It seems very likely that you would need to encode XML reserved characters: <>"& –  Kit Menke Feb 2 '12 at 15:43
    
Hi Kit, yes probably but into what? Their corresponding entity? –  ptrico Feb 3 '12 at 4:35
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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