Last active
March 19, 2021 02:42
-
-
Save circa10a/f6f7c9d8d5e4118e6cf2202262b2fddf to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const soapRequest = require('easy-soap-request'); | |
const fs = require('fs'); | |
// example data | |
const url = 'https://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php'; | |
const sampleHeaders = { | |
'user-agent': 'sampleTest', | |
'Content-Type': 'text/xml;charset=UTF-8', | |
'soapAction': 'https://graphical.weather.gov/xml/DWMLgen/wsdl/ndfdXML.wsdl#LatLonListZipCode', | |
}; | |
const xml = fs.readFileSync('test/zipCodeEnvelope.xml', 'utf-8'); | |
// usage of module | |
(async () => { | |
const { response } = await soapRequest({ url: url, headers: sampleHeaders, xml: xml, timeout: 1000 }); // Optional timeout parameter(milliseconds) | |
const { headers, body, statusCode } = response; | |
console.log(headers); | |
console.log(body); | |
console.log(statusCode); | |
})(); |
That's what I would expect from a GET request. You need to hit the /GetJob
endpoint I suspect. But I know nothing of this API. You would need to consult the maintainer or check for API consumption documentation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I keep getting the WSDL definition back:
<soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'></soap:binding>
<soap:operation soapAction='https://my-server.com:8482/ws/GetJob'></soap:operation>
<soap:body use='literal'></soap:body>
<soap:body use='literal'></soap:body>
<soap:address location='https://my-server.com:8482/ws/GetJob'></soap:address>
text/xml, text/html, image/gif, image/jpeg, *; q=.2, /; q=.2
Any idea what I could be doing wrong? It's driving me nuts. I got the SOAP envelope from SOAP UI - here is the example:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://www.northgate-is.com/proiv/webservices/types">
soapenv:Header/
soapenv:Body
typ:GetJob
<Authorization_ID>AUTHID</Authorization_ID>
</typ:GetJob>
</soapenv:Body>
</soapenv:Envelope>