예제 #1
0
파일: Program.cs 프로젝트: pepipe/ISEL
        static void Main(string[] args)
        {
            EndpointAddress addr = new EndpointAddress("http://localhost:8080/ServiceOla");
            BasicHttpBinding bind = new BasicHttpBinding();
            //WSHttpBinding bind = new WSHttpBinding();
            //bind.MessageEncoding = WSMessageEncoding.Mtom;
            //bind.Security.Mode = SecurityMode.None;

            IChannelFactory<IServiceOla> cfact = new ChannelFactory<IServiceOla>(bind);
            IServiceOla prx = cfact.CreateChannel(addr);

            Console.WriteLine(prx.olaSimples("Mundo"));
            Pessoa pes = new Pessoa();

            pes.FirstName = "Luis";
            pes.LastName = "Assunção";
            Console.WriteLine(prx.olaPessoa(pes));
            pes = prx.getPessoa("Luis", "Assunção");
            Console.WriteLine(pes.FirstName + " " + pes.LastName);
            //Console.WriteLine("state=" + prx.getState());
            //Console.WriteLine("novo valor?");
            //string line = Console.ReadLine();
            //prx.changeState(int.Parse(line));
            //Console.ReadLine();
            //Console.WriteLine("state="+prx.getState());
            try
            {
                //string[] res=prx.teste(new string[]{"AA","BB","CC"});
                string[] res = prx.teste(null);
                foreach (string s in res)
                    Console.WriteLine(s);
            }
            catch (FaultException<AppExceptionDetails> ex)
            {
                Console.WriteLine("Exception: "+ex.Detail.ErrorMessage);
                Console.WriteLine("Reason: "+ex.Reason.ToString());
            }

            Console.ReadLine();
        }
예제 #2
0
파일: Class1.cs 프로젝트: pepipe/ISEL
 public string olaPessoa(Pessoa pes)
 {
     return "Ola " + pes.FirstName + " " + pes.LastName;
 }
예제 #3
0
파일: Class1.cs 프로젝트: pepipe/ISEL
 public Pessoa getPessoa(string firstName, string lastName)
 {
     Pessoa pes = new Pessoa();
     pes.FirstName = firstName;  pes.LastName = lastName;
     return pes;
 }