Created
December 21, 2016 09:57
-
-
Save zubairov/08d5a49e7200172541891a18fe823b5f to your computer and use it in GitHub Desktop.
This file contains 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
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"}'); | |
}); | |
}); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.