기록 없는 SOAPMessageV2 예

  • 릴리스 버전: Zurich
  • 업데이트 날짜 2025년 07월 31일
  • 소요 시간: 1분
  • 매개변수 없이 SOAPMessageV2() 생성자를 사용하여 스크립트에서 SOAP 메시지 전체를 정의할 수 있습니다.

    이 생성자를 사용하는 경우 엔드포인트 및 SOAP 작업을 제공해야 합니다. 이 예시에서 스크립트는 빈 SOAP 메시지를 만들고 인시던트 기록을 삽입하는 데 필요한 값을 설정합니다.

    var s = new sn_ws.SOAPMessageV2(); //create an empty SOAP message
    s.setBasicAuth('admin','admin');
    s.setSOAPAction('http://www.service-now.com/incident/insert'); //set the SOAP action to perform
    s.setEndpoint('http://<instance>.service-now.com/incident.do?SOAP'); //set the web service provider endpoint
    s.setRequestBody('<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:inc=\"http://www.service-now.com/incident\"><soapenv:Header/><soapenv:Body><inc:insert><short_description>Test Dynamic SOAP</short_description></inc:insert></soapenv:Body></soapenv:Envelope>');
    var response = s.execute();
    var xmldoc = new XMLDocument(response.getBody());
    var incident_sysid = xmldoc.getNodeText('//sys_id');