この文章は Salesforce 機械翻訳システムを使用して翻訳されました。詳細はこちらをご参照ください。
英語に切り替える

Newer Version Available

This content describes an older version of this product. View Latest

WebService メソッド

Apex クラスメソッドは、カスタムの SOAP Web サービスコールとして公開できます。これにより、外部アプリケーションが Apex Web サービスを呼び出して、Salesforce のアクションを実行できます。これらのメソッドの定義には webService キーワードを使用します。次に例を示します。
1swfobject.registerObject("clippy.codeblock-0", "9");
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17global class MyWebService {
18    webService static Id makeContact(String lastName, Account a) {
19        Contact c = new Contact(lastName = 'Weissman', AccountId = a.Id);
20        insert c;
21        return c.id;
22    }
23}
外部アプリケーションの開発者は、クラスの WSDL を生成して、webService メソッドを含む Apex クラスに統合できます。Apex クラス詳細ページから WSDL を生成する手順は、次のとおりです。
  1. アプリケーションで、[設定] から [開発] | [Apex クラス] をクリックします。
  2. webService メソッドを含むクラス名をクリックします。
  3. [WSDL の作成] をクリックします。