有谁做过Alexa  web服务啊,我研究几天了见鬼了
代码页
web服务名称alexa
=========================================================================================
alexa.UrlInfo url_info=new WebApplication1.alexa.UrlInfo();
alexa.AWSAlexa cla=new WebApplication1.alexa.AWSAlexa(); url_info.AWSAccessKeyId="xxxxxxxxxxxxxxxxxxxx";
url_info.Signature="xxxxxxxxxxxxxxxxxxxxxxxx";
url_info.Timestamp="2006-01-12T00:22:24.421A"; alexa.UrlInfoRequest url_re=new WebApplication1.alexa.UrlInfoRequest(); url_re.Url="xxx.com";
url_re.ResponseGroup="TrafficData";

url_info.Shared=url_re; alexa.UrlInfoResponse result=new UrlInfoResponse();
result=cla.UrlInfo(url_info);

                           UrlInfoResult ur=new UrlInfoResult();
ur=result.UrlInfoResult;

Alexa al=new Alexa();
al=ur.alexa;
string type=al.TrafficData.DataUrl.type;
Response.Write(type);
========================================================================================
“/WebApplication1”应用程序中的服务器错误。
--------------------------------------------------------------------------------未将对象引用设置到对象的实例。 
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: System.NullReferenceException: 未将对象引用设置到对象的实例。源错误: 
行 59: 
行 60:  Alexa al=new Alexa();
行 61:  al=ur.alexa;
行 62:  string type=al.TrafficData.DataUrl.type;
行 63: // string type=ur.Request.IsValid;
 源文件: e:\wwwroot\webapplication1\webform2.aspx.cs    行: 61 堆栈跟踪: 
[NullReferenceException: 未将对象引用设置到对象的实例。]
   WebApplication1.WebForm2.databind() in e:\wwwroot\webapplication1\webform2.aspx.cs:61
   WebApplication1.WebForm2.Page_Load(Object sender, EventArgs e) in e:\wwwroot\webapplication1\webform2.aspx.cs:31
   System.Web.UI.Control.OnLoad(EventArgs e) +67
   System.Web.UI.Control.LoadRecursive() +35
   System.Web.UI.Page.ProcessRequestMain() +731 

解决方案 »

  1.   

    从错误信息看,是空引用,那就是ur.alexa可能是不存在的,没有赋值或被实例化,而ur=result.UrlInfoResult;,所以估计result.UrlInfoResult没有取到内容,也就是result=cla.UrlInfo(url_info);可能没取到内容所以从后面推,可能是前面造成的,所以从result=cla.UrlInfo(url_info);开始跟踪,看是否真的取到内容了,然后逐步到下面
      

  2.   

    我在ur=result.UrlInfoResult处设置了一个断点,调试时显示result.UrlInfoResult=<未定义的值>
    我不明白的是为什么会没取到值呢?错在哪里呢
    是不是更以下参数有关呢,我该怎么办?
    url_info.AWSAccessKeyId="xxxxxxxxxxxxxxxxxxxx";
    url_info.Signature="xxxxxxxxxxxxxxxxxxxxxxxx";
    url_info.Timestamp="2006-01-12T00:22:24.421A";
    url_re.Url="xxx.com";
    url_re.ResponseGroup="TrafficData";