wsdl4J是否支持解析HTTP绑定?

时间:2013-12-11 12:33:46

标签: java wsdl wsdl4j

我的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中有可用的实现吗?

1 个答案:

答案 0 :(得分: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);
        }