I have a webservice utilizing API's in to an application.
I want to call this service and load the returned information onto my aspx page.
right now i am not getting any errors in my code...
but i am not getting any results either.
So
1. How to i implement an alert type function in my code to see what values are coming in?
2. Can anyone see what i am doing wrong in the code?
Thanks in advance,
Expand|Select|Wrap|Line Numbers
- <%@ Import Namespace="CFE_SW" %>
- <%@ Import Namespace="System.Web" %>
- <%@ Import Namespace="System.Xml" %>
- <%@ Import Namespace="System.Web.Services" %>
- <%@ Import Namespace="System.Net" %>
- <%@ Import Namespace="System.IO" %>
- <html xmlns="http://www.w3.org/1999/xhtml">
- <script language="C#" runat="server">
- CFE_SW.SW_API sw = new SW_API();
- public string app;
- public string sQuery;
- public string client;
- public string screenID;
- public string searchTxt;
- public string res = "notWorking";
- public void writeMe(string str)
- {
- Response.Write(str);
- }
- public string startXMLGet(string goUrl){
- HttpWebResponse webScraper = getWebResponse(goUrl);
- string xResponse = getWebSource(webScraper);
- return xResponse;
- }
- private HttpWebResponse getWebResponse(string url)
- {
- HttpWebRequest webSender = (HttpWebRequest)System.Net.HttpWebRequest.Create(url);
- webSender.Method = "GET";
- HttpWebResponse webScraper;
- try
- {
- webScraper = (HttpWebResponse)webSender.GetResponse();
- }
- catch (Exception e)
- {
- webScraper = null;
- }
- return (webScraper);
- } //end getWebResponse
- private string getWebSource(HttpWebResponse webResource)
- {
- string webPage = "";
- if (webResource != null) //if there was an earlier error then this value could be null..
- {
- StreamReader webResults = new StreamReader(webResource.GetResponseStream());
- webPage = webResults.ReadToEnd();
- webResults.Close();
- webResource.Close();
- }
- return (webPage);
- }//end getWebSource
- protected void Page_Load()
- {
- app = Request.QueryString["app"];
- sQuery = Request.QueryString["sQuery"];
- client = Request.QueryString["client"];
- screenID = Request.QueryString["screenID"];
- searchTxt = client + " " + sQuery + " " + screenID;
- search.Text = searchTxt;
- res = startXMLGet("http://<servername>/sw_api.asmx/getSearchResultsClient?app=" + app + "&sQuery=" +sQuery+ "&client=" + client + "&screenID=" + screenID);
- //res = sw.getSearchResultsClient(app, sQuery, client, screenID);
- }
- </script>
- <head>
- <meta http-equiv="Content-Language" content="en-us"/>
- <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
- <title>KM Results</title>
- </head>
- <!-- <body id="webServiceCallerBody" style="behavior:url(webservice.htc)" > -->
- <body>
- <form id="Form1" runat="server">
- <table border="0" width="100%">
- <tr>
- <td height="43" valign="top"><font size="4" face="Arial">Knova Search
- Results</font></td>
- <td align="right" valign="top"><font face="Arial">Search Text</font>
- <asp:TextBox TextMode="SingleLine" id="search" Runat="server" size="50"></asp:TextBox></td>
- </tr>
- </table>
- <table>
- <tr>
- <td><% Response.Write(res); %></td>
- </tr>
- </table>
- </form>
- </body>