views:

175

answers:

4

I'm trying to use some data from a PlanPlusOnline account. They only provide a java web services API. The server for the site where the data will be used does not allow me to install Tomcat (edit: or a JVM for that matter). I'm not going to lie, I am a Java software engineer, and I do some web work on the side. I'm not familiar with web services or servlets, but I was willing to give it a shot. I'd much rather they have JSON access to the data, but as far as I know they don't. Any ideas?

EDIT: to clarify. The web service provided by planplusonline is Java based. I am trying to access the data from this web service without using Java. I believe this is possible now, but I need to do more research. Anyone who can help point me in the right direction is appreciated.

A: 

Are you trying to implement a client to a web service hosted somewhere else? If so, Java's not necessary. You can do web service clients in .NET, PHP, Ruby, or pretty much any modern web technology out there. All you need is a WSDL document to provide metadata about how to invoke the services.

jodonnell
+1  A: 

To follow up with jodonnell's comment, a Web service connection can be made in just about any server-side language. It is just that the API example they provided was in Java probably because PlanPlusOnline is written in Java. If you have a URL for the service, and an access key, then all you really need to do is figure out how to traverse the XML returned. If you can't do Java, then I suggest PHP because it could be already installed, and have the proper modules loaded. This link might be helpful:

http://www.onlamp.com/pub/a/php/2007/07/26/php-web-services.html

hal10001
A: 

Thanks for making what should have been obvious to me, more clear. I believe I have some reading and research ahead of me, the link seems to be a great start. PHP is the language of choice so any further advice on this topic will be appreciated, but mostly I need to do some research.

Thanks again to both jodonnell and hal10001!

drye
A: 

If I am understanding your question correctly, you only need to connect to an existing web service and not create your own web service. If that is a case, and maybe I am missing something, I do not believe you will need Tomcat at all. If you are using Netbeans you can create a new Desktop or Web application, and then right click the project name. Select New and then other, and select Web Client. Enter the information for where to find the WSDL (usually a URL) and the other required information.

Once you added the WebClient create a new class that actually makes your calls to the webservice. If the web service name was PlanPlusOnline then you could have something like:

public final class PlanPlusOnlineClient
{
    //instance to this class so that we do not have to reinstantiate it every time
    private static PlanPlusOnlineClient _instance = new PlanPlusOnlineClient();

    //generated class by netbeans with information about the web service
    private PlanPlusOnlineService service         = null;

    //another generated class by netbeans but this is a property of the service
    //that contains information about the individual methods available.
    private PlanPlusOnline port                   = null;

    private PlanPlusOnlineClient()
    {
        try
        {
            service = new PlanPlusOnlineService();
            port = service.getPlanPlusOnlinePort();
        }
        catch (MalformedURLException ex)
        {
            MessageLog.error(this, ex.getClass().getName(), ex);
        }
    }

    public static  PlanPlusOnlineClient getInstance()
    {
        return _instance;
    }

    public static String getSomethingInteresting(String param)
    {
         //this will call one of the actual methods the web 
         //service provides.
         return port.getSomethingIntersting(param);
    }    

}

I hope this helps you along your way with this. You should also check out http://www.netbeans.org/kb/60/websvc/ for some more information about Netbeans and web services. I am sure it is similar in other IDEs.

jschoen