Skip to content

Instantly share code, notes, and snippets.

@zubairov
Created December 21, 2016 09:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zubairov/08d5a49e7200172541891a18fe823b5f to your computer and use it in GitHub Desktop.
Save zubairov/08d5a49e7200172541891a18fe823b5f to your computer and use it in GitHub Desktop.
var soap = require('soap');
(function () {
'use strict';
describe('Given', function () {
let client = null;
let descriptor = null;
beforeEach(function (done) {
// Here we assume the http://www.webservicex.com/globalweather.asmx?wsdl is accessible
soap.createClient('http://www.webservicex.com/globalweather.asmx?wsdl', function(err, result) {
expect(err).toBeNull();
client = result;
descriptor = result.describe();
expect(descriptor).not.toBeNull();
done();
});
});
it('Global Weather Service is accessible', function() {
expect(client).not.toBeNull();
expect(descriptor).not.toBeNull();
});
it('We have a GlobalWeather Service with 2 ports', function() {
expect(descriptor.GlobalWeather).toBeTruthy();
expect(Object.keys(descriptor.GlobalWeather)).toEqual(['GlobalWeatherSoap', 'GlobalWeatherSoap12']);
// Apparently only SOAP 1.1 and SOAP 1.2 bindings are supported by ``soap``
});
it('GlobalWeatherSoap12 port has 2 methods', function() {
expect(descriptor.GlobalWeather.GlobalWeatherSoap12).toBeTruthy();
expect(Object.keys(descriptor.GlobalWeather.GlobalWeatherSoap12)).toEqual(['GetWeather', 'GetCitiesByCountry']);
});
it('GlobalWeatherSoap12 port has 2 methods', function() {
expect(descriptor.GlobalWeather.GlobalWeatherSoap12).toBeTruthy();
expect(Object.keys(descriptor.GlobalWeather.GlobalWeatherSoap12)).toEqual(['GetWeather', 'GetCitiesByCountry']);
});
it('GetWeather operation has input and output', function() {
expect(descriptor.GlobalWeather.GlobalWeatherSoap12.GetWeather).toBeTruthy();
expect(Object.keys(descriptor.GlobalWeather.GlobalWeatherSoap.GetWeather)).toEqual(['input','output']);
expect(JSON.stringify(descriptor.GlobalWeather.GlobalWeatherSoap.GetWeather.input)).toEqual('{"CityName":"s:string","CountryName":"s:string"}');
});
});
})();
@vincenzo-mazzotta
Copy link

Please, could you create an example with ca cert and authorization username and password ?
A lot of methods doesn't work in https with ca cert and wsdl header username and password.
I tried to inject https module by code, but it's impossible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment