工具是Delphi2006现状,使用WSDL Importer产生文件并调用相关方法,以前做成应用程序,使用正常,数据接收,以及发送数据到服务器都没有问题,由于项目需要,将原来的应用程序改成windows服务程序,用http的webservice进行测试一切正常,但是把webservice地址切换成https的就不行了,
返回错误信息:
服务器返回的信息无效或不可识别 - URL:http://(这里是webservice地址,把https解析成http了) - SOAPAction:""请问这是什么原因,或者可以用其它什么方式调用https的webservice

解决方案 »

  1.   

    http://home.searchfull.net:8080/2413078-%E5%9F%BA%E4%BA%8E+https+webservice+.html
    看下这个吧,可能对你有用
      

  2.   

    谢谢楼上系统的回答,我看了下,不过我需要的是Delphi调用的问题
      

  3.   

    demo:// ************************************************************************ //
    // The types declared in this file were generated from data read from the
    // WSDL File described below:
    // WSDL     : http://172.20.100.10/test/service.asmx?wsdl
    //  >Import : http://172.20.100.10/test/service.asmx?wsdl:0
    // Encoding : utf-8
    // Version  : 1.0
    // (2010/6/22 上午 11:31:35 - - $Rev: 10138 $)
    // ************************************************************************ //unit service;interfaceuses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;const
      IS_OPTN = $0001;
      IS_REF  = $0080;
    type  // ************************************************************************ //
      // The following types, referred to in the WSDL document are not being represented
      // in this file. They are either aliases[@] of other types represented or were referred
      // to but never[!] declared in the document. The types from the latter category
      // typically map to predefined/known XML or Borland types; however, they could also 
      // indicate incorrect WSDL documents that failed to declare or import a schema type.
      // ************************************************************************ //
      // !:string          - "http://www.w3.org/2001/XMLSchema"[Gbl]  // ************************************************************************ //
      // Namespace : Kye
      // soapAction: Kye/HelloWorld
      // transport : http://schemas.xmlsoap.org/soap/http
      // style     : document
      // binding   : ServiceSoap
      // service   : Service
      // port      : ServiceSoap
      // URL       : http://172.20.100.10/test/service.asmx
      // ************************************************************************ //
      ServiceSoap = interface(IInvokable)
      ['{B82FAFBA-EAB8-AD5C-2535-FB6046355616}']
        function  HelloWorld(const name_: WideString): WideString; stdcall;
      end;function GetServiceSoap(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): ServiceSoap;
    implementation
      uses SysUtils;function GetServiceSoap(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): ServiceSoap;
    const
      defWSDL = 'http://172.20.100.10/test/service.asmx?wsdl';
      defURL  = 'http://172.20.100.10/test/service.asmx';
      defSvc  = 'Service';
      defPrt  = 'ServiceSoap';
    var
      RIO: THTTPRIO;
    begin
      Result := nil;
      if (Addr = '') then
      begin
        if UseWSDL then
          Addr := defWSDL
        else
          Addr := defURL;
      end;
      if HTTPRIO = nil then
        RIO := THTTPRIO.Create(nil)
      else
        RIO := HTTPRIO;
      try
        Result := (RIO as ServiceSoap);
        if UseWSDL then
        begin
          RIO.WSDLLocation := Addr;
          RIO.Service := defSvc;
          RIO.Port := defPrt;
        end else
          RIO.URL := Addr;
      finally
        if (Result = nil) and (HTTPRIO = nil) then
          RIO.Free;
      end;
    end;
    initialization
      InvRegistry.RegisterInterface(TypeInfo(ServiceSoap), 'Kye', 'utf-8');
      InvRegistry.RegisterDefaultSOAPAction(TypeInfo(ServiceSoap), 'Kye/HelloWorld');
      InvRegistry.RegisterInvokeOptions(TypeInfo(ServiceSoap), ioDocument);
      InvRegistry.RegisterExternalParamName(TypeInfo(ServiceSoap), 'HelloWorld', 'name_', 'name');end.
      

  4.   

    調用:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs,service, StdCtrls;type
      TForm1 = class(TForm)
        btn1: TButton;
        edt1: TEdit;
        Label1: TLabel;
        procedure btn1Click(Sender: TObject);
      private
        aa:ServiceSoap;
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.dfm}procedure TForm1.btn1Click(Sender: TObject);
    begin
      aa:=GetServiceSoap(False,'',nil);
      ShowMessage(aa.HelloWorld(edt1.Text));
    end;end.
     
      

  5.   

    呵呵,谢谢楼上热情的回答,我遇到的问题是调用https的webservice出问题,而且在应用程序里可以,在windows服务里不行,Delphi调用webservice的方法我还是清楚的这个问题自己解决了,就是在给所配置的服务指定一个用户即可,希望对部分朋友有用,结贴了