• No se han encontrado resultados

5. PROPUESTA DE INTERVENCIÓN

5.4. DISEÑO DE LA PROPUESTA

5.4.4. Cuarta sesión Relación social

In order to submit an initialized record without having to remove read-only fields populated during the initialization, set the Ignore Read-Only header preference to TRUE.

Important:

When this preference is set to TRUE, read-only fields are simply ignored during the Web services request. The fields still cannot be set.

Faults

This operation can throw one of the following faults. See SOAP Fault Status Codes for more information on faults.

InvalidSessionFault

InvalidCredentialsFault

ExceededRequestLimitFault

ExceededUsageLimitFault

ExceededRecordCountFault

ExceededRequestSizeFault

UnexpectedErrorFault

Sample Code

SOAP Request (initialize)

<soapenv:Body>

<platformMsgs:initialize xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http:// www.w3.org/2001/XMLSchema-instance" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:platformCoreTyp="urn:types.core_2_6.platform.webservices.netsuite.com" xmlns:platformCore="urn:core_2_6.platform.webservices.netsuite.com" xmlns:platformMsgs="urn:messages_2_6.platform.webservices.netsuite.com"> <platformMsgs:initializeRecord> <platformCore:type>invoice</platformCore:type>

<platformCore:reference internalId="1513" type="salesOrder"> <platformCore:name>1511</platformCore:name> </platformCore:reference>

</platformMsgs:initializeRecord>

Vendor Bill Vendor Use the apAccount parameter to specify the accounts payable (AP) account in a Vendor to Vendor Bill initialization. (This parameter is define in InitializeAuxRefType.) Vendor Payment Vendor Bill

Vendor Bill Purchase Order

</soapenv:Body> SOAP Request (initializeList)

<initializeList xmlns="urn:messages_2_6.platform.webservices.netsuite.com"> <initializeRecord>

<ns1:type

xmlns:ns1="urn:core_2_6.platform.webservices.netsuite.com">customerPayment </ns1:type>

<ns2:reference internalId="176" type="customer"

xmlns:ns2="urn:core_2_6.platform.webservices.netsuite.com"/> </initializeRecord>

<initializeRecord>

<ns3:type xmlns:ns3="urn:core_2_6.platform.webservices.netsuite.com"> invoice</ns3:type>

<ns4:reference internalId="176" type="customer"

xmlns:ns4="urn:core_2_6.platform.webservices.netsuite.com"/> </initializeRecord>

</initializeList> Java (initializeList)

InitializeRef iRef1 = new InitializeRef(); iRef1.setInternalId("176");

iRef1.setType(InitializeRefType.customer); InitializeRecord ir1 = new InitializeRecord(); ir1.setReference(iRef1);

ir1.setType(InitializeType.customerPayment); InitializeRecord ir2 = new InitializeRecord(); ir2.setReference(iRef1);

ir2.setType(InitializeType.invoice);

sessMgr.getPort().getNetSuitePortTypePort().initializeList(new InitializeRecord[]{ir1, ir2}); C# (initialize)

private void Initialize() {

this.login(true);

InitializeRef ref1 = new InitializeRef(); ref1.type = InitializeRefType.salesOrder;

//internal id of the sales order to be converted to cash sale ref1.internalId = "792";

ref1.typeSpecified = true;

InitializeRecord rec = new InitializeRecord(); rec.type = InitializeType.cashSale;

rec.reference = ref1;

ReadResponse read1 = _service.initialize(rec); }

Web Services Operations

login

188

login

The login operation is used to authenticate a user and start a new Web services session in NetSuite. The login operation is similar to the login for the UI. This operation provides a passport that includes a username, password, account and role. On success, the NetSuite server sets a cookie and establishes a session.

Important:

Users can also authenticate to NetSuite by providing their user credentials in the SOAP header of each request; they do not need to invoke the login operation. With user credentials provided in each request, the need for session management and separate logins is eliminated. For more information, see Authentication Using Request Level Credentials.

All available Web services operations require that the user first be logged in. Once successfully completed, a login creates a session that allows subsequent operations to be performed without having to log in again until the session expires or the logout operation is invoked. If the session times out, the next operation fails. Web services requests initiated through a client application must have the ability to execute the login operation when a session has timed out and then submit the original request again.

Note:

For information on session management, refer to Session Management.

If an operation is executed before a login is performed, it fails and the InvalidSessionFault is returned. Also note that after login, only one Web services request may be in flight at a time for a given session. Any attempt to violate this will result in a SOAP fault.

NetSuite Web services will use the last logged-in role when users do not specify a role in the login request and no default role is set. This makes the Web services login behavior consistent with the UI login behavior. Partner applications that rely on a specific role should be careful to specify that role in the login request, otherwise their users might be logged in with a role that is not appropriate for that application.

The login operation also verifies that the specified account has the Web Services feature enabled. If Web services is not enabled in your account, the SOAP fault InvalidCredentialsFault is returned with a code of WEB_SERVICES_NOT_ENABLED. (See Enabling the Web Services Feature for steps on enabling this feature.)

Request

The LoginRequest type is used for this request. It contains the following fields: Element Name XSD Type Notes

passport Passport Contains all the required credentials including username, password, account and role to authenticate the user and create a new session.

The Passport type includes the following elements:

email

password

account

role

Note:

You can confirm your accountID in the NetSuite UI. As administrator, go to Support > Customer Service > Contact Support by Phone. Your account number is displayed in a pop-up box. Also, Role is not a required parameter in the WS login. However, if you don't specify a role, the user's default role must have WS permissions.

Response

The LoginResponse type is used for the response. This references the SessionResponse type, which includes the status and wsRoleList elements.

The wsRoleList element returns a list of roles available for the user specified in the passport. You can then use this list of roles to execute different routines depending on available roles or to re-login with a different role.

Documento similar