我们正在使用带有分布式部署的API Manager 2.1.0(双网关)。 当我们使用soap端点创建SOAP API时,我们会收到错误。 以下是我们在API创建者Web界面中遵循的步骤:
保存时,导入WSDL时出错:
ERROR {org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader} - Error occurred while getting the wsdl address location {org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader}
java.net.MalformedURLException: no protocol: null/testphone/1.0
at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader.setServiceDefinition(APIMWSDLReader.java:307)
at org.wso2.carbon.apimgt.impl.utils.APIMWSDLReader.updateWSDL(APIMWSDLReader.java:156)
at org.wso2.carbon.apimgt.impl.utils.APIUtil.createWSDL(APIUtil.java:1375)
at org.wso2.carbon.apimgt.impl.APIProviderImpl.updateWsdl(APIProviderImpl.java:731)
at org.wso2.carbon.apimgt.impl.APIProviderImpl.updateAPI(APIProviderImpl.java:836)
at org.wso2.carbon.apimgt.impl.UserAwareAPIProvider.manageAPI(UserAwareAPIProvider.java:72)
at org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject.saveAPI(APIProviderHostObject.java:1061)
at org.wso2.carbon.apimgt.hostobjects.APIProviderHostObject.jsFunction_updateAPIImplementation(APIProviderHostObject.java:672)
at sun.reflect.GeneratedMethodAccessor392.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:126)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:386)
并且导入的WSDL(在注册表中)在wsdl:port中的位置为null。 如果我们只使用一个网关并导入相同的WSDL,我们就没有错误,一切顺利。 该问题与WSDL无关,它与所有WSDL一起发生。 我们怎么解决呢?
答案 0 :(得分:0)
我们已经解决了问题。这些是我们通过此链接(https://wso2.org/jira/browse/APIMANAGER-5843)和(https://github.com/wso2/carbon-apimgt/pull/4301/commits/c9d38bd0864bc84b3d8f5731ccc6a49068448f33)使用的步骤:
找到方法getGatewayendpoint(String transports)并将其替换为以下代码行:
public static String getGatewayendpoint(String transports) {
String gatewayURLs;
Map<String, Environment> gatewayEnvironments = ServiceReferenceHolder.getInstance()
.getAPIManagerConfigurationService()
.getAPIManagerConfiguration()
.getApiGatewayEnvironments();
if (gatewayEnvironments.size() > 1) {
for (Environment environment : gatewayEnvironments.values()) {
if (APIConstants.GATEWAY_ENV_TYPE_HYBRID.equals(environment.getType())) {
gatewayURLs = environment.getApiGatewayEndpoint(); // This might have http,https
// pick correct endpoint
return APIUtil.extractHTTPSEndpoint(gatewayURLs, transports);
}
}
for (Environment environment : gatewayEnvironments.values()) {
if (APIConstants.GATEWAY_ENV_TYPE_PRODUCTION.equals(environment.getType())) {
gatewayURLs = environment.getApiGatewayEndpoint(); // This might have http,https
// pick correct endpoint
return APIUtil.extractHTTPSEndpoint(gatewayURLs, transports);
}
}
for (Environment environment : gatewayEnvironments.values()) {
if (APIConstants.GATEWAY_ENV_TYPE_SANDBOX.equals(environment.getType())) {
gatewayURLs = environment.getApiGatewayEndpoint(); // This might have http,https
// pick correct endpoint
return APIUtil.extractHTTPSEndpoint(gatewayURLs, transports);
}
}
} else {
gatewayURLs = ((Environment) gatewayEnvironments.values().toArray()[0]).getApiGatewayEndpoint();
return extractHTTPSEndpoint(gatewayURLs, transports);
}
return null;
}
找到org.wso2.carbon.apimgt.impl_6.1.66并将该类替换为新的APIUtil.java
现在您可以在多网关上发布