• Adapti01
  • 0 Points
  • Member since 2009

  • Chatter
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
  • 1



Whole day I've tried to Connect from a Flex app to a salesforce webservice. I started with a simple HelloWorld with parameters of default types (String, Integer, ...)


Now I want to send a model (MyContact) to the apex webservice and then return MyContact.firstName and MyContact.lastName.


Here my apex webservice:


global class HelloWorldWebservice{

    //MyContact model
    global class MyContact
        webservice String lastName;
        webservice String firstName;

    WebService static String SayHelloName(String name){
        return 'Hello '+name+ '!';
    WebService static String SayHelloContact(MyContact mycontact){
        return 'Hello '+contact.firstName+ ' ' +contact.lastName+'!';


To call the SayHelloName method in Flex I used the following:


var object:Parameter = new Parameter("name", helloInput.text); var params:Array = [object];


force.execute("HelloWorldWebservice","SayHelloName",params,new AsyncResponder(SayHelloNameSuccess, faultResponder));


Above works perfect, but my next challenge is to send a model MyContact to the webservice, this is what I have at the moment:


var firstName:Parameter = new Parameter("firstName","Kevin"); var lastName:Parameter = new Parameter("lastName","Neuteleers");


var myContactFields:Array = [firstName, lastName];


var myContact:Parameter = new Parameter("mycontact", myContactFields);

var params:Array = [myContact];


force.execute("HelloWorldWebservice","SayHelloContact",params,new AsyncResponder(SayHelloNameSuccess, faultResponder));


Hopefully there's someone who knows an answer and wants to help me.