使用 WCF 通道模型搭配 Siebel 配接器在商務元件上執行作業
本節示範如何使用 使用 Siebel 建立通道中所建立的通道,在 Siebel 上執行作業。
// create binding
SiebelBinding binding = new SiebelBinding();
//set up an endpoint address
EndpointAddress address = new EndpointAddress("siebel://Username=myuser;Password=mypass@mysiebelserver:1234?SiebelObjectManager=SSEObjMgr&SiebelEnterpriseServer=ent771&Language=enu");
//create request channel factory
IChannelFactory<IRequestChannel> factory = binding.BuildChannelFactory<IRequestChannel>(new BindingParameterCollection());
//open factory
factory.Open();
//create request channel using endpoint
IRequestChannel channel = factory.CreateChannel(address);
//open the channel
channel.Open();
// send request message and receive reply
System.Xml.XmlReader readerIn = System.Xml.XmlReader.Create(inputXml);
System.ServiceModel.Channels.Message messageIn = System.ServiceModel.Channels.Message.CreateMessage(MessageVersion.Default,action,readerIn);
System.ServiceModel.Channels.Message messageOut = channel.Request(messageIn);
// get response XML from SOAP message
System.Xml.XmlReader readerOut = messageOut.GetReaderAtBodyContents();
// save output file
XmlDocument doc = new XmlDocument();
doc.Load(readerOut);
doc.Save(outputXml);
Console.WriteLine("XML written out to {0}", outputXml);
// close the channel and the factory
channel.Close();
factory.Close();
另請參閱
使用 WCF 通道模型開發 Siebel 應用程式
使用 WCF 服務模型搭配 Siebel 配接器在商務元件上執行作業