# 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:
            print('Response: ' + str(res.web_service_response_model()))
        print('---------------------------------------------')
        print('Web Service Type: ' + ws0.web_service_type)
        print('Attempts: ' + str(wsc.attempts_request))
        print('Time: ' + str(wsc.time_request))
except:
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('')
        for row in response.data_set:
            for field in row:
                print(str(field.column) + ': ' + str(field.value))
            print('')
        print('---------------------------------------------')
Beispiel #3
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:
                print('{}: {}'.format(str(field.column), str(field.value)))
            print('')
        print('-' * 25)
        print('Web Service Type: ', ws.web_service_type)
        print('Attempts: ', str(wsc.attempts_request))
login.password = '******'
login.user = '******'

query = QueryDataRequest()
query.web_service_type = 'QueryImageTest'
query.offset = 5
query.limit = 1
query.login = login

wsc = WebServiceConnection()
wsc.url = urls
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('')
        for row in response.data_set:
            for field in row:
                print(str(field.column) + ': ' + str(field.value))
                if str(field.column) == 'BinaryData':
                    file = open('newfile.png', 'wb')
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)