I’m stuck on one small problem that stop development for a feature I’m trying to implement.
I currently have a WCF Web Service created with the following code:
[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);
}
}
Main Method:
var ip = getIP();
Uri baseAddr = new Uri("http://"+ip+":60185/Sinvise");
ServiceHost localHost = new ServiceHost(typeof(SinviseService), baseAddr);
Console.WriteLine("Current System IP: " + getIP());
try
{
Process.Start(baseAddr.AbsoluteUri);
localHost.AddServiceEndpoint(typeof(ISinvise), new BasicHttpBinding(), "SinviseService");
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();
}
The application sets up the web service to be called in my application, now what I want to do is use a HTML page to call the operations. They’re simple operations that pass values across to the application.
Now I know that HTML can’t do this on it’s own, and PHP won’t be an option on this end as it will require me to package a web server and PHP in my application deployment (which I can’t do as my application requires payment therefore no opensource software can be included).
I am having a problem using jQuery as it can not be used in a cross domain manner.
The webservice is not related to ASP.NET but I need something that will allow users of my software to be able to use the HTML page to make calls to the web service.
Thanks
If my understanding is correct and based on this:
Your service is in another domain, then do it the simplest way, create a REST service in your domain and then wrap the call to the external service
See this question
This is a walkthrough creating a REST service (without SVC file and this can be used in a ASP.Net or MVC app)
Datalist Delete Command Event implementation using Page Methods
This is a full application you can download that uses the REST service
http://sdrv.ms/LJJz1K
Example:
In the page