Condividi tramite


"There is an error in XML document(1, 468). --> Input string not in a correct format" with people.asmx web service

Issue:

 

When you are trying to retrieve the search requestor result by using the SOAP web service https://<Site>/_vti_bin/People.asmx
(https://msdn.microsoft.com/en-us/library/people.people.searchprincipals%28v=office.12%29.aspx), you might get the below error messages.

 

The query cannot be run for the following DataObject:SearchPrincipals

Infopath cannot run the specified query.

The SOAP response indicates that an error occurred:

 

Server was unable to read request --> There is an error in XML document(1, 468). --> Input string not in a correct format.

  

Cause:

 

The Search Principals Parameters might not be passed correctly.

 

Resolution:  

  • Found the following error message in the Fiddler. 

HTTP/1.1 500 Internal Server Error
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Server: Microsoft-IIS/7.5
X-AspNet-Version: 2.0.50727
X-Powered-By: ASP.NET
MicrosoftSharePointTeamServices: 14.0.0.6123
X-MS-InvokeApp: 1; RequireReadOnly
Date: Thu, 11 Dec 2014 17:08:15 GMT
Content-Length: 478

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="https://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="https://www.w3.org/2001/XMLSchema"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server was unable to read request. ---&gt; There is an error in XML document (1, 468). ---&gt; Input string was not in a correct format.</faultstring><detail /></soap:Fault></soap:Body></soap:Envelope>

  • We are able to browse the people.asmx web service in the browser.
  • The certificates are also configured properly.
  • Then, checked if the parameters are passed properly in the search principals method.

  • The values are not set for the tns:maxResults* and tns:principalType.
  • Compared it with the actual syntax of the method.
  • The parameters max results and the principal type should not be empty.

[SoapDocumentMethodAttribute("https://schemas.microsoft.com/sharepoint/soap/SearchPrincipals", RequestNamespace="https://schemas.microsoft.com/sharepoint/soap/", ResponseNamespace="https://schemas.microsoft.com/sharepoint/soap/", Use=SoapBindingUse.Literal, ParameterStyle=SoapParameterStyle.Wrapped)]
public PrincipalInfo[] SearchPrincipals (
 string searchText,
 int maxResults,
 SPPrincipalType principalType
)

 From <https://msdn.microsoft.com/en-us/library/people.people.searchprincipals(v=office.12).aspx>

  • Entered values for those parameters and it worked. 

Published By: Madhan Kumar