Marty Zigman Marty Zigman
Prolecto Labs Accelerator Templates

How to Connect NetSuite Web Services with Java

NetSuite Technical

Tags: , , , , , , , , , , , , , ,

cloud computing
In contrast to other Cloud based ERP systems, NetSuite is a platform for the creation and integration of other applications.  One mainstream programming tool used in business based software development is Java.  And this means we are interested in how to use Java to connect to NetSuite’s Web Services tier.  Java continues to be popular – it is open source, mature, and it has a large development community.  Java exists as a contrast to Microsoft’s .NET development platform.

The way to connect Java to NetSuite is through SuiteTalk, which is in essence the way NetSuite has exposed its system via web services. Web Services is a standard way that modern platforms expose functionality to users in a secure manner to connect up and process logic.  NetSuite is acting as the server, and anything that manipulates it, is the client.  As you may probably already know, Java traditionally exposes itself as a server, and other applications consume Java.  Here, however, we’re going to make Java a client technology that connects with NetSuite services.

Under some assumptions to help illustrate how to connect, we will reference some of the most popular tools for this process. Many others exist.   First download and use the Java implementation on Tomcat, which works with the Apache web server on a Linux system (we like to use Ubuntu).  Next, you will need to install Axis, which is basically a tool that allows for both the creation of server based and  client side web service applications. From there, we will use Axis to connect with NetSuite through their WDSL, which is a URL pointer to a description of how NetSuite exposes all its web services.

With Axis now configured inside Tomcat, when we consume the NetSuite WSDL, it will create the proxy objects, which will be available to the Java environment so that our Java developer can program NetSuite. NetSuite will appear to the Java developer as a set of Java classes that are manipulated like any other object.  Most developers will use Eclipse for their open source integrated software development (IDE) environment.

This will essentially get you hooked up, but there’s now an important step in the process: “how do I manipulate NetSuite effectively?”.  This requires a good understanding of NetSuite’s Web Services library.  Although everyone appreciates more code examples, the documentation is pretty good.  We have developed a number of NetSuite web service applications and the environment works well.

Copyright © Marty Zigman 2011

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

More Posts - Website - Twitter - Facebook - LinkedIn - YouTube

About Marty Zigman

Marty Zigman

Holding all three official certifications, Marty is regarded as the top NetSuite expert and leads a team of senior professionals at Prolecto Resources, Inc. He is a former Deloitte & Touche CPA and has held CTO roles. For over 30 years, Marty has produced leadership in ERP, CRM and eCommerce business systems. Contact Marty to set up a conversation.

Biography • Website • X (Twitter) • Facebook • LinkedIn • YouTube

25 thoughts on “How to Connect NetSuite Web Services with Java

  1. Raghavendra Tammina says:

    Please send me a complete documentation(to my email) for Netsuite integration with java..

  2. Marty Zigman says:

    Hello Raghavendra,

    Did you join NetSuite’s Solution’s Developer Network?

    There are code samples in the secured user group. The basic connections follow any Java client consumption of web services technologies.

    Most of the recent work we have done with Java is via REST APIs and using NetSuite’s latest RESTLet technologies. We are finding this to be are preferred approach for rapid development where we have full control over both the server and the client.

    Marty

  3. this is a weird approach. do you mean i would have to set up a server, separate to NS? i work with a client who uses the documents->file cabinet for their ns relaed websie. is my customers approach all wrong? why are you doing java? i see the difference would be using ready made web services versus writing your own(and plugging the results directly to a web page). BUT since NS is so customizable, how would the ready made web services do what i need to accomplish?

  4. Marty Zigman says:

    Here is an article that shows how you can connect to NetSuite Web Services with Java as a client but not use the WebServices or Axis library. It’s basically XML over HTTP.

  5. Avinash says:

    Hi Martin,

    Can you please give me any example of calling .net(WCF) webservices using Userevent script.

  6. faizan siddiki says:

    Hi
    Sir i am fresher in java and recently joined a company deals in Netsuite so i don’t know about
    NS and how to make connectors or services
    Please refer me a link or guide on which i can learn about it and start my career

  7. Marty Zigman says:

    Hello Faizan,

    I recommend you join the NetSuite SDN program under the community license. It is free of charge and a great way to learn the power of the platform:

    https://www.netsuite.com/portal/developers/sdn.shtml

    Marty

  8. Shubham says:

    Thanks. Information was helpful.

    Can anyone help me out with the code for above.

  9. Pradeep says:

    Hello Sir,

    Greetings!

    I am new in netsuite.Till the date i’am familier with suitelet,user event script,client script.Now i want to use webservices can you help me for the same.

    Thanks in advance.

  10. Marty Zigman says:

    Pradeep,

    Web services is really about your client side technology to consume the server side Web Services API. Be sure to use the Suite Talk Schema Browser to help you learn the NetSuite library.

    Marty

  11. kumaran says:

    Hi Sir,

    Can you please to guide me to do the search for payment method using web services.

  12. Marty Zigman says:

    Hello,

    Follow the NetSuite guide located here for access to the Payment Methods:

    Help–> SuiteCloud (Customization, Scripting, and Web Services) –> SuiteTalk (Web Services) –> SuiteTalk (Web Services) Records Guide –> Other Lists –> Payment Method

    Marty

  13. Diego Arguelles says:

    Hello Mr. Zigman, i hope ur’ fine. I’m making an application based on Java and Spring framework and i need to communicate via web service with my netsuite account. Is Apache Axis the only way for do that?
    Please, if you can send me all the posible documentation (and examples) for do my job to best way possible, i’ll be very very grateful.
    i’ll be waiting for your answer, thanks in advance.
    Saludos desde Peru!!!

  14. Marty Zigman says:

    Hello Diego,

    There are different ways to connect up Java to NetSuite Web Services. The questions you are asking are fundamental Java questions to connect to any Web Service; not just NetSuite. The key is to understand the different Java client implementations to web services and then get reference to NetSuite’s WSDL to build your java class(es).

    This article looks like a good reference for beginners. NetSuite’s help document has some basic examples. .

    Once you get past the hurdle to connect, most developers then have a learning curve to get over to understand the mechanics of the NetSuite’s SuiteTalk web services API. It’s abstract and it helps to understand the NetSuite platform and business system so concepts make sense. Many times, my team is engaged to help customers and other NetSuite partners learn the platform.

  15. Diego Arguelles says:

    Ok Mr. Zigman, thanks for your response. Maybe my question is not all clear. On NetSuite page (https://www.netsuite.com/portal/developers/resources/suitetalk-sample-applications.shtml) is an example to connect WS with Axis, but this doesn’t work. The WSDL (https://webservices.netsuite.com/wsdl/v2014_2_0/netsuite.wsdl) show me this error when i want to implemment the Java Client: IWAB0399E Error in generating Java from WSDL: java.io.IOException: WSDL2Java emitter timed out (this often means the WSDL at the specified URL is inaccessible)!. Is for that reason that i need a functional example for develop it.
    Thanks in advance, regards.

  16. Robert Ryan says:

    Marty:

    Thanks for this article; I am an independent software developer with a client who wishes integrate their custom Java application with Netsuite.

    I am dismayed to find that apparently Netsuite does not provide a native RESTful api but instead is relying on an out-dated SOAP interface. As I started to read thru the documentation, I am very unhappy to see the Axis1 dependency (last release almost 10 years ago!); this tells me that Netsuite is ‘under investing’ in integration components/tooling for software developers.

    As you seem to be plugged into the Netsuite / Java integration space, perhaps you could help me (and your other readers) understand how best to integrate existing Java applications with Netsuite without building dependencies on a SOAP/Axis api that is clearly out-dated and most certainly be slated for retirement.

    Many thanks

  17. Marty Zigman says:

    Hi Robert,

    Thanks for your thoughts. However, let me clarify your thinking about REST. NetSuite completely supports a REST layer. They call it RESTLets and the difference is that you have to design the endpoint. As experts in NetSuite, the full backend is available for business logic. We use this technique all the time and have built a number of Java applications that avoid NetSuite Web Services and instead consume REST (both directions).

    As far as Web Services, you can start with NetSuite’s WSDL and go from there using anything you really want. I should say though that NetSuite’s Web Services interaction has a learning curve associated with it. It’s relatively abstract. Web Services are a great way to go when you don’t want to install any bundle software in the client’s environment. With REST, you need to create a “SuiteBundle” to move the code into the environment so the endpoint can be consumed.

    Marty

    Marty

  18. Phanikumar says:

    Hi sir,

    From Last year when i started with netsuite i am following this. and you are giving hope for the unknown things,

    Here i am using User Event after submit of the Item fulfillment, By using nlapiRequestURL i am sending internalid with url and Json object of the field values of fulfillment to the external site which is taking response, they are getting the id but json object not getting why?
    nlapiRequestURL(JL_ServiceURL,JsonVar,Header,HttpMethod);

  19. Marty Zigman says:

    Are you using JSON.stringy(var) before you send it? Also, we have a utility that you can use to help you see posts: https://blog.prolecto.com/2014/09/14/diagnose-and-inspect-netsuite-https-posts/

  20. Phanikumar says:

    Hi sir, Really Thankful you for replying,
    here i am sending request as follows to external (out side to netsuite) using asfollows,

    var SO = [{“createdDateSpecified”:false,
    “customForm”:CustomForm,”entity”:Entity,”job”:””, “currency”:Currency,”drAccount”:””,”fxAccount”:””]}

    var JsonVar = JSON.stringify(SO);

    var Header = [];
    Header[‘User-Agent-x’]=”SuiteScript-Call”;
    Header[‘Content-Type’]=”application/json”;

    var HttpMethod = new Array();
    HttpMethod[‘httpMethod’] = “POST”;

    nlapiRequestURL(JL_ServiceURL,JsonVar,Header,HttpMethod);

  21. Marty Zigman says:

    Check your signature. The fourth parameter is the callback parameter and you are calling it a method:
    Here is what it should be: nlapiRequestURL(url, postdata, headers, callback, httpMethod)

    Search help on “nlapiRequestURL” and see the examples given for calling RestLets. Should be okay.

    Marty

  22. Phanikumar says:

    Hi sir,

    I am using User Event then callback parameter will not be there, and what i am doing here is…. Sending the JSON data through the nlapiRequestURL API to out side url(ex: http://www.google.com) which is ready to take request and give response with User Event…is it right?

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *