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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Getting StartedQuick Start235. Use Apache Ant to automatically generate the client proxy code.Using Apache Axis from the command lineUse the WSDL2Java utility to generate the proxy classes as follows:java –cp org.apache.axis.wsdl.WSDL2Java Where the points to the appropriate Apache Axis JAR files and is the URL for the <strong>NetSuite</strong> WSDL.For example, the following commands will set the class path and generate theproxy classes:>setCP=%AXIS_HOME%\lib\axis.jar;%AXIS_HOME%\lib\jaxrpc.jar;%AXIS_HOME%\lib\commons-discovery.jar;%AXIS_HOME%\lib\wsdl4j.jar;%AXIS_HOME%\lib\saaj.jar;>java –cp %CP% org.apache.axis.wsdl.WSDL2Javahttps://webservices.netsuite.com/wsdl/v2011_1_0/netsuite.wsdlUsing the Apache Axis task in Apache AntCreate a build target that uses the WSDL2Java Ant task as follows where the${generated.src.dir} variable is the directory where the source code is generatedand the ${wsdl.url}variable points to the <strong>NetSuite</strong> WSDL.Generating client interfaces using Apache Axis6. Ensure that the Ant executables are available on the system path. Run the Ant task asfollows:ant generate.interfaces7. Implement your application by writing your business logic using the generated axisproxy classes.a. Locate the <strong>NetSuite</strong> service.<strong>NetSuite</strong>ServiceLocator service = new <strong>NetSuite</strong>ServiceLocator();b. Enable support for multiple cookie management.service.setMaintainSession( true );c. Get the <strong>NetSuite</strong> port.<strong>NetSuite</strong>PortType port = service.get<strong>NetSuite</strong>Port();d. Create a valid session by populating the Passport object and then invoking thelogin operation.passport.setEmail( "username@netsuite.com" );passport.setPassword( "mypassword" );role.setid( "3" );passport.setRole( role );<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!