【问题标题】:WSDL generated filesWSDL 生成的文件
【发布时间】:2014-10-19 19:49:06
【问题描述】:

我创建了一个使用 SOAP 服务器端点来执行一些操作的 Web 应用程序(使用 JSP)。我使用 gradle 来自动化构建。我的问题是,当我运行 WebApp 时,它没有找到 WSDL 生成的类(我已经在 build.gradle 中指定了它们)。

我的 servlet 源文件在 /src/main/java/servlets 中,生成的 WSDL 文件在 /src-gen/main/java/todo_soap 中。

这是我的 WebApp build.gradle

    buildscript {
    repositories {
        jcenter()
    mavenCentral()
    }

    dependencies {
        classpath (group: 'com.sahlbach.gradle', name: 'gradle-jetty-eclipse-plugin', version: '1.9.+')
    classpath 'org.gradle.jacobo.plugins:gradle-wsdl-plugin:1.7.6'
    classpath 'org.gradle.jacobo.plugins:gradle-jaxb-plugin:1.3.4'
    }
}

apply plugin: 'com.github.jacobono.wsdl'
apply plugin: 'com.github.jacobono.jaxb'

apply plugin: 'java'
apply plugin: 'war'
apply plugin: 'jettyEclipse'
apply plugin: 'eclipse'
apply plugin: 'eclipse-wtp'

repositories {
   mavenCentral()                                               
}

dependencies {
   providedCompile 'javax.servlet:javax.servlet-api:3.0.1'
   compile 'com.google.code.gson:gson:2.3'
   jaxws "com.sun.xml.ws:jaxws-rt:2.2.8"
   jaxws "com.sun.xml.ws:jaxws-tools:2.2.8"
}

//
// See the documentation of this plugin at
// https://github.com/jacobono/gradle-wsdl-plugin
// 

wsdl {
  wsdlFolder = "src/main/wsdl"
  wsimport {
    sourceDestinationDirectory = "src-gen/main/java"
    wsdlLocation = "http://localhost.com:8081/toDoSOAP?wsdl"
  }
}

sourceSets.main.java.srcDirs += wsdl.wsimport.sourceDestinationDirectory
compileJava.dependsOn wsimport 

//
// Required by XJC because toDoSOAP.xsd is a file
//

System.setProperty('javax.xml.accessExternalSchema', 'all')

My full project here

【问题讨论】:

  • 我们肯定需要更多信息。什么没有找到究竟是什么?是否有任何错误消息或堆栈跟踪?

标签: java web-services servlets soap wsdl


【解决方案1】:

我刚刚测试了您的代码。以下是Martijn Courteaux 请求的缺失信息示例:

/Users/javier/Downloads/Lab1-master/ToDo_SOAP_WebApp-ws/src/main/java/servlets/ToDoAddServlet.java:39: error: cannot find symbol
        ToDoWebServiceService twss = new ToDoWebServiceService();
        ^
symbol:   class ToDoWebServiceService
location: class ToDoAddServlet

错误的原因是您忘记在文件ToDoAddServlet.java 中添加import todo_soap.*;。如果查看src-gen\main\java,可以看到生成的代码属于包todo_soap

【讨论】:

    猜你喜欢
    • 2014-02-01
    • 1970-01-01
    • 2010-10-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-03-18
    • 1970-01-01
    相关资源
    最近更新 更多