早期アクセス
Qntrlで受信SOAP Webサービスを作成するには:
True
設定済みの要求パラメーターと応答パラメーターのみが許可されます。受信要求に余分なパラメーターが含まれている場合、その要求は拒否されます。
設定されていない出力パラメーターは応答から除外されます。
要求内の操作名は、WSDLで定義されている名前と完全に一致している必要があります。一致しない場合、要求は失敗します。
False
WSDLで定義されていないパラメーターが含まれている場合でも、システムは外部要求を受け付けます。
ただし、設定済みのパラメーターには検証ルールが引き続き適用されます。
Qntrlは、エンドポイントURL、操作名、設定済みの要求/応答パラメーターに基づいてWSDLを自動生成します。これらの設定を変更すると、WSDLも自動的に更新されます。
スクリプトでは、操作名、要求パラメーター、要求ヘッダー、SOAPペイロード全体、エンドポイントURLにアクセスして処理できます。
レスポンスパラメーター、レスポンスヘッダーパラメーター、フォールトコード、フォールトメッセージを定義できます。または、XMLレスポンス全体を定義できます。
エラーが発生した場合は、クライアントに返すエラーコードとメッセージを定義できます。
Qntrlでは、インバウンドSOAP APIで関数リソースを構築するために、次の言語に対応しています。
JavaScript(ネイティブまたはCodexエンジン)
その他のクラウド関数– Python、Java、Node.jsに対応しています。
例(JavaScript):入力パラメーターの読み取りとレスポンスの書き込み
/*** @param {SOAPRequest} soapRequest* @param {SOAPResponse} soapResponse*/function execute(soapRequest, soapResponse) {try {const operationName = soapRequest.getOperationName();const endpointUri = soapRequest.getEndpointUri();const requestParams = soapRequest.getRequestParams();const requestHeaders = soapRequest.getHeaderParams();console.log('SOAP Request Received:');console.log('Operation:', operationName);console.log('Endpoint URI:', endpointUri);console.log('Request Params:', JSON.stringify(requestParams));console.log('Request Headers:', JSON.stringify(requestHeaders));// === Business logic here ===// (For now we're mocking processing)const processedParam1 = 'processed_value_1';const processedParam2 = 'processed_value_2';// Add response headerssoapResponse.addResponseHeaderParam('server', 'InternalGateway');soapResponse.addResponseHeaderParam('request-id', requestHeaders?.['request-id'] || 'N/A');soapResponse.addResponseHeaderParam('timestamp', new Date().toISOString());// Add response paramssoapResponse.addResponseParam('result_code', 'SUCCESS');soapResponse.addResponseParam('processed_param1', processedParam1);soapResponse.addResponseParam('processed_param2', processedParam2);} catch (e) {console.error(
'Error while processing SOAP request', e);soapResponse.setFaultCode(500);soapResponse.setFaultMessage(e.message);}}
例(Java):入力パラメーターの読み取りとレスポンスの書き込み
import com.zoho.cloud.function.Context;import com.zoho.cloud.function.basic.*;import org.json.JSONObject;public class SampleSOAPFunction implements ZCFunction {@Overridepublic void runner(Context context, BasicIO basicIO) throws Exception {// Read incoming request parametersString operationName = basicIO.getParameter('operation_name').toString();String requestParams = basicIO.getParameter('request_params').toString();String requestHeaders = basicIO.getParameter('request_headers').toString();String endpointURI = basicIO.getParameter('endpoint_uri').toString();// Prepare ResponseJSONObject responseJSON = new JSONObject();try {JSONObject responseParams = new JSONObject();responseParams.put('customer_id', 'CUST12345');responseParams.put('order_id', 'ORD78910');responseJSON.put('response_params', responseParams);JSONObject responseHeaders = new JSONObject();responseHeaders.put('client-id', 'WEBPORTAL-001');responseHeaders.put('request-id', 'REQ-20251105-ALPHA99');responseJSON.put('response_header_params', responseHeaders);} catch (Exception e) {// The final XML response will have only fault code and fault message.responseJSON.put('fault_code', '500');responseJSON.put('fault_message', e.getMessage());}// From above constructed response parameter and response header, final response XML will be automatically constructed and written to client.basicIO.write(responseJSON.toString());context.log('Response Sent: ' + responseJSON.toString());}}
メソッド:任意のHTTPメソッド(例:GET)
URL:https://core.qntrl.com/webservice/soap/<org-id>/<source_endpoint>?WSDL
認証(要求ヘッダーに追加する必要があります)。
メソッド:任意のHTTPメソッド(例:POST)
URL:https://core.qntrl.com/webservice/soap/<org-id>/<source_endpoint>
認証(要求ヘッダーに追加する必要があります)。
OAuthトークン
ヘッダー形式:Authorization: Zoho-oauthtoken <access_token>
必要なOAuthスコープ:ws_soapinbound.UPDATE
APIキー
ヘッダー形式:Authorization: Bearer <api_key>
基本認証
Authorization: Basic <base64-encoded username:password>
本文:本文には未加工のXMLリクエストデータを含める必要があります。
<soapenv:Envelope
xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'
xmlns:ord='https://98173384.core.localqntrlhost.com/webservice/98173384/orderManagement'>
<soapenv:Header>
<ord:AuthHeader>
<ord:companyName>Zoho Corp</ord:companyName>
</ord:AuthHeader>
</soapenv:Header>
<soapenv:Body>
<ord:PlaceOrder>
<ord:OrderID>12345</ord:OrderID>
<ord:CustomerID>98765</ord:CustomerID>
<ord:ProductID>10111</ord:ProductID>
<ord:Quantity>3</ord:Quantity>
<ord:OrderDate>2025-03-28</ord:OrderDate>
</ord:PlaceOrder>
</soapenv:Body>
</soapenv:Envelope>
設定パネルから、個々のSOAPリクエストの有効化/無効化を管理できます。
次の順に(設定)→[Webサービス]→[インバウンド]→[SOAP]を選択します。
左側のパネルの[リソース]セクションで、SOAPメッセージを見つけます。
メッセージ名の横にある切り替えボタンで有効化または無効化します。
SOAPリクエストを削除するには:
次の順に(設定)→[Webサービス]→[インバウンド]→[SOAP]を選択します。
削除するメッセージを選択します。
メッセージ詳細ページの右上にある削除アイコンをクリックします。