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
dke01dke01 

WebService to return an array of arrays? Complex Types

I created a custom wrapper object as such:

 

global class DocumentWrapper {
public List<Attachment> attchments { get; set;}
public Document__c document{ get; set; }


public DocumentWrapper (){

attchments = new List<Attachment>();
document = new Document__c();
}
}

 

I want to return a document with all the related attachments.  The webservice returns a List of these DocumentWrapper objects.  I generate the WSDL and I can call it from .NET.

 

However the DocumentWrapper object class that is generated in .NET has not fields in it, just an empty class?  Is this possible? What am I doing wrong?  I belive I remember someone saying force.com WSDLs cannot handel returning arrays?

 

Are there any work arounds to get Complex types to work in Apex web service calls.  Will manually editing the WSDL work?

 

Message Edited by dke01 on 01-27-2010 02:31 PM
Best Answer chosen by Admin (Salesforce Developers) 
magdielhfmagdielhf

Hi there,

 

I had the same situation, and this is the way it works for me,

 

http://salesforcesource.blogspot.com/2009/12/flex-rich-clients-and-complex-logics.html

 

bon apetit ;) 

All Answers

magdielhfmagdielhf

Hi there,

 

I had the same situation, and this is the way it works for me,

 

http://salesforcesource.blogspot.com/2009/12/flex-rich-clients-and-complex-logics.html

 

bon apetit ;) 

This was selected as the best answer
SuperfellSuperfell
you need fields marked with webservice scope, not public getters, this should be covered in the apex docs.
ShikibuShikibu

Well, I have been hunting, and I sure couldn't find this documented.

 

But Simon's hint got me going. Here's how your code should look:

 

 


global class DocumentWrapper {
webservice List attchments;
webservice Document__c document;


public DocumentWrapper (){

attchments = new List();
document = new Document__c();
}
}

 

 

 

dke01dke01
Thank you yes I did get it working from looking at magdielhf example