+ Start a Discussion
sravanisravani 

Urgent:Interaction of RPC based wsdl from salesforce

Hi all,

   i am new to webservices.i want to write sample rpc based wsdl class. please send me the sample code for this. wsdl class.Any one can u please help me .

 

Thanks in advance.

anu.......

 

sdetweilsdetweil

i don't understand your question.

 

you can create a wsdl outside sf, then use that to build both sender and receiver, or you can code an apex class with the webservice attribute, and generate the wsdl from that, which would be used to create the receiver.

 

here is a tiny sample apex webservice class for the second approach

 

global class MyWebService {

    // A class to accept an array of input records (e.g. product/amount combinations)
    global class myInputs{
        webservice Id productId;
        webservice Double amount;
    }

    // A class to send back as an output to PHP
    global class myOutputs{
        webservice String errorMessage;
        webservice Boolean success;
        webservice List<myInputs> inputs;
        webservice Id contactId;
    }

    // The actual web service method we will call
    webservice static myOutputs myMethod(Id contactId, List<myInputs> inputs){

        /*
        * Write a bunch of code here to do all kinds of stuff.
        */

        myOutputs output = new myOutputs();
            output.errorMessage = 'No errors here.';
            output.success = true;
            output.inputs = inputs;
            output.contactId = contactId;
        return output;

    }
}