Clase .NET de muestra - web_services - 23.1

Guía de servicios web de Spectrum

Product type
Portfolio
Integrate
Product family
Product
Spectrum > Web Services
Version
23.1
Language
Español (México)
Product name
Spectrum Technology Platform
Title
Guía de servicios web de Spectrum
First publish date
2007
ft:lastEdition
2024-02-07
ft:lastPublication
2024-02-07T18:09:34.894393

La siguiente clase .NET invoca el servicio web ValidateAddress. Se escribe en C# en Visual Studio 2010. Las implementaciones de clase proxy para los tipos de datos de servicio web ValidateAddressClient, requestRow, context, options y responseRow se generaron con el comando “Agregar referencia web” de .NET en Visual Studio. Es importante tener en cuenta que en este ejemplo deben proporcionarse las credenciales adecuadas o la llamada telefónica fallará.

using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Net; using System.Text; using ConsoleApplication1.ValidateAddress_Reference;  namespace Test {     class Program     {         static void Main(string[] args)         {             var validateClient = new ValidateAddress {Credentials = new NetworkCredential("admin", "admin")};              var address1 = new input_portAddress             {                 AddressLine1 = "1825B Kramer Lane",                 AddressLine2 = "Suite 100",                 PostalCode = "78758",                 City = "Austin",                 StateProvince = "Texas"             };              var address2 = new input_portAddress             {                 AddressLine1 = "100 Congress",                  PostalCode = "78701",                  City = "Austin",                  StateProvince = "Texas"             };              var addresses = new input_portAddress[2];             addresses[0] = address1;             addresses[1] = address2;              var options = new options {OutputCasing = OutputCasing.M};             output_portAddress[] results = validateClient.CallValidateAddress(options, addresses);              for (int i = 0; i < results.Length; i++)             {                 System.Console.WriteLine("Record " + (i+1) + ":");                 System.Console.WriteLine("AddressLine1=" + results[i].AddressLine1);                 System.Console.WriteLine("City=" + results[i].City);                 System.Console.WriteLine("StateProvince=" + results[i].StateProvince);                 System.Console.WriteLine("PostalCode=" + results[i].PostalCode + "\n");             }                          System.Console.Write("Press any key to continue...");             System.Console.ReadKey();         }     } }