从 grails 请求 wsdl 文件时出错

发布于 2024-12-29 00:36:02 字数 1398 浏览 1 评论 0原文

我正在使用: 圣杯 xfire插件 我创建了包含以下代码的移动服务: services/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() [XFireServlet] 在路径 [/survey] 的上下文中抛出异常消息: 键没有值 [org.hibernate.impl.SessionFactoryImpl@4af6178d] 绑定到线程 ["http-bio-8080"-exec-2] 行 |方法 ->> 886| java.util.concurrent.ThreadPoolExecutor$Worker 中的 runTask - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 | 908运行于 '' ^ 680 |跑步 。 。在java.lang.Thread中

更改客户端后,事实证明 SOAP 服务器和客户端现在工作正常。 该错误没有影响服务器。

I'm using:
Grails
xfire plugin
and I created the service mobile containing the following code:
services/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')
    }
}

I can see XML content of WSDL file here:
http://127.0.0.1:8080/survey/services/mobile?wsdl
But I can't read it using my client and I'm having the following error:

Error 2012-01-25 22:42:12,826 ["http-bio-8080"-exec-2] ERROR
[/survey].[XFireServlet] - Servlet.service() for servlet
[XFireServlet] in context with path [/survey] threw exception Message:
No value for key [org.hibernate.impl.SessionFactoryImpl@4af6178d]
bound to thread ["http-bio-8080"-exec-2] Line | Method
->> 886 | runTask in java.util.concurrent.ThreadPoolExecutor$Worker
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - | 908 | run in '' ^ 680 | run . . in java.lang.Thread

After changing the client it turned out that the SOAP server and client is working fine now.
That error wasn't effecting the server.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浊酒尽余欢 2025-01-05 00:36:02

问题和解决方案在 这个 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/*")
        }
    }
}

Problem and solution are described in this jira

Hack that works for me:

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/*")
        }
    }
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文