eclipse - find and call web service from uddi java -
so have been looking around days , still can't find simple working method. trying do:
1 - search , find web services registered in uddi based on keywords 2 - decide service fits , use/call it
all using java (eclipse).
i don't want create own uddi nor want publish services, find existing services stored in public uddi (i believe there's one, right?). thought these 2 tasks (find ws, call ws) easy , possible find sample code use, can't find any.
i came across juddi while searching, not sure if works case , if it's worth installing.
any tutorials? suggestions ? found following code, can't find jar file use libraries:
/* * change template, choose tools | templates * , open template in editor. */ package uddi.createbulk; import javax.xml.bind.jaxb; import org.apache.juddi.v3.client.config.uddiclient; import org.apache.juddi.v3.client.config.uddiclientcontainer; import org.apache.juddi.v3.client.transport.transport; import org.apache.juddi.v3_service.juddiapiporttype; import org.uddi.api_v3.*; import org.uddi.v3_service.uddiinquiryporttype; import org.uddi.v3_service.uddipublicationporttype; import org.uddi.v3_service.uddisecurityporttype; /** * * @author alex */ public class uddifindservice { private static uddisecurityporttype security = null; private static juddiapiporttype juddiapi = null; private static uddipublicationporttype publish = null; private static uddiinquiryporttype inquiry = null; public uddifindservice() { try { // create manager , read config in archive; // can use config file name uddiclient clerkmanager = new uddiclient("meta-inf/simple-publish-uddi.xml"); // register clerkmanager client side container uddiclientcontainer.addclient(clerkmanager); // clerkmanager can client multiple uddi nodes, // supply nodename (defined in uddi.xml. // transport can ws, invm, rmi etc defined in uddi.xml transport transport = clerkmanager.gettransport("default"); // create reference uddi api security = transport.getuddisecurityservice(); juddiapi = transport.getjuddiapiservice(); publish = transport.getuddipublishservice(); inquiry = transport.getuddiinquiryservice(); } catch (exception e) { e.printstacktrace(); } } public void find() { try { // setting values authentication token 'root' user ('root' user has admin privileges // , can save other publishers). getauthtoken getauthtokenroot = new getauthtoken(); getauthtokenroot.setuserid("root"); getauthtokenroot.setcred("root"); // making api call retrieves authentication token 'root' user. authtoken rootauthtoken = security.getauthtoken(getauthtokenroot); system.out.println("root authtoken = " + rootauthtoken.getauthinfo()); getservicedetail fs = new getservicedetail(); fs.setauthinfo(rootauthtoken.getauthinfo()); fs.getservicekey().add("mykey"); servicedetail servicedetail = inquiry.getservicedetail(fs); if (servicedetail == null || servicedetail.getbusinessservice().isempty()) { system.out.println("mykey not registered"); } else { jaxb.marshal(servicedetail, system.out); } } catch (exception e) { e.printstacktrace(); } } public static void main(string args[]) { uddifindservice sp = new uddifindservice(); sp.find(); } }
Comments
Post a Comment