I see two simpler ways to do this. 1. File an enhancement request (or better yet, make a patch) that extends the FileInfo stuff to include the list of 'get' interfaces in the Service class.
2. Since you know the class name of the port, you can just construct the name of the get<portClassName> API and just call it. One of our products (ColdFusion MX) uses the second solution, which is why I added the GeneratedFileInfo in the first place, so programs wouldn't have to guess what WSDL2Java did. :-) -- Tom Jordahl Macromedia -----Original Message----- From: Russell Butek To: [EMAIL PROTECTED] Sent: 6/5/2002 7:06 AM Subject: Re: query regarding org.apache.axis.wsdl.toJava.Emitter class Oops! I see Sandeep also send this request to axis-dev. I'm forwarding my response to him in case anyone else cares to see a solution. Russell Butek [EMAIL PROTECTED] ---------------------- Forwarded by Russell Butek/Austin/IBM on 06/05/2002 09:05 AM --------------------------- To: Sandeep Lakshmipathy/India/IBM@IBMIN cc: From: Russell Butek/Austin/IBM@IBMUS Subject: Re: query regarding org.apache.axis.wsdl.toJava.Emitter class Importance: Normal Sorry, the color was lost when the note got to me. I'm assuming you want to find the name of "getStockQuoteServicePort"? You can get this, but it's not simple. First you need the symbol table: SymbolTable st = emitter.getSymbolTable(); Now you have to find the ServiceEntry for "StockQuoteServiceName". This is rather tough. You've got the package name, but the symbol table is organized by QName. You could do one of two things: 1. search through the symbol table looking for an entry whose getName() method (which contains the Java name) equals your fully qualified class name, or 2. Get the namespaces class (emitter.getNamespaces()) which contains mappings from XML namespaces to package names. But since you have to do the reverse mapping, it would mean searching the values of this map until you found your package, then finding this value's key. This is a much smaller map than the symbol table. Once you've got the QName you can call: ServiceEntry se = st.getServiceEntry(qname); javax.wsdl.Service service = se.getService(); Map ports = service.getPorts(); Note that a service can have any number of ports, so there's no way to get any single one. But in most cases there IS only one, so the Map returned by getPorts will only have one element. In that case... Port port = (Ports) ports.values().iterator().next(); String portName = org.apache.axis.wsdl.toJava.Utils.xmlNameToJavaClass(p.getName()); portName will be the name of the method. HOWEVER! Since this is all rather messy, you may be better off simply extending the emitter framework. Here's a quick program I wrote which does what I think you want: (See attached file: MyMain.java)(See attached file: PortNamesGenerator.java). It was rather fun to write this, it tested the extensibility of the framework. Russell Butek [EMAIL PROTECTED] To: Russell Butek/Austin/IBM@IBMUS cc: Subject: query regarding org.apache.axis.wsdl.toJava.Emitter class Dear Russell, I have been using the Emitter class to generate the stubs for the given WSDL URI. I am using the getGeneratedFileInfo() method and the returned GeneratedFileInfo object to retrieve information about the generated classes. Now I want to find out the name of the method(i.e. the Port for the service, see code in BLUE) that i want to invoke. Can I get this info from using the Emitter class or any other related class? public interface StockQuoteServiceName extends javax.xml.rpc.Service { public String getStockQuoteServicePortAddress(); public localhost.StockQuoteServicePortType getStockQuoteServicePort() throws javax.xml.rpc.ServiceException; public localhost.StockQuoteServicePortType getStockQuoteServicePort(java.net.URL portAddress) throws javax.xml.rpc.ServiceException; } Sandeep L IBM Global Services Bangalore <<MyMain.java>> <<PortNamesGenerator.java>>