Question

My wsdl contains SOAP11,SOAP12 and HTTP bindings. When i try to retrieve the Address Location from the HTTPBinding, my sample code block throws error

."Unsupported wsdl errors!"

(i used wsdl4j to read the wsdl)

My sample code to retrieve AddressLocation is as follows;

private String getAddressUrl(ExtensibilityElement exElement) throws APIManagementException {

        if (exElement instanceof SOAP12AddressImpl) {
            return ((SOAP12AddressImpl) exElement).getLocationURI();
        } else if (exElement instanceof SOAPAddressImpl) {
            return ((SOAPAddressImpl) exElement).getLocationURI();
        } else {
            String msg = "Unsupported WSDL errors!";
            log.error(msg);
            throw new APIManagementException(msg);
        }
    }

Here i see only "SOAP12AddressImpl" and "SOAPAddressImpl" are available in the WSDL4J. So, when i pass HTTPbinding data, above code throws error. My sample HTTP binding extensibility element is;

HTTPAddress ({http://schemas.xmlsoap.org/wsdl/http/}address):
required=null
locationURI=http://10.100.1.35:9000/services/SimpleStockQuoteService.SimpleStockQuoteServiceHttpEndpoint.

How can i read address location from HTTPBinding ? is there implementation available in the wsdl4j?

Was it helpful?

Solution

Sorry my bad; HTTP addressimplementaion also available in wsdl4j. Corrected my code like this;

if (exElement instanceof SOAP12AddressImpl) {
            return ((SOAP12AddressImpl) exElement).getLocationURI();
        } else if (exElement instanceof SOAPAddressImpl) {
            return ((SOAPAddressImpl) exElement).getLocationURI();
        } else if (exElement instanceof HTTPAddressImpl) {
            return ((HTTPAddressImpl) exElement).getLocationURI();
        } else {
            String msg = "Unsupported WSDL errors!";
            log.error(msg);
            throw new APIManagementException(msg);
        }
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top