axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Demetris G <demet...@ece.neu.edu>
Subject Re: WSDL parser
Date Fri, 22 Feb 2008 06:22:48 GMT

Hi all,

    does anyone know of a piece of code similar to the one below that 
can read/parse  a local WSDL file
serialized in a string rather than a remote WSDL given by a URI?

Thanks

Sukma Agung Verdianto wrote:
> Hi Demetris,
>
> You can try to use wsdl4j (http://sourceforge.net/projects/wsdl4j) to 
> get the operations of specified wsdl file. (AFAIK, Axis2 uses this in 
> their wsdl2java code)
>
> public static void main(String[] args) throws Exception {
>
> WSDLFactory fac = WSDLFactoryImpl.newInstance();
>
> WSDLReader reader = fac.newWSDLReader();
>
> Definition def = 
> reader.readWSDL("http://api.google.com/GoogleSearch.wsdl");
>
> Map services = def.getServices();
>
> for(Object serviceKey : services.keySet()) {
>
> QName serviceQName = (QName) serviceKey;
>
> Service service = (Service) services.get(serviceQName);
>
> System.out.println("Namespace: " + 
> service.getQName().getNamespaceURI() + ", Service Name: " + 
> service.getQName().getLocalPart());
>
> Map ports = service.getPorts();
>
> for(Object portKey : ports.keySet()) {
>
> String portName = (String) portKey;
>
> Port port = (Port) ports.get(portName);
>
> System.out.println("  Namespace: " + 
> port.getBinding().getQName().getNamespaceURI() + ", Binding Name: " + 
> port.getBinding().getQName().getLocalPart());
>
> List operations = port.getBinding().getBindingOperations();
>
> for(Object operation : operations) {
>
> BindingOperation op = (BindingOperation) operation;
>
> System.out.print("    Operation Name: " + op.getName());
>
> List ll = op.getExtensibilityElements();
>
> for(Object soap : ll) {
>
> if(SOAPOperation.class.isInstance(soap)) {
>
> System.out.print(" (" + ((SOAPOperation)soap).getSoapActionURI() + ")");
>
> }
>
> }
>
> System.out.println();
>
> }
>
> }
>
> }
>
> }
>
>
> Above code read remote wsdl, and extract its information.
>
> Regards,
> Sukma
>
> On Feb 17, 2008 2:09 PM, Demetris G <demetris@ece.neu.edu 
> <mailto:demetris@ece.neu.edu>> wrote:
>
>
>     Hi all,
>
>        I am trying to use the wsdlParser from the Axis API to parse
>     the methods
>     out of an incoming WSDL file - does anyone who has used this
>     before have
>     any info on how to use this tool? OR any other way I could get the
>     operations
>     of the remote service out of the WSDL file? I would appreciate it.
>
>     Thanks
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
>     <mailto:axis-user-unsubscribe@ws.apache.org>
>     For additional commands, e-mail: axis-user-help@ws.apache.org
>     <mailto:axis-user-help@ws.apache.org>
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Mime
View raw message