title: Accessing SOAP services with Google Apps Script
body: <p>I'm trying to use Google Apps Scripts to call a SOAP service call, and I've been trying to tinker with a number of ways to get a response; however, I keep getting an error.  I've defaulted to trying to send an exact copy of a message stored in my spreadsheet that I know works through another service... still no luck.  Here's the Apps Script Code:</p>
  
  <pre><code>function getVesselSummaryXMLStringFromName() {
    var wsdl = SoapService.wsdl("http://cgmix.uscg.mil/xml/PSIXData.asmx?WSDL");
    Logger.log(wsdl.getServiceNames());
  
    var uscgService = wsdl.getPSIXData();
  
    var sheet = SpreadsheetApp.getActiveSheet();
  
    //Get working SOAP message
    var envelope = sheet.getRange("D1:D1").getValues();
  
    Logger.log(envelope);
  
      var result = uscgService.getenvelope;
      Logger.log(result);
    }
  </code></pre>
  
  <p>The SOAP message I'm sending that works through <a href="http://www.soapclient.com/soapclient" rel="nofollow">http://www.soapclient.com/soapclient</a> is:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;&lt;SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://cgmix.uscg.mil" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" &gt;&lt;SOAP-ENV:Body&gt;&lt;tns:getVesselSummaryXMLString xmlns:tns="http://cgmix.uscg.mil"&gt;&lt;tns:VesselID&gt;&lt;/tns:VesselID&gt;&lt;tns:VesselID&gt;&lt;/tns:VesselID&gt;&lt;tns:VesselName&gt;Atlantic Salvor&lt;/tns:VesselName&gt;&lt;tns:VesselName&gt;&lt;/tns:VesselName&gt;&lt;tns:CallSign&gt;&lt;/tns:CallSign&gt;&lt;tns:CallSign&gt;&lt;/tns:CallSign&gt;&lt;tns:VIN&gt;&lt;/tns:VIN&gt;&lt;tns:VIN&gt;&lt;/tns:VIN&gt;&lt;tns:HullNum&gt;&lt;/tns:HullNum&gt;&lt;tns:HullNum&gt;&lt;/tns:HullNum&gt;&lt;tns:Flag&gt;&lt;/tns:Flag&gt;&lt;tns:Flag&gt;&lt;/tns:Flag&gt;&lt;tns:Service&gt;&lt;/tns:Service&gt;&lt;tns:Service&gt;&lt;/tns:Service&gt;&lt;tns:BuildYear&gt;&lt;/tns:BuildYear&gt;&lt;tns:BuildYear&gt;&lt;/tns:BuildYear&gt;&lt;/tns:getVesselSummaryXMLString&gt;&lt;/SOAP-ENV:Body&gt;&lt;/SOAP-ENV:Envelope&gt;
  </code></pre>