【问题标题】:AXIS error: There is no SOAP service at this locationAXIS 错误:此位置没有 SOAP 服务
【发布时间】:2012-01-10 14:19:27
【问题描述】:

注意:我找不到此问题的直接答案,因此我将在下面记录我的解决方案作为答案。

我使用 Axis 1.4 从 wsdl 生成了 Web 服务的服务器端部分,并且 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 已部署服务的列表是 返回。

现在...一些服务

  • 测试服务 (wsdl)
    • 测试服务

单击wsdl 应该返回此服务的描述,但会导致以下错误页面:

轴错误

无法生成 WSDL!

此位置没有 SOAP 服务

【问题讨论】:

    标签: web-services axis


    【解决方案1】:

    server-config.wsdd 缺少必要的配置设置。

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

    似乎URLMapper 负责从中提取服务名称 没有它的 url 轴不知道要调用哪个服务。这是一种 记录在axis faq:

    此机制之所以有效,是因为 Axis 中的 HTTP 传输在请求链上部署了 URLMapper (org.apache.axis.handlers.http.URLMapper) 处理程序。 URLMapper 获取传入的 URL,将其最后一部分提取为服务名称,并尝试在当前 EngineConfiguration 中按该名称查找服务。

    同样,您可以部署 HTTPActionHandler 以通过 SOAPAction HTTP 标头进行调度。您还可以随意以您自己的自定义方式设置服务 - 例如,如果您有一个通过单个服务汇集所有消息的传输,您可以在传输调用 AxisEngine 之前在 MessageContext 中设置该服务

    这听起来像是 URLMapper 会默认配置,但似乎并非如此。

    【讨论】:

    • Horstmann 但是我们如何打开那个 server-config.wsdd 文件呢?我遇到了完全相同的问题。
    【解决方案2】:

    当我遇到这个问题时,它是由使用错误的 URL 引起的。

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

    AdminWebService 必须更改为 AdminService

    【讨论】:

      【解决方案3】:

      您最好以“admin”为目标自动构建 server-config.wsdd。请参阅有关此插件的文档:

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

      手动生成server-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>
      

      【讨论】:

        【解决方案4】:

        我最近遇到了同样的问题。

        解决方案: 在我的例子中,我使用的是 Axis 1.4,并在 tomcat 上部署了应用程序。但是,由于某种原因,生成的 server-config.wsdd 没有在战争中打包,因此没有部署在 tomcat 上。有一次,我确保发生这种情况,它开始对我正常工作。

        【讨论】:

          【解决方案5】:
          • 您确保 server-config.wsdd 在您的包中,您可以将此文件放入资源中,或者您可以通过 maven 在 pom.xml 中设置哪些文件将在包中
          • server-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>
          

          【讨论】:

            猜你喜欢
            • 2011-12-30
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2018-08-20
            相关资源
            最近更新 更多