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

Newer Version Available

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

WebService メソッド

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