从grails请求wsdl文件时出错

时间:2012-01-25 20:59:48

标签: web-services grails soap groovy wsdl

我正在使用: Grails的 xfire插件 我创建了包含以下代码的服务移动设备: 的服务/ MobileService.groovy

package survey

class MobileService {
    static expose=['xfire'];
    static transactional = true;
    Choice getChoices(String questionTitle_){
        return Questions.findByQuestionTitle(questionTitle_);
    }
}

UrlMappings.groovy

class UrlMappings {

    static mappings = {
        "/$controller/$action?/$id?"{
            constraints {
                controller(matches:/.*[^(services)].*/)
            }
        }
        "/"(view:"/index")
        "500"(view:'/error')
    }
}

我可以在这里看到WSDL文件的XML内容: http://127.0.0.1:8080/survey/services/mobile?wsdl 但我无法使用我的客户端阅读它,并且我遇到以下错误

  

错误2012-01-25 22:42:12,826 [“http-bio-8080”-exec-2]错误   [/survey].[XFireServlet] - Servlet的Servlet.service()   路径[/ survey]的上下文中的[XFireServlet]抛出异常消息:   密钥没有值[org.hibernate.impl.SessionFactoryImpl@4af6178d]   绑定线程[“http-bio-8080”-exec-2] Line |方法    - >> 886 | runTask in java.util.concurrent.ThreadPoolExecutor $ Worker    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 |在''^ 680 |中运行跑 。 。在java.lang.Thread

更改客户端之后,事实证明SOAP服务器和客户端工作正常。 该错误并未影响服务器。

1 个答案:

答案 0 :(得分:0)

this jira

中描述了问题和解决方案

哈克对我有用:

def doWithWebDescriptor = { xml ->
    def filters = xml.filter
    def filterMappings = xml.'filter-mapping'
    def servlets = xml.servlet
    def servletMappings = xml.'servlet-mapping'

    // define hibernate's OpenSessionInViewFilter
    def hibernateFilter = 'hibernateFilter'

    // Here's the modification I made per the JIRA:
    /*
    filters[filters.size()-1] + {
        filter {
            'filter-name'(hibernateFilter)
            'filter-class'('org.grails.xfire.OpenSessionInViewFilter')
        }
    }
    filterMappings[filterMappings.size()-1] + {
        'filter-mapping' {
            'filter-name'(hibernateFilter)
            'url-pattern'("/services/*")
        }
    }
    */

    def xfireServlet = 'XFireServlet'
    servlets[servlets.size()-1] + {
        servlet {
            'servlet-name'(xfireServlet)
            'servlet-class'('org.grails.xfire.XFireSpringServlet')
            'load-on-startup'(1)
        }
    }
    servletMappings[servletMappings.size()-1] + {
        'servlet-mapping' {
            'servlet-name'(xfireServlet)
            'url-pattern'("/services/*")
        }
    }
    servletMappings[servletMappings.size()-1] + {
        'servlet-mapping' {
            'servlet-name'(xfireServlet)
            'url-pattern'("/servlet/XFireServlet/*")
        }
    }
}