function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
saritha78saritha78 

SForceService serialization problem

Hi,
I am new to Salesforce; I am trying to bind ObjectDatasource to a method in our custom namespace and I get the serialization error.
 
Here are the details:
 
In the APIHelper class (which is defined in a custom namespace which references the SalesForceWebservice), I have a method as
public static List<NewObj__c> GetNewObjects(SforceService binding, string opId)
 
I am binding this method to selectMethod of an object datasource and it gives me the following error:
 
Type 'a.b.SforceService' in Assembly 'a,
Version=1.0.2460.27497, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
 
I believe this error occurs if a class does not have the attribute Serializable, in this case I think the class SforceService is Serializable and yet I get this message. Do I have to open a case with support to get a solution to this problem?
 
Thanks,
Saritha
 
SuperfellSuperfell
Why would SforceService need to be serializable ? isn't it NewObj__c that you want to be serializable (for which there is a switch in wsdl.exe to enable)
saritha78saritha78
WSDL.exe? Could you please tell me where I can find it?
I can download the WSDL.xml from "Download Enterprise WSDL"  link in App Setup--Integrate--AppExchange API. Can you please tell me how to turn on the serializable for NewObj__c?
Thx,
SuperfellSuperfell
wsdl.exe is the .NET tool that generates the code stubs from the WSDL (VS.NET calls this under the covers when you do add web reference). Like all the wsdl.exe options, they're not exposed in VS.NET, you'll need to manually run wsdl.exe on the wsdl. See the .NET docs on wsdl.exe
saritha78saritha78

But the WSDL is generated for me by salesforce, I just download it and update my web reference. Is there a way in salesforce to specify that the custom object that I am creating is Serializable?

Thx,

SuperfellSuperfell
The wsdl defines the message format on the wire, nothing more nothing less. How a particular tools choose to map that to its environment is entirely upto the tool.

I don't know if this will solve you're problem but wsdl.exe /enableDataBinding enterprise.wsdl will turn on databinding support in the generated code.
saritha78saritha78
Gareth and Simon,
Thank you very much for your inputs.
 
I generated the new Reference.cs using wsdl.exe and it is same as the Reference.cs generated by visual studio when I do "Add web reference"...  :( I've opened a case with salesforce to get a solution.
 
Thanks for your help.
Saritha
 

Message Edited by saritha78 on 09-27-2006 02:30 PM

saritha78saritha78

Also, I changed the method signature to

public static List<NewObj__c> GetNewObjects(string api, string sessionid, string opId)

and got the SForceService object inside this method using the sessionid and api and this method binds to the objectdatasource fine! So, I am assuming the problem is with sforceservice object and not my custom object.