ws2.web_service_type = 'CreateBPartnerTest' ws2.data_row.append(Field('Name', 'Test BPartner')) ws2.data_row.append(Field('Value', random.randint(1000000, 10000000))) ws2.data_row.append(Field('TaxID', '987654321')) ws2.data_row.append(Field('Logo_ID', '@AD_Image.AD_Image_ID')) # CREATE COMPOSITE ws0 = CompositeOperationRequest() ws0.login = login ws0.operations.append(Operation(ws1)) ws0.operations.append(Operation(ws2)) ws0.web_service_type = 'CompositeBPartnerTest' # CREATE CONNECTION wsc = WebServiceConnection() wsc.url = urls wsc.attempts = 3 wsc.app_name = 'Test from python' # SEND CONNECTION try: response = wsc.send_request(ws0) wsc.print_xml_request() wsc.print_xml_response() # GET THE RESPONSE if response.status == WebServiceResponseStatus.Error: print('Error: ' + response.error_message) else: print('Response: ' + str(response.web_service_response_model())) for res in response.responses:
urls = 'https://localhost:8431' login = LoginRequest() login.client_id = 11 login.org_id = 0 login.role_id = 102 login.password = '******' login.user = '******' ws = ReadDataRequest() ws.web_service_type = 'ReadBPartnerTest' ws.login = login ws.record_id = 1000086 wsc = WebServiceConnection() wsc.url = urls wsc.attempts = 3 wsc.app_name = 'Test from python' try: response = wsc.send_request(ws) wsc.print_xml_request() wsc.print_xml_response() if response.status == WebServiceResponseStatus.Error: print('Error: ', response.error_message) else: print('Num rows: ', str(response.num_rows)) print('') for row in response.data_set: for field in row:
login = LoginRequest() login.client_id = 11 login.org_id = 0 login.role_id = 102 login.password = '******' login.user = '******' query = QueryDataRequest() query.web_service_type = 'QueryBPartnerTest' query.offset = 2 query.limit = 5 query.login = login wsc = WebServiceConnection() wsc.url = IDEMPIERE_URL wsc.attempts = 3 wsc.app_name = 'Test from python' try: response = wsc.send_request(query) wsc.print_xml_request() wsc.print_xml_response() if response.status == WebServiceResponseStatus.Error: print('Error: ' + response.error_message) else: print('Total Rows: ' + str(response.total_rows)) print('Num rows: ' + str(response.num_rows)) print('Start row: ' + str(response.start_row)) print('')
login.org_id = 1000006 login.role_id = 1000196 login.password = '******' login.user = '******' login.warehouse_id = 1000009 if True: ws = UpdateDataRequest() ws.web_service_type = 'ActivateEBatchLoadLine' ws.record_id = 1033324 ws.login = login ws.data_row = [Field('IsActive', 'Y')] wsc = WebServiceConnection() wsc.url = ad_url wsc.attempts = 1 wsc.app_name = 'ActivateEBatchLoadLine' response = wsc.send_request(ws) wsc.print_xml_request() wsc.print_xml_response() try: if response.status == WebServiceResponseStatus.Error: print('Error: ' + response.error_message) else: print('RecordID: ' + str(response.record_id)) for field in response.output_fields: print(str(field.column) + ': ' + str(field.value)) print('---------------------------------------------') print('Web Service Type: ' + ws.web_service_type)