Newer Version Available
webservice のメソッド
Apex クラスメソッドは、カスタムの SOAP Web サービスコールとして公開できます。これにより、外部アプリケーションが Apex Web サービスを呼び出して、Salesforce のアクションを実行できます。これらのメソッドの定義には webservice キーワードを使用します。次に例を示します。
1global class MyWebService {
2 webservice static Id makeContact(String contactLastName, Account a) {
3 Contact c = new Contact(lastName = contactLastName, AccountId = a.Id);
4 insert c;
5 return c.id;
6 }
7}外部アプリケーションの開発者は、クラスの WSDL を生成して、webservice メソッドを含む Apex クラスに統合できます。Apex クラス詳細ページから WSDL を生成する手順は、次のとおりです。
- アプリケーションで、[設定] から、[クイック検索] ボックスに「Apex クラス」と入力し、[Apex クラス] を選択します。
- webservice メソッドを含むクラスの名前をクリックします。
- [WSDL の作成] をクリックします。