Search code examples
wsdlwsdl2javawsdl2codewsdl4j

How can i get service details from the port definition in a wsdl file?


Im using JAVA APIs(javax.wsdl.*) to parse my WSDL file.

My purpose is to edit the wsdl's service address to a custom location. For that, i use JAVA APIs to parse my wsdl and access the service address location and want to edit it.

I'm able to get WSDL Port objects, but i don't know how can i get the address location from the PORT definition. I can retrive the PORT Bindings from PORT definition, but i couldn't find a way to access the "address location".

This is my sample code snippet. Can anyone give a hint?

          Map servicemap = definition.getAllServices();

    Iterator it = servicemap.entrySet().iterator();
    while (it.hasNext()) {
        Map.Entry pairs = (Map.Entry) it.next();
        Object svcobj = pairs.getValue();
        Service svc = (Service) svcobj;
        Map portMap = svc.getPorts();
        Iterator portItr = servicemap.entrySet().iterator();
        while (portItr.hasNext()) {
            Map.Entry portPairs = (Map.Entry) portItr.next();
            Object portobj = pairs.getValue();
            Port port = (Port) portobj;             
        }

Solution

  • I have sorted out this using ExtensibilityElements. Have written a detail post on how we can do this. May be useful to others.