NavigationUser login |
IFBO C# Visual Studio 2008 client (Appendix G)C# implementation of the if_rig Appendix G code snippet. Reference: http://www.codeproject.com/KB/cs/multipart_request_C_.aspx using System; namespace ifboClient { public class ifboClient { private static string PostRequest(System.Uri uri, string requestXml) { string response = null; // We need to do this so the Ventyx servlet on the unix side will process the request. HttpWebRequest WebReq = (HttpWebRequest)WebRequest.Create(uri); //Our method is post, otherwise the buffer (postvars) would be useless //We use form contentType, for the postvars. //The length of the buffer (postvars) is used as contentlength. //We open a stream for writing the postvars //Now we write, and afterwards, we close. Closing is always important! //Get the response handle, we have no true response yet! //Now, we read the response (the string), and output it. return response; static void Main() { string IFBOXML = String.Format("<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE InboundRequest [ <!ELEMENT InboundRequest (APIHeader, BusinessObject)> <!ENTITY % APIHeader SYSTEM \"http://apifw//xml/APIHeader.Inbound.Request.V060000.dtd\"> %APIHeader; <!ENTITY % BusinessObject SYSTEM \"http://apifw//xml/WorkOrder.Create.Request.V060000.dtd\"> %BusinessObject; ]><InboundRequest><APIHeader ReplyTypeOK=\"A\" ReplyTypeError=\"N\"><apiAPIVersion>V060000</apiAPIVersion><apiBusinessObject>WorkOrder</apiBusinessObject><apiBusObjectMethod>Create</apiBusObjectMethod><apiBusObjectVersion>V060000</apiBusObjectVersion><apiUserID>PassPortID</apiUserID> <apiExtSystemID></apiExtSystemID><apiExtRequestID></apiExtRequestID><apiRoutingInfo></apiRoutingInfo></APIHeader><BusinessObject><WoHeader><Facility>TBL</Facility><WorkOrderType>CA</WorkOrderType><WoDescription>test IFBO</WoDescription><Planner>Planner</Planner><WoPriority>99</WoPriority><ProjectNbr>0001066</ProjectNbr></WoHeader></BusinessObject></InboundRequest>"); //System.Uri m_IfboUri = new System.Uri("https://server:SSLport/apifw/APIFWAdapterServlet"); string response = PostRequest(m_IfboUri, IFBOXML); Console.WriteLine("response=" + response); } } By webmaster | Integration Framework Business Objects (IFBO) | add new comment
|