Reputation: 6394
I'm trying to use jQuery to consume my Web service and just basically need the web service to call functions that's all.
The code I'm using in .NET is this:
[ServiceContract(Namespace = "http://Sinvise.Service/")]
public interface ISinvise
{
[OperationContract]
void Output(string value);
}
class SinviseService : ISinvise
{
second sec = new second();
public void Output(string value)
{
sec.message(value);
}
}
+
Uri baseAddr = new Uri("http://localhost:60185/Sinvise");
ServiceHost localHost = new ServiceHost(typeof(SinviseService), baseAddr);
try
{
Process.Start(baseAddr.AbsoluteUri);
localHost.AddServiceEndpoint(typeof(ISinvise), new WSHttpBinding(), "CalculatorService");
ServiceMetadataBehavior smb = new ServiceMetadataBehavior();
smb.HttpGetEnabled = true;
localHost.Description.Behaviors.Add(smb);
localHost.Open();
Console.WriteLine("Service initialized.");
Console.WriteLine("Press the ENTER key to terminate service.");
Console.ReadLine();
localHost.Close();
}
catch (CommunicationException ex)
{
Console.WriteLine("Oops! Exception: {0}", ex.Message);
localHost.Abort();
}
How would I be able to simply call the Output
web service?
Thanks
Upvotes: 0
Views: 329
Reputation: 13213
You can use an ajax request using .get()
Due to browser security restrictions, most "Ajax" requests are subject to the same origin policy; the request can not successfully retrieve data from a different domain, subdomain, or protocol. Script and JSONP requests are not subject to the same origin policy restrictions.
Upvotes: 2