WSO2 EI 6.1.1 Axis2Sender报错:无法从URL推断传输信息
解决WSO2 EI 6.1.1中Axis2Sender错误:"The system cannot infer the transport information from the /helloworld URL"
我之前在使用WSO2 EI做SOAP请求转发时也碰到过完全相同的问题,折腾了好一阵才找到根源——你的Endpoint配置没有给Axis2提供足够的传输信息,导致它无法确定请求该用什么协议(HTTP/HTTPS)以及完整的目标地址。
核心问题分析
从报错堆栈能看到,错误发生在ClientUtils.inferOutTransport方法里,说明Axis2无法从你指定的/helloworld这个相对URL里推断出传输协议和完整地址。虽然直接调用代理或Web Service时正常,但通过Send Mediator转发时,动态构造的请求上下文丢失了必要的传输元数据,而你的WSDL Endpoint配置又没有明确补上这些信息。
具体解决方案
下面针对你的API和Proxy配置给出两种可行的修改方式:
1. 替换WSDL Endpoint为Address Endpoint(推荐)
直接用明确的完整服务地址替换WSDL引用,这样Axis2能直接获取传输信息:
修改后的API中Send Mediator部分:
<send> <endpoint> <!-- 直接指向Proxy的完整服务地址,去掉?wsdl后缀 --> <address uri="http://localhost:8280/services/GreetingProxy"/> </endpoint> </send>
修改后的Proxy中Endpoint部分:
<endpoint name="endpoint_urn_uuid_1FF78996948B9A0B6E14565751214774-1218279313"> <!-- 指向实际Web Service的完整端点地址,不是WSDL文件地址 --> <address uri="http://localhost:8080/HelloWorldWS/ws/greeting"/> </endpoint>
2. 保留WSDL Endpoint但补充传输配置
如果一定要用WSDL Endpoint,需要确保WSDL文件里的服务地址是完整URL,同时在配置中明确指定transport属性:
API中的WSDL Endpoint修改:
<send> <endpoint> <wsdl port="GreetingProxyHttpSoap11Endpoint" service="GreetingProxy" uri="http://localhost:8280/services/GreetingProxy?wsdl"> <!-- 明确指定传输协议 --> <property name="transport" value="http"/> </wsdl> </endpoint> </send>
Proxy中的WSDL Endpoint修改:
<endpoint name="endpoint_urn_uuid_1FF78996948B9A0B6E14565751214774-1218279313"> <wsdl port="GreetingPortSoap11" service="GreetingPortService" uri="http://localhost:8080/HelloWorldWS/ws/greeting.wsdl"> <property name="transport" value="http"/> </wsdl> </endpoint>
额外注意事项
- 确保你指定的服务地址是可访问的,不要带
?wsdl后缀——?wsdl是用来获取WSDL文件的路径,实际调用服务需要用不带这个后缀的端点地址。 - 检查你的Web Service发布的WSDL文件,确认其中的
<address>元素是完整的URL(比如http://localhost:8080/HelloWorldWS/ws/greeting),而不是相对路径。
按照上面的方法修改后,Axis2就能正确获取传输信息,这个错误应该就会消失了。
内容的提问来源于stack exchange,提问作者LottaLava
相关产品推荐
相关产品推荐

