我们要开发接口程序,IBM公司给的文档是这么写的:“接口格式采用基于HTTP的SOAP协议,以Web Service的方式进行同步通信。所有Web Service接口依据W3C组织颁布的WSDL为标准”
这块东西没学过,要求用C#做开发,学习时间是5天,我要找一些什么资料,给一些教程。
哪位大虾给点资料,给些教程,多谢了!!!!
邮箱是:[email protected]

解决方案 »

  1.   

    http://searchwebservices.techtarget.com.cn/tips/6/2140006.shtml
      

  2.   

    HttpWebRequest httpRequest;
                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);
                        }
                        
                    }
                }
      

  3.   

    主要是利用.NET自动生成的WSDL文档格式的特点,对文档进行解析,同时得到Web服务中所有函数的元数据信息,以便进一步对其进行调用。在调用时,使用的是HTTP POST协议。
      

  4.   

    不用自己去封装吧~有这么变态? 自动生成一个得了. 再说楼主的意思你们搞错了吧,他好象是要写个WebService接口,并不是去调用.-_-!
      

  5.   

    就是一个webservice的描述啊,好像什么webservice书上都有的吧
      

  6.   

    来学习,是不是接受发起方的XML文件,通过一些程序处理XML文档,生成需要的数据,然后用这些数据做别的操作?那实现步骤是什么?
      

  7.   

    说白了,你只要按照它的Soap描述,回发回去就得了.
      只要你勤快,用string 拼起来都成.
      

  8.   

    问个问题,如果有服务器端的WSDL文件了,是不是可以用这个写出接收XML的程序?还是什么别的?