public async Task <Result> VerifyAsync(Address address) { var basicHttpBinding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); basicHttpBinding.Security.Transport.ClientCredentialType = HttpClientCredentialType.Basic; var endpointAddress = new EndpointAddress(new Uri("https://webservices.post.ch/IN_ADRCHECKERxV4xEXTERNE/V4-02-00")); var factory = new ChannelFactory <AddressChecker.ACHePortType>(basicHttpBinding, endpointAddress); factory.Credentials.UserName.UserName = "******"; factory.Credentials.UserName.Password = "******"; var serviceProxy = factory.CreateChannel(); try { var request = new AddressChecker.Input(new AddressChecker.AdressCheckerRequestType() { Names = address.Name, Street = address.Street, Town = address.City, HouseNbr = address.HouseNumber, Zip = address.PostalCode, Params = new AddressChecker.AdressCheckerRequestTypeParams() { CallUser = "******", MaxRows = "10", SearchLanguage = "1", SearchType = "1" } }); var response = (await serviceProxy.AdrCheckerExterneAsync(request)).AdressCheckerResponse; if (response.HasMoreRows || response.Rows == null || response.Rows.Count() != 1) { // TODO return(new Result() { IsValid = false }); } var responseRow = response.Rows[0]; return(new Result() { IsValid = responseRow.MatchUniqueness == "1" && responseRow.MatchType == "1" }); } finally { factory.Close(); } }
public System.Threading.Tasks.Task <AddressChecker.Output> AdrCheckerExterneAsync(AddressChecker.AdressCheckerRequestType AdressCheckerRequest) { AddressChecker.Input inValue = new AddressChecker.Input(); inValue.AdressCheckerRequest = AdressCheckerRequest; return(((AddressChecker.ACHePortType)(this)).AdrCheckerExterneAsync(inValue)); }
System.Threading.Tasks.Task <AddressChecker.Output> AddressChecker.ACHePortType.AdrCheckerExterneAsync(AddressChecker.Input request) { return(base.Channel.AdrCheckerExterneAsync(request)); }