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 <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>> 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: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>
    For additional commands, e-mail: [EMAIL PROTECTED]
    <mailto:[EMAIL PROTECTED]>



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to