注:我找不到这个问题的直接答案,所以我将在下面记录我的解决方案作为答案。
我使用 Axis 1.4 从 wsdl 生成了 webservice 的服务器端部分axistools-maven-plugin
. Axis servlet 映射到 /services/*
, 这
服务配置在 WEB-INF/server-config.wsdd
如下:
<deployment xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="TestService" style="document" use="literal">
<namespace>http://example.com/testservier</namespace>
<parameter name="className" value="com.example.TestServiceImpl"/>
<parameter name="allowedMethods" value="*"/>
<parameter name="scope" value="Session"/>
</service>
</deployment>
当我将此 Web 应用程序部署到 Tomcat 并访问时
http://localhost:8080/testservice/services
部署的服务列表是回来。
And now... Some Services
- TestService (wsdl)
- TestService
点击
wsdl
应该返回此服务的描述,但会导致以下错误页面:AXIS error
Could not generate WSDL!
There is no SOAP service at this location
最佳答案
server-config.wsdd
缺少必要的配置设置。
<transport name="http">
<requestFlow>
<handler type="java:org.apache.axis.handlers.http.URLMapper"/>
</requestFlow>
</transport>
看来
URLMapper
负责从中提取服务名称url,没有它, Axis 不知道要调用哪个服务。这是一种
记录在 axis faq 中:
This mechanism works because the HTTP transport in Axis has the URLMapper (org.apache.axis.handlers.http.URLMapper) Handler deployed on the request chain. The URLMapper takes the incoming URL, extracts the last part of it as the service name, and attempts to look up a service by that name in the current EngineConfiguration.
Similarly you could deploy the HTTPActionHandler to dispatch via the SOAPAction HTTP header. You can also feel free to set the service in your own custom way - for instance, if you have a transport which funnels all messages through a single service, you can just set the service in the MessageContext before your transport calls the AxisEngine
这使它听起来像
URLMapper
默认情况下会配置,但情况似乎并非如此。
关于web-services - Axis 错误 : There is no SOAP service at this location,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8804717/