ABAIXO o erro:
Esta coleção já contém um endereço com o esquema http. Pode haver no máximo um endereço por esquema nesta coleção.
Nome do parâmetro: item
Pagina do erro: http://leonecostaroc...oEnfermaria.svc
CODIGOS:::
INTERFACE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
// NOTE: If you change the interface name "IService" here, you must also update the reference to "IService" in Web.config.
[ServiceContract]
public interface IMeuServicoEnfermaria
{
[OperationContract]
double CalcularIMC(IMC imc_);
[OperationContract]
string EstadoPaciente(TriagemCardicaTemperatura tct_);
}
// Use a data contract as illustrated in the sample below to add composite types to service operations.
[DataContract]
public class IMC
{
private double altura;
private double peso;
private double resultado;
[DataMember]
public double Altura
{
get { return altura; }
set { altura = value; }
}
[DataMember]
public double Peso
{
get { return peso; }
set { peso = value; }
}
[DataMember]
public double Resultado
{
get { return resultado; }
set { resultado = value; }
}
}
[DataContract]
public class TriagemCardicaTemperatura
{
private int batimentoCardiaco;
private double temperatura;
private String resultadoTriagem;
[DataMember]
public int BatimentoCardiaco
{
get { return batimentoCardiaco; }
set { batimentoCardiaco = value; }
}
[DataMember]
public double Temperatura
{
get { return temperatura; }
set { temperatura = value; }
}
[DataMember]
public String ResultadoTriagem
{
get { return resultadoTriagem; }
set { resultadoTriagem = value; }
}
}
CODIGO QUEIMPLEMENTA A CLASSE
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
// NOTE: If you change the class name "Service" here, you must also update the reference to "Service" in Web.config and in the associated .svc file.
public class MeuServicoEnfermaria : IMeuServicoEnfermaria
{
#region METODO CALCULAR IMC IService Members
/// <summary>
/// Este metodo calcula o IMC no qual utiliza a formula peso divido po altura vezes altura
/// </summary>
/// <param name="imc_">este medo recebe propriedades peso e altura do objeto imc_</param>
/// <returns></returns>
double IMeuServicoEnfermaria.CalcularIMC(IMC imc_)
{
try
{
imc_.Resultado = imc_.Peso / (imc_.Altura * imc_.Altura);
}
catch (Exception )
{
imc_.Resultado = 0;
}
return imc_.Resultado;
}
#endregion
#region IService Members
string IMeuServicoEnfermaria.EstadoPaciente(TriagemCardicaTemperatura tct_)
{
try
{
if ( (tct_.BatimentoCardiaco < 120 ) && (tct_.Temperatura < 37.00))
{
tct_.ResultadoTriagem = "Você está Saudavel";
}
if ((tct_.BatimentoCardiaco >= 120) && (tct_.Temperatura < 37.00))
{
tct_.ResultadoTriagem = "Vá para o Cardiologista";
}
if ((tct_.BatimentoCardiaco < 120) && (tct_.Temperatura >= 37.00))
{
tct_.ResultadoTriagem = "Vá para o Ambulatorio";
}
}
catch (Exception )
{
tct_.ResultadoTriagem = "Vá para o Pronto Socorro";
}
return tct_.ResultadoTriagem;
}
#endregion
}
CODIGO QUE CONSOME
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnCalcIMC_Click(object sender, EventArgs e)
{
//INSTACIO A CLASSE DO SERVICO
ServicoWCF.IMC imc = new ServicoWCF.IMC();
imc.Altura = double.Parse(this.txtAltura.Text);
imc.Peso = double.Parse(this.txtPeso.Text);
ServicoWCF.MeuServicoEnfermariaClient clienteWCF = new ServicoWCF.MeuServicoEnfermariaClient();
double valorIMC = clienteWCF.CalcularIMC(imc);
if (valorIMC < 20.0)
{
lblIMC.Text = valorIMC.ToString() + " - Abaixo do Peso";
}
if (valorIMC > 20.0 && valorIMC < 25.0)
{
lblIMC.Text = valorIMC.ToString() + " - Peso Ideal";
}
if (valorIMC > 25.0 && valorIMC < 30.0)
{
lblIMC.Text = valorIMC.ToString() + " - Sobrepeso";
}
if (valorIMC > 30.0 && valorIMC < 35.0)
{
lblIMC.Text = valorIMC.ToString() + " - Obesidade Moderada";
}
if (valorIMC > 35.0 && valorIMC < 40.0)
{
lblIMC.Text = valorIMC.ToString() + " - Obesidade Severa";
}
if (valorIMC > 40.0 && valorIMC < 50.0)
{
lblIMC.Text = valorIMC.ToString() + " - Obesidade Mórbida";
}
if (valorIMC > 50.0)
{
lblIMC.Text = valorIMC.ToString() + " - Super Obesidade";
}
//lblIMC.Text = clienteWCF.CalcularIMC(imc).ToString();
}
protected void btnAvaliarEstado_Click(object sender, EventArgs e)
{
ServicoWCF.TriagemCardicaTemperatura triagem = new ServicoWCF.TriagemCardicaTemperatura();
triagem.Temperatura = double.Parse(this.txtTP.Text);
triagem.BatimentoCardiaco = int.Parse(this.txtBC.Text);
ServicoWCF.MeuServicoEnfermariaClient clienteEstadoPAcienteWS = new ServicoWCF.MeuServicoEnfermariaClient();
lblEstadoPaciente.Text = clienteEstadoPAcienteWS.EstadoPaciente(triagem);
}
}