全國最多中醫師線上諮詢網站-台灣中醫網
發文 回覆 瀏覽次數:1876
推到 Plurk!
推到 Facebook!

Delphi 2005 ISAPI Vs .Net WebService

尚未結案
JimmyInTTI
一般會員


發表:4
回覆:4
積分:1
註冊:2002-09-04

發送簡訊給我
#1 引用回覆 回覆 發表時間:2007-03-06 17:54:32 IP:203.67.xxx.xxx 訂閱
小弟想利用IIS Service 的方式讓.Net寫的WebService 可以供使用者以Http Post的方式呼叫使用,  故想用Delphi 2005 (ISAPI dll)+ C#.Net(WebService in VS 2005)串連....  但是目前發生由ISAPI Dll無法將參數傳入  (兩者都用VS 2005寫的 EXE (輸入介面)+ Dll(呼叫WebService)卻可以..),  不知道發生什麼問題.... 請教有經驗的大大們...謝謝!!     (程式簡述如下:)     <textarea class="delphi" rows="10" cols="60" name="code"> //Delphi 2005 //ISAPI Action ...... procedure TwmMain.wmMyAction(Sender: TObject; Request: TWebRequest; Response:TWebResponse; var Handled: Boolean); var TmpHttpSoap:MySoap; TmpResult:String; tmpUserID:String; begin TmpHttpSoap:=hprioMyAction as MySoap; //HTTPRIO try tmpUserID := trim(Request.ContentFields.Values['UserID']);//處理傳入參數 TmpResult := TmpHttpSoap.MyAction(tmpUserID); //呼叫 WebService Function finally TmpHttpSoap:=nil; end; end; //hprioMyActionAfterExecute.... procedure TwmMain.hprioMyActionAfterExecute(const MethodName: string; SOAPResponse: TStream); var TmpList:TStringList; begin SOAPResponse.Position := 0; TmpList:=TStringList.Create; try TmpList.LoadFromStream(SOAPResponse); Response.Content := TmpList.Text; //顯示WebService 回傳質 finally TmpList.Free; TmpList:=nil; end; end; //VS 2005 WebService using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Diagnostics; using System.Web; using System.Web.Services; using System.Xml; using System.Xml.Schema; using System.Xml.Serialization; using System.IO; using System.Configuration; using System.Web.Services.Protocols; using System.Web.Services.Description; .... [SoapRpcService(RoutingStyle = SoapServiceRoutingStyle.SoapAction, Use = SoapBindingUse.Literal)] public class MyService : System.Web.Services.WebService { protected string gc_ConnStr; protected static string strConnect = null; public static DataTransfer sDataTransfer = new DataTransfer(); public string DebugFlag="true"; public MyService() { AppSettingsReader reader = new AppSettingsReader(); gc_ConnStr = (string) reader.GetValue("ConnStr",typeof(string)); //CODEGEN: 此為 ASP.NET Web 服務設計工具所需的呼叫。 InitializeComponent(); if(strConnect==null || strConnect=="") strConnect=gc_ConnStr; } ... [WebMethod(EnableSession = true)] public string MyAction(string UserName) { .............. //傳入值為空值(UserName)!!!!!!!! } } </textarea>
Ktop_Robot
站務副站長


發表:0
回覆:3511
積分:0
註冊:2007-04-17

發送簡訊給我
#2 引用回覆 回覆 發表時間:2007-04-26 13:50:06 IP:000.000.xxx.xxx 未訂閱
提問者您好:


以上回應是否已得到滿意的答覆?


若已得到滿意的答覆,請在一週內結案,否則請在一週內回覆還有什麼未盡事宜,不然,
將由版主(尚無版主之區域將由副站長或站長)自由心證,選擇較合適之解答予以結案處理,
被選上之答題者同樣會有加分獎勵同時發問者將受到扣 1 分的處分。不便之處,請見諒。


有問有答有結案,才能有良性的互動,良好的討論環境需要大家共同維護,感謝您的配合。

------
我是機器人,我不接受簡訊.
系統時間:2024-05-03 19:26:17
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!