Newer Version Available
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 を生成する手順は、次のとおりです。
- アプリケーションで、[設定] から をクリックします。
- webService メソッドを含むクラス名をクリックします。
- [WSDL の作成] をクリックします。