最近在做一个项目,需要用到webservice,谁有webservice方面的例子或资料,谢谢.

解决方案 »

  1.   

    http://www.pconline.com.cn/pcedu/empolder/gj/delphi/0408/445559.htmlhttp://tech.163.com/05/0609/11/1LQ82QN900091589.html自己搜索一下嘛.
      

  2.   

    实战Delphi6.Kylix2.SOAP.Web Service程序设计篇
    李维著
      

  3.   

    谢谢,我按照李维的例子无法运行,后来看了猛禽的帖子,升级到pack2,把IAppServer改成IAppServerSoap,但是客户端的clientDataSet中providerName还是没有看到有内容,如果自己填加'datasetprovider1',把clientDataSet的active设为true的时候又会出现"XML 文档必须有一个顶层元素。 Line: 0"这样的错误提示.请问我那里出问题了?
      

  4.   

    现在试了一下,发现按下面的方式做客户端的时候,在New|WebServices|WebServicesImporter,在URL中输入:http://localhost/soap/soaptest.dll/wsdl/isoaphello,然后按<NEXT>也会出现"XML 文档必须有一个顶层元素。 Line: 0"这样的错误提示.请问我那里出问题了?
    服务端:1.New|WebServices|SoapServerApplication,选ISAPI(如果你想试试 DELPHI6 新增的 Web App Debbuger,也可以选它,关于它我想另外再说);2.SaveAll, Unit1命名为:MainWM,Project1命名为:SoapTest;3.在MainWM中的Uses中加入:InvokeRegistry4.自定义一个接口,及其对应类的实现:ISoapHello = Interface ( IInvokable )['{6DF34980-6FFC-11D5-9E62-0050BABD8FE1}'] // 这个GUID你自己用 Ctrl Shift G 产生Function GetHello( aID : Integer ) : WideString; StdCall;End;
    TSoapHello = Class ( TInvokableClass, ISoapHello )ProtectedFunction GetHello( aID : Integer ) : WideString; StdCall;End;5.实现GetHello函数:Function TSoapHello.GetHello( aID : Integer ) : WideString;BeginIf ( aID = 1 ) ThenResult := 'Hello world!'ElseResult := 'Error ID!';End;6.注册接口和类:InitializationInvRegistry.RegisterInterface( TypeInfo( ISoapHello ) ); InvRegistry.RegisterInvokableClass( TSoapHello );7.编译之即可产生:SoapTest.dll
    启动PWS,设置虚拟目录soap为soaptest.dll所在的目录,权限为执行打开IE,输入URL为:http://localhost/soap/soaptest.dll/wsdl即可看到一个表格,显示了此SOAP服务(即所谓的Web Service)所提供的WSDL其中应该有我们自定义的接口:ISoapHello点其链接将返回一个XML文档
    客户端:1.New|Application2.SaveAll,Unit1命名为ClnMain,Project1命名为SoapClient3.New|WebServices|WebServicesImporter,在URL中输入:http://localhost/soap/soaptest.dll/wsdl/isoaphello,如果上面用IE看没错的话,这时确定后将产生一个单元,其中有我们在服务端定义的接口 
    4.SaveAll,Unit1命名为SoapIntf,再在ClnMain中Uses加入SoapIntf5.在Form1上放上Edit, Label, Button, HTTPRIO(在Web Services页中的第一个)四个控件,设置HTTPRIO1.URL为:http://localhost/delphi6/soap/soaptest.dll/soap6.双击Button1输入下面的程序:Varp : ISoapHello;beginp := HTTPRIO1 As ISoapHello;Label1.Caption := p.GetHello( StrToInt( Edit1.Text ) );end;7.编译运行,在Edit1中输入"1"按Button1,Label1将显示"Hello world!"输入其它数字将显示"Error ID!"