---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# SOAPMessageV2 MID サーバーの例

# SOAPMessageV2 MID サーバーの例 {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：2分

MID Server 経由で送信 SOAP メッセージを送信できます。
MID Server 経由でメッセージを送信することで、ファイアウォールの背後またはプライベートネットワーク内にあるエンドポイントにアクセスできます。MID Server 経由で送信される SOAP メッセージはすべて非同期になります。

    var requestBody;
    var responseBody;
    var status;
    var sm;
    try{
    	sm = new sn_ws.SOAPMessageV2("StockQuote", "GetQuote");  // Might throw exception if message doesn't exist or not visible due to scope
    	sm.setBasicAuth("admin","admin");
    	sm.setStringParameter("symbol", "NOW");
    	sm.setStringParameterNoEscape("xml_data","<data>test</data>");
    	sm.setMIDServer('mid_server_name');
    	response = sm.execute();//Might throw exception if http connection timed out or some issue with sending request itself because of encryption/decryption of password and stuff
     
    	response.waitForResponse(60);// In Seconds, Wait at most 60 seconds to get response from ECC Queue/Mid Server //Might throw exception timing out waiting for response in ECC queue
     
    	responseBody = response.haveError() ? response.getErrorMessage() : response.getBody();
    	status = response.getStatusCode();
    } catch(ex) {
    	responseBody = ex.getMessage();
    	status = '500';
    } finally {
    	requestBody = sm ? sm.getRequestBody():null;
    }
    gs.info("Request Body: " + requestBody);
    gs.info("Response: " + responseBody);
    gs.info("HTTP Status: " + status);


