2012-01-10 23 views
4

注:我無法找到這個問題的直接答案,所以我將以下文檔解答我的解答作爲答案。AXIS錯誤:在這個位置沒有SOAP服務

我使用Axis 1.4和 axistools-maven-plugin從wsdl生成了web服務的服務器端部分。軸心國的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

回答

8

server-config.wsdd缺少一個neccessary配置設置。

<transport name="http"> 
    <requestFlow> 
     <handler type="java:org.apache.axis.handlers.http.URLMapper"/> 
    </requestFlow> 
</transport> 

看來URLMapper負責從 提取的服務名稱的鏈接,沒有它軸不知道要調用的服務。這有點 在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將在默認情況下它似乎並沒有這樣的情況被configued。

+0

Horstmann但我們該如何打開server-config.wsdd文件?我現在正在遇到一模一樣的問題。 – user3841581 2016-11-25 11:51:36

0

你最好自動構建server-config.wsdd,目標是「admin」。查看文檔中關於這個插件:

http://mojo.codehaus.org/axistools-maven-plugin/admin-mojo.html

這是非常困難的手動生成服務器config.wsdd中。

例子:

<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> 
0

最近我有同樣的問題。

解決方案: 在我的情況下,我使用的是Axis 1.4,並在tomcat上部署應用程序。但是,由於某些原因,生成的server-config.wsdd沒有被打包到war中,因此沒有在tomcat上部署。有一次,我確保了這一切正在發生,它開始爲我工作得很好。

0
  • 您確保服務器config.wsdd中在你的包,你可以把這個文件資源,也可以在你的pom.xml通過行家哪些文件將在包
  • 服務器config.wsdd中設置必須是有效且正確的標籤或必要的配置存在,因此下面的行必須在其中;
<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> 
1

當我有這個問題,它是由使用了錯誤的URL引起的。

我用http://localhost:8080/axis/services/AdminWebService?wsdl代替http://localhost:8080/axis/services/AdminService?wsdl

AdminWebService必須更改爲AdminService