public override void TestPerformed() { CompositeOperationRequest compositeOperation = new CompositeOperationRequest(); compositeOperation.Login = GetLogin(); compositeOperation.WebServiceType = GetWebServiceType(); CreateDataRequest createMovement = new CreateDataRequest(); createMovement.WebServiceType = "CreateMovementTest"; DataRow data = new DataRow(); data.AddField("C_DocType_ID", "143"); data.AddField("MovementDate", "2015-10-25 00:00:00"); data.AddField("AD_Org_ID", "11"); createMovement.DataRow = data; CreateDataRequest createMovementLine = new CreateDataRequest(); createMovementLine.WebServiceType = "CreateMovementLineTest"; DataRow dataLine = new DataRow(); dataLine.AddField("M_Movement_ID", "@M_Movement.M_Movement_ID"); dataLine.AddField("M_Product_ID", "138"); dataLine.AddField("MovementQty", "1"); dataLine.AddField("M_Locator_ID", "50001"); dataLine.AddField("M_LocatorTo_ID", "50000"); dataLine.AddField("AD_Org_ID", "11"); createMovementLine.DataRow = dataLine; SetDocActionRequest docAction = new SetDocActionRequest(); docAction.DocAction = DocAction.Complete; docAction.WebServiceType = "DocActionMovementTest"; docAction.RecordIDVariable = "@M_Movement.M_Movement_ID"; compositeOperation.AddOperation(createMovement); compositeOperation.AddOperation(createMovementLine); compositeOperation.AddOperation(docAction); WebServiceConnection client = GetClient(); try { CompositeResponse response = client.SendRequest(compositeOperation); if (response.Status == WebServiceResponseStatus.Error) { Console.WriteLine(response.ErrorMessage); } else { for (int i = 0; i < response.GetResponsesCount(); i++) { if (response.GetResponse(i).Status == WebServiceResponseStatus.Error) { Console.WriteLine(response.GetResponse(i).ErrorMessage); } else { Console.WriteLine(response.GetResponse(i).GetWebServiceResponseModel()); } } } } catch (Exception e) { Console.WriteLine(e); } }
static void Main(string[] args) { // CREATE COMPOSITE WS CompositeOperationRequest compositeOperation = new CompositeOperationRequest(); compositeOperation.Login = GetLogin(); compositeOperation.WebServiceType = "CompositeBPartnerTest"; // CREATE IMAGE WS CreateDataRequest createImage = new CreateDataRequest(); createImage.WebServiceType = "CreateImageTest"; String imageName = "img/idempiere-logo.png"; DataRow data = new DataRow(); data.AddField("Name", imageName); data.AddField("Description", "Test Create BPartner and Logo"); byte[] fileBytes = File.ReadAllBytes(imageName); data.AddField("BinaryData", fileBytes); createImage.DataRow = data; // CREATE BP WS CreateDataRequest createBP = new CreateDataRequest(); createBP.WebServiceType = "CreateBPartnerTest"; DataRow dataBP = new DataRow(); dataBP.AddField("Name", "Test BPartner"); dataBP.AddField("Value", "Test_BPartner From C#" + Environment.TickCount); dataBP.AddField("TaxID", "123456"); dataBP.AddField("Logo_ID", "@AD_Image.AD_Image_ID"); createBP.DataRow = dataBP; compositeOperation.AddOperation(createImage); compositeOperation.AddOperation(createBP); WebServiceConnection client = GetClient(); try { // GET RESPONSE CompositeResponse response = client.SendRequest(compositeOperation); client.WriteRequest(Console.Out); Console.WriteLine(); Console.WriteLine(); client.WriteResponse(Console.Out); Console.WriteLine(); Console.WriteLine(); if (response.Status == WebServiceResponseStatus.Error) { Console.WriteLine(response.ErrorMessage); } else { for (int i = 0; i < response.GetResponsesCount(); i++) { if (response.GetResponse(i).Status == WebServiceResponseStatus.Error) { Console.WriteLine(response.GetResponse(i).ErrorMessage); } else { Console.WriteLine(response.GetResponse(i).GetWebServiceResponseModel()); Console.WriteLine(response.GetResponse(i).WebServiceType); } Console.WriteLine(); } } Console.WriteLine("--------------------------"); Console.WriteLine("Web Service: CompositeBPartnerTest"); Console.WriteLine("Attempts: " + client.AttemptsRequest); Console.WriteLine("Time: " + client.TimeRequest); Console.WriteLine("--------------------------"); } catch (Exception e) { Console.WriteLine(e); } Console.ReadKey(); }
public override void TestPerformed() { CompositeOperationRequest compositeOperation = new CompositeOperationRequest(); compositeOperation.Login = GetLogin(); compositeOperation.WebServiceType = GetWebServiceType(); CreateDataRequest createImage = new CreateDataRequest(); createImage.WebServiceType = "CreateImageTest"; String imageName = "img/idempiere-logo.png"; DataRow data = new DataRow(); data.AddField("Name", imageName); data.AddField("Description", "Test Create BPartner and Logo"); byte[] fileBytes = File.ReadAllBytes(imageName); data.AddField("BinaryData", fileBytes); createImage.DataRow = data; CreateDataRequest createBP = new CreateDataRequest(); createBP.WebServiceType = "CreateBPartnerTest"; DataRow dataBP = new DataRow(); dataBP.AddField("Name", "Test BPartner"); dataBP.AddField("Value", "Test_BPartner From C#" + Environment.TickCount); dataBP.AddField("TaxID", "123456"); dataBP.AddField("Logo_ID", "@AD_Image.AD_Image_ID"); createBP.DataRow = dataBP; compositeOperation.AddOperation(createImage); compositeOperation.AddOperation(createBP); WebServiceConnection client = GetClient(); try { CompositeResponse response = client.SendRequest(compositeOperation); if (response.Status == WebServiceResponseStatus.Error) { Console.WriteLine(response.ErrorMessage); } else { for (int i = 0; i < response.GetResponsesCount(); i++) { if (response.GetResponse(i).Status == WebServiceResponseStatus.Error) { Console.WriteLine(response.GetResponse(i).ErrorMessage); } else { Console.WriteLine(response.GetResponse(i).GetWebServiceResponseModel()); Console.WriteLine(response.GetResponse(i).WebServiceType); } Console.WriteLine(); } } } catch (Exception e) { Console.WriteLine(e); } }