xData Parameter

Nov 9, 2011 at 4:29 PM

I need to inspect the xData parameter passed to the completefunc.  I have looked through the documentation and must be overlooking something.

In my case, the Status parameter has the value "error" and I need to look at xData, and determine specifics about the error in order to provide meaningful feedback to the end user.

What is it?  Xml? A javascript object?

Coordinator
Nov 9, 2011 at 8:02 PM

The Web Services return XML. You can alert(xData.responseText), poke the contents into the DOM to view it, or use a browser add-on like Firebug.

M.

Nov 9, 2011 at 8:18 PM

Thanks for the reply. 

Firebug was invaluable, used the Network feature to see the raw soap xml returned, and from that was able to determine the structure of the xml in xData.responseXML. Here's the code I ended up using to discover the error info.

errorCode = $(xData.responseXML).find("ErrorCode").text();

And here is a snippet of the raw soap xml returned under this error condition (adding the same link to the user's favorites when the link already exists):

<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Operation Failure ---&gt; There is an existing link with the same title, group, and URL.</faultstring>
<detail>
<ErrorCode xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">PrivacyItemExists</ErrorCode>
<ErrorMessage xmlns="http://microsoft.com/webservices/SharePointPortalServer/UserProfileService">There is an existing link with the same title, group, and URL.</ErrorMessage>
</detail>
</soap:Fault>