0

我的 wsdl 包含 SOAP11、SOAP12 和 HTTP 绑定。当我尝试从 HTTPBinding 检索地址位置时,我的示例代码块抛出错误

.“不支持的 wsdl 错误!”

(我使用 wsdl4j 来阅读 wsdl)

我检索 AddressLocation 的示例代码如下;

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);
        }
    }

在这里,我看到 WSDL4J 中只有“SOAP12AddressImpl”和“SOAPAddressImpl”可用。所以,当我传递 HTTPbinding 数据时,上面的代码会抛出错误。我的示例 HTTP 绑定可扩展性元素是;

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

如何从 HTTPBinding 读取地址位置?wsdl4j 中是否有可用的实现?

4

1 回答 1

0

对不起这是我的错; HTTP 地址实现也可以在 wsdl4j 中使用。像这样更正了我的代码;

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);
        }
于 2013-12-11T12:49:49.180 回答