嗨 我有一個WCF web服務,它有一個操作,我需要從本機C++調用中調用。我有一個橋樑管理DLL的工作,但我有一個調用具有OUT對象的WCF操作truoble。從託管的C++代碼調用C#opeartion'Out'
的C#opearation:
void DoWork(string indxNum, out ErrorWarningsData objerrc)
這裏ErrorWarningsData是在C#中的Web服務類。
這是我的託管C++代碼的樣子:
gcroot<Binding^> binding1 = gcnew WSHttpBinding();
gcroot<EndpointAddress^> address1 = gcnew EndpointAddress(gcnew String("http://usatondevlas1.na.praxair.com/Build15/ResourceCenterSVC/ResourceCenter.svc"));
gcroot<HelloServiceClient::ServiceReference2::ResourceCenterServiceContractClient^> client = gcnew HelloServiceClient::ServiceReference2::ResourceCenterServiceContractClient(binding1,address1);
gcroot<HelloServiceClient::ServiceReference2::ErrorWarningsData^> objEWData = gcnew HelloServiceClient::ServiceReference2::ErrorWarningsData;
但是,當我嘗試從WCF調用DoWork的方法服務我收到錯誤。
這是我的嘗試:
client->DoWork("4278779",[Out] objEWData);
也試過, client->DoWork("4278779",[Out] ^% objEWData);
而且, client->DoWork("4278779",[Out] % objEWData);
能有一個人請告訴我如何與 'OUT' 訪問oject。 我能找到一些例子來訪問[OUT]爲int和字符串,但沒有爲對象
PS:我也跟着下面的鏈接到WCF服務連接到本地appliaction [鏈接] HTTP://計算器。 com/questions/686452/create-wcf-service-for-unmanaged -c-clients
我試過了,但是當我調用方法'client-> DoWork(「4278778」,objEWData)' – abc123 2011-04-18 18:33:23
「時,它仍然會拋出異常。仍然拋出一個異常「?你從來沒有提到它拋出一個異常之前,如果它編譯,它看起來像你的問題被回答 - 發生異常將表明你正在使用該方法不正確。 – 2011-04-18 18:59:24