2009-09-22 60 views
1

我正在處理一個代碼,我需要從短信服務提供商發送短信他們讓我delphy程序,可以發送短信從他們的服務,但我不知道delphy和我應該改變這個代碼爲java Anyboddy可以指導我如何更改此代碼? 我覺得這是一個SOAP服務德爾福到java,肥皂德爾福,短信發送

// ************************************************************************ // 

// The types declared in this file were generated from data read from the 

// WSDL File described below: 

// WSDL  : http://mihansmscenter.com/webservice/?wsdl 

// Encoding : ISO-8859-1 

// Version : 1.0 

// (8/14/2007 6:51:27 PM - 1.33.2.5) 

// ************************************************************************ // 



unit IMihanSMSCenterService; 



interface 



uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns; 



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" 

    // !:int    - "http://www.w3.org/2001/XMLSchema" 



    stringArray = array of WideString;   { "http://mihansmscenter.com/webservice/" } 

    intArray = array of Integer;    { "http://mihansmscenter.com/webservice/" } 



    // ************************************************************************ // 

    // Namespace : http://mihansmscenter.com/webservice/ 

    // soapAction: http://mihansmscenter.com/webservice/#%operationName% 

    // transport : http://schemas.xmlsoap.org/soap/http 

    // style  : rpc 

    // binding : mihansmscenterWSDLBinding 

    // service : mihansmscenterWSDL 

    // port  : mihansmscenterWSDLPort 

    // URL  : http://www.mihansmscenter.com/webservice/index.php 

    // ************************************************************************ // 

    mihansmscenterWSDLPortType = interface(IInvokable) 

    ['{7B1648E6-5147-A087-2C5C-7FF87155D985}'] 

    procedure send(const username: WideString; const password: WideString; const to_: WideString; const from: WideString; const message: WideString; const send_time: Integer; out status: Integer; out identifier: Integer; out status_message: WideString); stdcall; 

    procedure multiSend(const username: WideString; const password: WideString; const to_: stringArray; const from: WideString; const message: WideString; const send_time: Integer; out status: Integer; out send_results: intArray; out identifiers: intArray; out status_message: WideString 

         ); stdcall; 

    procedure checkSendStatus(const username: WideString; const password: WideString; const identifier: Integer; out status: Integer; out sendStatus: Integer; out status_message: WideString); stdcall; 

    procedure bulkSend(const username: WideString; const password: WideString; const count: Integer; const from: WideString; const message: WideString; const description: WideString; out status: Integer; out status_message: WideString); stdcall; 

    procedure verifyReceive(const username: WideString; const password: WideString; const to_: WideString; const from: WideString; const message: WideString; const timestamp: Integer; out status: Integer; out status_message: WideString); stdcall; 

    procedure accountInfo(const username: WideString; const password: WideString; out status: Integer; out status_message: WideString; out remaining_sms: Integer; out total_sms: Integer; out received_sms: Integer; out sent_sms: Integer; out recieve_url: WideString; out sms_numbers: stringArray 

         ); stdcall; 

    procedure changeReceiveURL(const username: WideString; const password: WideString; const receive_url: WideString; out status: Integer; out status_message: WideString); stdcall; 

    procedure changePassword(const username: WideString; const password: WideString; const new_password: WideString; out status: Integer; out status_message: WideString); stdcall; 

    end; 



function GetmihansmscenterWSDLPortType(UseWSDL: Boolean=System.False; Addr: string=''; HTTPRIO: THTTPRIO = nil): mihansmscenterWSDLPortType; 





implementation 



function GetmihansmscenterWSDLPortType(UseWSDL: Boolean; Addr: string; HTTPRIO: THTTPRIO): mihansmscenterWSDLPortType; 

const 

    defWSDL = 'http://mihansmscenter.com/webservice/?wsdl'; 

    defURL = 'http://www.mihansmscenter.com/webservice/index.php'; 

    defSvc = 'mihansmscenterWSDL'; 

    defPrt = 'mihansmscenterWSDLPort'; 

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 mihansmscenterWSDLPortType); 

    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(mihansmscenterWSDLPortType), 'http://mihansmscenter.com/webservice/', 'ISO-8859-1'); 

    InvRegistry.RegisterDefaultSOAPAction(TypeInfo(mihansmscenterWSDLPortType), 'http://mihansmscenter.com/webservice/#%operationName%'); 

    InvRegistry.RegisterExternalParamName(TypeInfo(mihansmscenterWSDLPortType), 'send', 'to_', 'to'); 

    InvRegistry.RegisterExternalParamName(TypeInfo(mihansmscenterWSDLPortType), 'multiSend', 'to_', 'to'); 

    InvRegistry.RegisterExternalParamName(TypeInfo(mihansmscenterWSDLPortType), 'verifyReceive', 'to_', 'to'); 

    RemClassRegistry.RegisterXSInfo(TypeInfo(stringArray), 'http://mihansmscenter.com/webservice/', 'stringArray'); 

    RemClassRegistry.RegisterXSInfo(TypeInfo(intArray), 'http://mihansmscenter.com/webservice/', 'intArray'); 



end. 

回答

3

你有興趣的唯一位是WSDL:

http://mihansmscenter.com/webservice/?wsdl 

選擇了Java WS API中的一個 - 軸,JAX-WS,等 - 那麼從WSDL爲Web服務生成客戶端存根,並編寫您的Java代碼以對付這些客戶端。

其他的Delphi代碼對你來說幾乎沒用。你可能想問一下使用Delphi接口的代碼,這樣你就可以看到呼叫是如何進行的 - 比如加密的密碼等等,因爲你明顯想要符合那個。