问题
Note: I could not find a straight-forward answer to this problem so I will document my solution below as an answer.
I generated the server-side part of a webservice from a wsdl using Axis 1.4 and
the axistools-maven-plugin
. The Axis servlet is mapped to /services/*
, the
service is configured in WEB-INF/server-config.wsdd
as follows:
<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>
When I deploy this web application to Tomcat and access
http://localhost:8080/testservice/services
a list of deployed services is
returned.
And now... Some Services
- TestService (wsdl)
- TestService
Clicking on wsdl
should return the description for this service but results in the following error page:
AXIS error
Could not generate WSDL!
There is no SOAP service at this location
回答1:
The server-config.wsdd
was missing a neccessary configuration setting.
<transport name="http">
<requestFlow>
<handler type="java:org.apache.axis.handlers.http.URLMapper"/>
</requestFlow>
</transport>
It seems the URLMapper
is responsible for extracting the service name from
the url, without it axis does not know which service to invoke. This is sort of
documented in the 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
This makes it sound like the URLMapper
would be configued by default which does not seem to be the case.
回答2:
When I had this problem, it was caused by using the wrong URL.
I used http://localhost:8080/axis/services/AdminWebService?wsdl
instead of http://localhost:8080/axis/services/AdminService?wsdl
.
AdminWebService
must be changed to AdminService
.
回答3:
You better build the server-config.wsdd automatically with the goal "admin". See the documentation about this plugin:
http://mojo.codehaus.org/axistools-maven-plugin/admin-mojo.html
It is very difficult to generate the server-config.wsdd manually.
Example:
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>axistools-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<filename>${project.artifactId}.wsdl</filename>
<namespace>http://server.ws.xxx</namespace>
<namespaceImpl>http://server.ws.xxx</namespaceImpl>
<classOfPortType>XXXWebService</classOfPortType>
<location>http://localhost:8080/XX/services/XXXWebService</location>
<bindingName>XXServiceSoapBinding</bindingName>
<style>WRAPPED</style>
<use>literal</use>
<inputFiles>
<inputFile>${basedir}\src\main\webapp\WEB-INF\xxxx\deploy.wsdd</inputFile>
<inputFile>${basedir}\src\main\webapp\WEB-INF\xxxx\deploy.wsdd</inputFile>
</inputFiles>
<isServerConfig>true</isServerConfig>
<extraClasses></extraClasses>
</configuration>
<executions>
<execution>
<goals>
<goal>java2wsdl</goal>
<goal>admin</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
回答4:
I had the same problem recently.
Solution : In my case, I was using Axis 1.4 and was deploying the application on tomcat. However, for some reason the generated server-config.wsdd was not getting packaged in the war and hence was not getting deployed on tomcat. Once, I ensured this is happening, it started working fine for me.
回答5:
- you ensure server-config.wsdd in your package, you can put this file to resources or you can set in your pom.xml via maven which files will be in the package
- server-config.wsdd must be valid and correct tags or necessary config is exist so below rows must be in it;
<handler type="java:org.apache.axis.handlers.http.URLMapper" name="URLMapper"/> <handler type="java:org.apache.axis.transport.local.LocalResponder" name="LocalResponder" /> <transport name="http"> <parameter name="qs:list" value="org.apache.axis.transport.http.QSListHandler" /> <parameter name="qs:method" value="org.apache.axis.transport.http.QSMethodHandler" /> <parameter name="qs:wsdl" value="org.apache.axis.transport.http.QSWSDLHandler" /> <requestFlow> <handler type="URLMapper" /> <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler" /> </requestFlow> </transport> <transport name="local"> <responseFlow> <handler type="LocalResponder" /> </responseFlow> </transport>
来源:https://stackoverflow.com/questions/8804717/axis-error-there-is-no-soap-service-at-this-location