ws2 = CreateDataRequest() 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()))
from sandbox import IDEMPIERE_URL 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))
url = 'http://localhost:8031' 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:
login.client_id = 1000003 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('---------------------------------------------')
GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with idempierewsc. If not, see <http://www.gnu.org/licenses/>. """ from idempierewsc.net import WebServiceConnection url = 'http://localhost:8031/ADInterface/services/ModelADService' urls = 'https://localhost:8431/ADInterface/services/ModelADService' def test_xml(): test_file = open('../../documents/ReadBPartnerTest_request.xml', 'r') return test_file.read() wsc = WebServiceConnection() wsc.url = urls wsc.attempts = 3 try: response = wsc.send_request(test_xml()) except Exception as e: print('Error' + str(e.message)) else: wsc.print_xml_response() finally: print(wsc.attempts_request) print(wsc.time_request) print(wsc.response_status)
along with idempierewsc. If not, see <http://www.gnu.org/licenses/>. """ """ Contributor: @pozzisan <*****@*****.**> """ from idempierewsc.net import WebServiceConnection url = 'http://dev11.devcoffee.com.br/ADInterface/services/ModelADService' urls = 'https://localhost:8431/ADInterface/services/ModelADService' def test_xml(): test_file = open('../documents/ReadBPartnerTest_request.xml', 'r') return test_file.read() wsc = WebServiceConnection() wsc.url = url wsc.attempts = 3 try: response = wsc.send_request(test_xml()) except Exception as e: print('Error', str(e)) else: wsc.print_xml_response() finally: print(wsc.attempts_request) print(wsc.time_request) print(wsc.response_status)