我们要开发接口程序,IBM公司给的文档是这么写的:“接口格式采用基于HTTP的SOAP协议,以Web Service的方式进行同步通信。所有Web Service接口依据W3C组织颁布的WSDL为标准”
这块东西没学过,要求用C#做开发,学习时间是5天,我要找一些什么资料,给一些教程。
哪位大虾给点资料,给些教程,多谢了!!!!
邮箱是:[email protected]
这块东西没学过,要求用C#做开发,学习时间是5天,我要找一些什么资料,给一些教程。
哪位大虾给点资料,给些教程,多谢了!!!!
邮箱是:[email protected]
解决方案 »
- iis7下载文件提示404.0 - Not Found
- 求一完全开源的电子商务网站系统?急急急急急急急
- 计算报表中记录一共有多少条
- listbox中怎么默认选中?
- c#中求判断字符串中是否有逗号并且把有逗号的字符串用双引号括起来的代码
- 请教正则表达式问题(不用.net验证控件)
- System.Runtime.InteropServices.COMException 没有注册类别
- 是否可以实现这样的功能,每次开机自动删除特定文件,这将大大提高网管效率啊!!!
- 非常辣手的问题,有关底层的程序。。。。。。。。。。。:(
- WinForm中怎么把在另个一个窗口传过来的值赋组合框
- 如何用JS获得自定义控件中的控件ID(页面中动态加载的多个自定义控件)
- 问:哪里有webapplication用的treeview控件或源码?C#,vs2005
try
{
httpRequest=(HttpWebRequest)WebRequest.Create(this.cbox_url.Text); }
catch(SystemException se)
{
MessageBox.Show(this,se.Message,"Read WSDL Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
httpRequest.Method="GET";
HttpWebResponse httpResponse;
try
{
httpResponse=(HttpWebResponse)httpRequest.GetResponse();
}
catch(SystemException se)
{
MessageBox.Show(this,se.Message,"Read WSDL Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
ServiceDescription wsdl;
try
{
wsdl=ServiceDescription.Read(httpResponse.GetResponseStream());
}
catch(SystemException se)
{
MessageBox.Show(this,se.Message,"Read WSDL Error",MessageBoxButtons.OK,MessageBoxIcon.Error);
return;
}
finally
{
httpResponse.Close(); }
//First Step: View "Service" 元素,第一步,检查service元素
int servicesCount=wsdl.Services.Count;
ServicesDescription[] sd=new ServicesDescription[servicesCount]; //这个类是用来封装所有的信息的
FunctionDescription fd=null;
Service service=null;
//Port portGet=null;//这里的端口就是协议,httpGet,httpPost,soap
if (this.cbox_ReqType.SelectedItem.ToString()=="Soap")
{
this.ActionType=SOAP;
this.AddressBindingString="SoapAddressBinding";
for(int i=0;i<servicesCount;i++)
{
service=wsdl.Services[i];
sd[i]=new ServicesDescription();
sd[i].ServiceName=service.Name;
try
{
for(int j=0;j<service.Ports[service.Name+this.ActionType].Extensions.Count;j++)
{
if (service.Ports[service.Name+this.ActionType].Extensions[j] is SoapAddressBinding)
{
sd[i].ServiceAddress=((SoapAddressBinding)service.Ports[service.Name+this.ActionType].Extensions[j]).Location;
break;
}
}
}
catch(SystemException se)
{
MessageBox.Show(se.Message);
}
//服务为,服务地址,服务的协议,服务提供的方法,服务方法要传递的参数
//获取,port所对应binding
System.Web.Services.Description.Binding bindGet=wsdl.Bindings[service.Ports[service.Name+this.ActionType].Binding.Name];
//OperationBinding function=null;
for(int k=0;k<bindGet.Operations.Count;k++)
{
fd=new FunctionDescription(bindGet.Operations[k].Name);
fd.FunctionAddress=sd[i].ServiceAddress+"/"+bindGet.Operations[k].Name;
sd[i].Functions.Add(fd);
}
PortType ptGet=wsdl.PortTypes[bindGet.Type.Name];
Operation op=null;
System.Web.Services.Description.Message msg=null;
for(int temp=0;temp<ptGet.Operations.Count;temp++)
{
ArrayList msgList=new ArrayList();
for(int pp=0;pp<ptGet.Operations[temp].Messages.Count;pp++)
{
if(ptGet.Operations[temp].Messages[pp] is OperationInput)
{
msgList.Add(wsdl.Messages[ptGet.Operations[temp].Messages[pp].Message.Name]); } }
string res="";
res+="方法:"+ptGet.Operations[temp].Name+"的参数说明如下:\n";
res+="输入的参数个数为:"+msgList.Count+"个;\n他们分别为:\n"; for(int iii=0;iii<msgList.Count;iii++)
{
msg=(System.Web.Services.Description.Message)msgList[iii];
for(int jj=0;jj<msg.Parts.Count;jj++)
{
if(msg.Parts[jj].Element.IsEmpty)
{
res+="参数的类型为:"+stringSpilt(msg.Parts[jj].Type.ToString())+" 参数名称为:"+msg.Parts[jj].Name;
res+="\t\r\n";
}
else
{
res+="参数的类型为:"+stringSpilt(msg.Parts[jj].Element.ToString())+" 参数名称为:"+msg.Parts[jj].Name;
res+="\t\r\n"; }
}
}
MessageBox.Show(res,"Information",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
}
只要你勤快,用string 拼起来都成.