webservice and c# ChannelFactory

iperutilityiperutility Member Posts: 18
edited 2015-07-01 in NAV Three Tier
Hi guys,

I'am develping one DLL in C# with Visual Studio2013, that needs to connect at codeunit exposed like webservice NAV2013.
I can't reference the codeunit by Visual Studio, I need to use C# ChannelFactory istruction, becouse I must change the URL of webservice everyone.

Have you help me becouse I don't understand how do that, this is my code into the DLL :

// Apro il canaele per comunicare verso NAV
var binding = new WSHttpBinding();
//http://SV-IU-DEV.sv-iu.iperutility:7133/DynNav71_DG710-ANGIZIA/WS/ANGIZIA/Codeunit/Sgate
var address = new EndpointAddress(arrMsgResponse[0].DownloadedCodeunitMetaData.LinkCodeunit);
var factory = new ChannelFactory<WHICH IS MU INTEFACE>(binding, address);
factory.Credentials.Windows.ClientCredential = new System.Net.NetworkCredential("AAAAAA","******");
IServiceChannel channel = factory.CreateChannel();
channel.Open();
Sign In or Register to comment.