I am trying to integrate with SOAP web services from SalesForce. My goal is to simply pull user data from SalesForce so that we can integrate it into our system. I can successfully log in using the proxy class (C #) that I created from the WSDL partner on the SalesForce website. The next thing I want to do is to request users by pulling out FirstName, LastName, ect ...
It is important to know that I was forced to change the generated proxy code because it was not generated correctly. He populated the xml serialization fields to match the private fields that throw an exception when making web service calls. He also created an empty namespace for the "Any" property of the sObject class, which I deleted. I got some advice from https://stackoverflow.com/a/146354/ ... if you want to know why I made these options.
This is what my query looks like: 
qResult contains exactly 3 entries (that's for sure, since I only have 3 users). The problem is that every sObject property except "type" is always null.
I canβt understand if I can make a simple mistake when trying to query or if the reason for this is the fact that I had to change the proxy class and delete the namespace in the Any field. I'm not sure what to do at this moment. The same query in the developer's console (on SalesForce.com) returns the correct data. It's also worth mentioning that my query result returned the correct number of elements, they just don't have data. It should be something simple ... like adding a namespace binding, but figuring out what should be, or adding xmlbinding to the property.
I'm just wondering if anyone knows what to do about it. Maybe the same thing happened to them?
EDIT: So, I took the time to execute some incredibly hacker methods to intercept requests from the generated webservice client, and in the end I got the source data that is sent from SalesForce in response to my request. Here he is:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:partner.soap.sforce.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sf="urn:sobject.partner.soap.sforce.com"> <soapenv:Body> <queryResponse> <result xsi:type="QueryResult"> <done>true</done> <queryLocator xsi:nil="true"/> <records xsi:type="sf:sObject"> <sf:type>User</sf:type> <sf:Id xsi:nil="true"/> <sf:FirstName>Bob</sf:FirstName> <sf:LastName>Dyllan</sf:LastName> <sf:Email> bob@bob.com </sf:Email> <sf:CompanyName xsi:nil="true"/> <sf:Phone xsi:nil="true"/> <sf:Title xsi:nil="true"/> </records> <records xsi:type="sf:sObject"> <sf:type>User</sf:type> <sf:Id xsi:nil="true"/> <sf:FirstName>Zachary</sf:FirstName> <sf:LastName>Sheppard</sf:LastName> <sf:Email> some_guy@yahoo.com </sf:Email> <sf:CompanyName>Yahoo</sf:CompanyName> <sf:Phone xsi:nil="true"/> <sf:Title xsi:nil="true"/> </records> <records xsi:type="sf:sObject"> <sf:type>User</sf:type> <sf:Id xsi:nil="true"/> <sf:FirstName xsi:nil="true"/> <sf:LastName>Chatter Expert</sf:LastName> <sf:Email> noreply@chatter.salesforce.com </sf:Email> <sf:CompanyName xsi:nil="true"/> <sf:Phone xsi:nil="true"/> <sf:Title xsi:nil="true"/> </records> <size>3</size> </result> </queryResponse> </soapenv:Body> </soapenv:Envelope>
There seems to be a serialization issue with the "sf" properties in these sObjects ... but how do I make this match with my C #? Here is C # as it currently belongs to the sObject class:
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.1")] [System.SerializableAttribute()] [System.Diagnostics.DebuggerStepThroughAttribute()] [System.ComponentModel.DesignerCategoryAttribute("code")] [System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:sobject.partner.soap.sforce.com")] public partial class sObject { /// <remarks/> public string type; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute("fieldsToNull", IsNullable=true)] public string[] fieldsToNull; /// <remarks/> [System.Xml.Serialization.XmlElementAttribute(IsNullable=true)] public string Id; /// <remarks/> public System.Xml.XmlElement[] Any; }