You need to sign in to do that
Don't have an account?
Web Service WSDL: some classes not being defined in generated WSDL
Hi there,
I'm working on making a web service for a client and I'm running into a few issues around some classes I have defined not showing up in the WSDL.
I have an element, Entity, which can be many things (Artist, Company, Contract...). The client wants to receive and send Entity objects, but objects will have different properties depending on whath they're sending.
I came up with the following...
global virtual class Entity { } global class Assignment extends Entity { webservice String integrationID; webservice Date startDate; webservice Date endDate;
....
} global class Artist extends Entity { webservice String integrationID; webservice String salutation; webservice String lastName; webservice String firstName; .... } global class GetUpdatedEntitiesResponse { webservice List<SynchOperation> synchOperation; } global class SynchOperation { webservice String synchID; webservice Entity entity; webservice Entity oldEntity; } webservice static GetUpdatedEntitiesResponse GetUpdatedEntities(Integer maxItems) { // Generate a List<SynchOperation> which include entity and oldEntity values;
// Since Artist and Assignment extend Entity, they can be created and safely assigned
// to SynchOperation.entity and SynchOperation.oldEntity
.... }
Everything above shows up defined in the WSDL except for Assignment and Artist. Naturally, the client is looking for definitions of these.
I've been Googling around but haven't had much luck. I'm not a SOAP guru, but the client needs it. I understand that there is a concept of inheritance/extension in SOAP, but have no idea what it actually looks like in a WSDL, or if SF accomdates for this.
It seems like SF's web service implementation values simplicity over complexity, so my guess is no?
Am I doing something wrong above, or does SF just not accomadate for this scenario?
I have a couple of solutions in mind, either make Entity this massive class which holds all the properties of all the objects it's supposed to represent, or get rid of SynchOpertaion.entity and oldEntity, and replace it with a series of hard coded nodes, ex. SynchOperation.artist, SynchOperation.oldArtist, SynchOperation.assignment, SynchOperation,oldAssignment, etc.
Thoughts?
Thanks for your help!
I got an official response from Sales Force developer support, SalesForce currently does not support any kind of SOAP inheritance.
Created an Idea for this, vote if you'd like to see it added: https://sites.secure.force.com/success/ideaView?id=08730000000bYanAAE
All Answers
Can you pls post the genearted wsdl??
Sure...
And here's the SynchWebServices class, edited for brevity and with some dummy test code in place that will eventually be replaced with some SOQL queries and such...
Anybody have any ideas?
I think SF just doesn't support inheritance via SOAP WSDLs. I've done some Googling around, and I've seen posts from other people who have had problems going the other direction, using WSDL to Apex. WSDLs that have inheritance features in them don't seem to be parsed correctly, and details around child elements/objects don't make it into the class.
http://boards.developerforce.com/t5/Apex-Code-Development/Generate-apex-code-from-WSDL-inheritance-problem/td-p/233361
http://forums.sforce.com/t5/forums/forumtopicprintpage/board-id/apex/message-id/33241/print-single-message/false/page/1
If inheritance doesn't work going from WSDL to Apex, then it would be consistent if inheritance wasn't supported going from Apex to WSDL.
I got an official response from Sales Force developer support, SalesForce currently does not support any kind of SOAP inheritance.
Created an Idea for this, vote if you'd like to see it added: https://sites.secure.force.com/success/ideaView?id=08730000000bYanAAE