+ Start a Discussion

Reserved Member variable Name for Salesfroce SOA

I fixed a bug in my code yesterday and wanted to verify the reason this situation was happening because it might be an issue with Salesforce SOA.

I autogenerated Apex code from a WSDL.  This original WSDL included an object called EmailAddress with two String member variables, Address and Name.  When I generated Apex code, I noted that the Name member variable was altered to Name_x (presumably to prevent collison).

When I used the WSDL in my code, I noted that values added to the Name_x property were not sent with web service calls.

To remedy, I altered the member variable in my web service from Name to DisplayName, regenerated the Apex code from WSDL (which did not append a _x to the member variable) and then altered the code that utilized the generated Apex code.  Values were then sent across the wire.

My feeling is that the Apex code generator prevents name collisions by altering member variable names (by appending _x) but when it comes time to utilize the external web service, the Apex code fails to translate the member variable name back.

I can provide example code if needed.
This looks like a bug. We will fix this in the next release.

Thanks for the reply Cheenath,

Are you able to recreate based on my description or would like like some sample code?

Thanks, I think i know what is going wrong.

Do you have a public web service that shows this problem. If so, I will make
sure that my fix works with that public service.