I made the follow codes to call a web service data output and it worked. The problem is when I activate the api key on the web software and this key is generated, to call the web service and need to make a api client to request this through an httpRequest, but my problem whenever I run it it says "The remote server returned an error: (404) Not Found." do you have any idea? I have my whole code pasted bellow.
Thanks you very much in advance
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace DisplayDataInformation
{
public partial class DisplayDataInformation : Form
{
public DisplayDataInformation()
{
InitializeComponent();
}
private void Submit(object sender, EventArgs e)
{
localhost.Dashboard proxy = new localhost.Dashboard();
localhost.ProjectMetaData[] pm = proxy.GetAllProjectMetaData();
const string URL = "http://localhost/myProgram/";
const string apiKey = "d26b15b5-e336-48de-9142-939c0e639e8f";
const string Id = "Id";
const string Pass = "pass";
System.Net.HttpWebRequest myHttpWReq;
System.Net.HttpWebResponse myHttpWResp;
//myHttpWReq.ContentLength = 0;
// Make a web request to the web service
myHttpWReq = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(BLUEURL + "http://localhost/myProgram/Dashboard.asmx" + Id + Pass + apiKey);
myHttpWReq.Method = "Get";
// Get the response of the web service
myHttpWResp = (System.Net.HttpWebResponse)myHttpWReq.GetResponse();
if (myHttpWResp.StatusCode == System.Net.HttpStatusCode.OK)
{
//Create an XML reader to parse the response
System.Xml.XmlReader reader = System.Xml.XmlReader.Create(myHttpWResp.GetResponseStream());
}
//set an string output to the windows form
StringBuilder sb = new StringBuilder();
foreach (localhost.ProjectMetaData value in pm)
{
sb.AppendLine(value.ProjectTitle + " - "
+ value.ProjectID + " - "
+ value.PublishStatus );
// sb.AppendLine("\r\n\t");
}
label1.Text = sb.ToString();
}
}
}