Eseguire Operations on Business Components con l'adapter Siebel usando il modello di canale WCF
Questa sezione illustra come eseguire operazioni su Siebel usando il canale creato in Creare un canale usando 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();
Vedere anche
Sviluppare applicazioni Siebel usando il modello di canale WCF
Eseguire Operazioni sui componenti aziendali con l'adapter Siebel usando il modello di servizio WCF