First make sure the UDDI server that is part of your NetWeaver installation is set up. To do this follow the excellent article on setting up a local UDDI server by Anne Lanfermann. Follow the instructions there on configuring your server for setting up a registry and add a new one for the XMethods UDDI server (I named it XMethods Registry to be clear about the text below). You will need to set the Inquiry URL to http://uddi.xmethods.net/inquire and the Publish URL to https://uddi.xmethods.net/publish. Now, as if you haven’t already impatiently done so, fire up the NetWeaver IDE. Create a Web service Standalone Proxy project and then create a new Client Proxy Definition. Fill in the required parameters and choose the radio button for UDDI or URL. In the next dialog select UDDI. You will see that the XMethods Registry added above is available as an option to search.
Being a political junky in an election year I’ll search for “WhoIsGoingToBePresident?”. (Note that you need to use the scroll bar as the search button is unfortunately hidden low in the window) Wouldn’t you know it, I get a hit. (I cheated of course, I subscribe to the XMethods RSS feed so I saw this one show up last week there)
I got back this nice little page shown above where I can review if this is what I want or not. Based on the description here that this Web service returns the latest polling data for the 2004 US Presidential election how can I pass this up? Select OK and hit next. I’ve added a Java scrapbook page to my project just to try this out. Here is the code.
com.example.PresidentialElectionResults2004 service = new com.example.PresidentialElectionResults2004Impl();
com.example.PresidentialElectionResults2004BindingStub election = (com.example.PresidentialElectionResults2004BindingStub)service.getLogicalPort();
com.example.types.Results results = com.example.whoisgoingtobepresident();
System.out.println("Bush = " + results.getBush());
System.out.println("Kerry = " + results.getKerry());
The output I got today for that is:
Bush = 231
Kerry = 307
If I were really clever I’d add a routine to compensate for inevitable electronic voting machine fraud, but for now I’ll leave it as an exercise for the reader.
A note on a common problem. Don’t forget to set your proxy server settings for the IDE and the J2EE server. For the IDE it is under Preferences, Workbench, Proxy Settings. For the server in the Visual Administrator go to Services, Web services Container and select the Settings tab.