10.07.2015 Views

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SuiteTalk (Web Services) Platform Guide - NetSuite

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Web</strong> <strong>Services</strong> Operationsupdate251}WriteResponse response = _service.update( customer );// Process the responseif ( response.status.isSuccess ){_out.info("\nThe following customer was updated successfully:" +"\nkey=" + ((RecordRef) response.baseRef).internalId +"\nentityId=" + customer.entityId +"\ncompanyName=" + customer.companyName +"\nemail=" + customer.email +"\naddressbookList[0].label=" + customer.addressbookList.addressbook[0].label );}else{_out.error( getStatusDetails( response.status ) );}Javapublic void updateCustomer() throws RemoteException,ExceededUsageLimitFault, UnexpectedErrorFault, InvalidSessionFault,ExceededRecordCountFault {// This operation requires a valid sessionthis.login(true);Customer customer = new Customer();// Get nsKey for update_console.write("\nEnter nsKey for customer record to be updated : ");customer.setInternalId(_console.readLn().toUpperCase());// Set name and emailcustomer.setEntityId("XYZ 2 Inc");customer.setCompanyName("XYZ 2, Inc.");customer.setEmail("bsanders@xyz.com");// Populate the address. Updating a list through WS results in the// entire contents of the previous list being replaced by the new// list.CustomerAddressbook address = new CustomerAddressbook();address.setDefaultBilling(Boolean.TRUE);address.setDefaultShipping(Boolean.FALSE);address.setLabel("Billing Address");address.setAddr1("4765 Sunset Blvd");address.setCity("San Mateo");address.setState(“CA”);address.setCountry(Country._unitedStates);// Attach the address to the customerCustomerAddressbookList addressList = new CustomerAddressbookList();CustomerAddressbook[] addresses = new CustomerAddressbook[1];addresses[0] = address;addressList.setAddressbook(addresses);customer.setAddressbookList(addressList);<strong>SuiteTalk</strong> <strong>Platform</strong> <strong>Guide</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!