我正在使用JAX WS来公开WebService.此服务的某些操作可能会生成异常.不是内部服务器异常,而是依赖于操作调用的输入参数的异常.
如果我指定我的操作抛出自定义异常,如下所示:
@WebService
@SOAPBinding(style = Style.RPC, use = Use.LITERAL)
public class MyServiceEndpointImpl implements MyServiceEndpoint {
@WebMethod
public void throwsException throws InvalidInputException;
}
Run Code Online (Sandbox Code Playgroud)
运行应用程序时,我最终得到以下堆栈跟踪:
com.sun.xml.ws.model.RuntimeModelerException: runtime modeler error: Wrapper class com.mypackage.ws.services.jaxws.InvalidInputExceptionBean is not found. Have you run APT to generate them?
at com.sun.xml.ws.model.RuntimeModeler.getClass(RuntimeModeler.java:285)
at com.sun.xml.ws.model.RuntimeModeler.processExceptions(RuntimeModeler.java:1006)
at com.sun.xml.ws.model.RuntimeModeler.processRpcMethod(RuntimeModeler.java:969)
at com.sun.xml.ws.model.RuntimeModeler.processMethod(RuntimeModeler.java:546)
at com.sun.xml.ws.model.RuntimeModeler.processClass(RuntimeModeler.java:370)
at com.sun.xml.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:256)
at com.sun.xml.ws.server.EndpointFactory.createSEIModel(EndpointFactory.java:322)
at com.sun.xml.ws.server.EndpointFactory.createEndpoint(EndpointFactory.java:188)
at com.sun.xml.ws.api.server.WSEndpoint.create(WSEndpoint.java:467)
at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:333)
at org.jvnet.jax_ws_commons.spring.SpringService.getObject(SpringService.java:45)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$1.run(FactoryBeanRegistrySupport.java:121)
Run Code Online (Sandbox Code Playgroud)
添加@XmlRootEntity到InvalidInputException不解决问题.
如果这不是报告Web服务故障的推荐方法,那么有更好的方法吗?我的异常是应该继承RuntimeException并依赖于传输进行错误处理(即,所有内容最终都将包含在SOAPException中)?我希望有类似Spring-WS的东西SoapFaultAnnotationExceptionResolver.是否有类似的东西可用于JAX-WS?
说my_instance是模型MyModel.
我正在寻找一个好方法:
my_model = get_model_for_instance(my_instance)
Run Code Online (Sandbox Code Playgroud)
我没有找到任何真正直接的方法来做到这一点.到目前为止,我已经想出了这个:
from django.db.models import get_model
my_model = get_model(my_instance._meta.app_label, my_instance.__class__.__name__)
Run Code Online (Sandbox Code Playgroud)
这可以接受吗?它甚至是一种可靠的,最佳实践方式吗?
也_meta.object_name有似乎提供相同的__class__.__name__.可以?好还是坏?如果是这样,为什么?
另外,如果app标签在项目范围内多次出现,我怎么知道我得到了正确的模型,例如'django.contrib.auth'中的'auth',还有'myproject.auth'?
这种情况会get_model不可靠吗?
感谢任何提示/指示和经验分享!
我需要验证电子邮件.我想通过生成一个唯一的字符串并为其创建链接来让用户在邮件中单击它.
我不知道如何使用Java生成它.
还有md5,sha1等功能php为使用如电子邮件的任意唯一值的字符串.是否提供相同的功能jsp?
我对PHP有很好的了解.但我也想学习JSP等技术.我已经安装了Apache Tomcat 6.0和Eclipse Java EE.
我在Google上寻找JSP教程,发现有一些东西,如JSP,Servlets,Struts,EJB,JSF等.我听说过很多关于Struts和JSF的东西,他们非常好.
我想知道我应该以什么顺序开始学习这些技术.(我对Core Java有很好的了解)
我想有一个JTree,它还显示一些正确调整的额外信息,就像有一个额外的列,见下图.欢迎提供任何有关此类或类似内容的提示!
每当在某些缓冲区中键入任何内容时,我都会在emacs中收到此错误:
c-forward-sws:错误的类型参数:stringp,nil
这似乎是语法上的突出显示;每当输入任何内容时,我都会在处于sh模式的缓冲区中获取它-甚至返回空行。我偶尔也会在C ++模式的缓冲区中获得它,但是我不记得具体的行,也无法在这种模式下重现它。
我最近没有更改过.emacs(我记得)。
任何想法是什么问题?该函数在cc-engine.el中定义,但是我很难弄清楚上下文。
这是我在这里的第一篇文章,所以我希望我将这个问题发布到正确的位置.否则,请让我知道,以便我知道下次我在这里发帖:)
我正在开发一个RoR网站,并希望单独处理服务器错误(400,404,500等).此外,由于网站是动态的,我想在rails环境中而不是在服务器级别处理错误.我想要做的一个例子是,当她碰到一个不会加载或根本不存在的页面或模板时,向用户显示可选材料或搜索栏.
所以,我做了一些阅读,我认为使用rescue_from异常处理程序是我的理由.(如果你们中有人有不同的意见,我们将非常高兴听到).
我有一个简单的工作原型(见下面的代码)启动并运行,但是,当我在代码中包含以下异常处理程序时出现错误:
rescue_from ActionController::MissingTemplate, :with => :not_found #404
Run Code Online (Sandbox Code Playgroud)
现在,我看不到我有拼写错误,我在网上发布的代码中看到了这一行.但是,当我包含它时,我收到以下路由错误:
Routing Error No route matches "/errorhandle" with {:method=>:get}
Run Code Online (Sandbox Code Playgroud)
我正在使用rails 2.3.5,也许这与它有关?
我希望你能帮助我解决这个问题.
干杯! /玛雅
class ApplicationController < ActionController::Base
helper :all # include all helpers, all the time
protect_from_forgery #See ActionController::RequestForgeryProtection for details
#ActiveRecord exceptions
rescue_from ActiveRecord::RecordNotFound, :with => :not_found #400
#ActiveResource exceptions
rescue_from ActiveResource::ResourceNotFound, :with => :not_found #404
#ActionView exceptions
rescue_from ActionView::TemplateError, :with => :not_found #500
#ActionController exceptions
rescue_from ActionController::RoutingError, :with => :not_found #404
rescue_from ActionController::UnknownController, :with => :not_found #404 …Run Code Online (Sandbox Code Playgroud) 从一些特殊类型的CLI mscorlib程序库(ArgIterator,TypedReference和RuntimeArgumentHandle类型)不能被用作一般类型参数构造通用类型/方法:
void Foo<T>() { }
void Bar() { Foo<ArgIterator>(); }
Run Code Online (Sandbox Code Playgroud)
提供编译器错误:
error CS0306: The type 'System.ArgIterator' may not be used as a type argument
Run Code Online (Sandbox Code Playgroud)
但是在C#规范中根本没有记录.
这些类型是CLI规范的一部分还是CLR实现提供的这种类型,上述行为不应该在C#规范中记录?
两个人,真的:
如何检查整个源代码树,但只获取所有内容的中继,忽略所有分支和标记?
假设#1是可行的,有没有办法让没有任何"主干"目录,只是让文件驻留在一个具有存储库名称的文件夹中?
我想我缺少一些基本的东西,所以我想向社区寻求帮助.我正在构建一个基于iPhone实用程序基本应用程序的应用程序.我的MainView和FlipsideView共享一些元素,所以我为这些片段创建了单独的ViewControllers和nib文件.为了做到这一点,我做了以下工作:1.创建了一个名为searchDateViewController的viewcontroller,它是searchDateView.xib的文件所有者2. searchDateView.xib基本上是一个内部有UILabel的UIView,视图连接正确3.里面MainViewController.m和FlipsideViewController.m我将子视图添加为folllows:
- (void)loadView{
[super loadView];
searchDateViewController = [[SearchDateViewController alloc] initWithNibName:@"SearchDateView" bundle:nil];
[[searchDateViewController view] setFrame:[searchDateView frame]];
[[self view] addSubview:[searchDateViewController view]];
...
}
Run Code Online (Sandbox Code Playgroud)
一切都显示和工作得很好.基本上取决于每个主视图和翻转视图中发生的动作,笔尖的UILabel被更改.但是,如果从MainView或FlipsideView加载searchDateViewController,我想做一些稍微不同的事情.但是,我似乎无法弄清楚哪个ViewController正在添加searchDateViewController子视图.
在searchDateViewController中,我试过:
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"superview %@", self.view.superview);
NSLog(@"parentviewcontroller %@", self.parentViewController);
}
Run Code Online (Sandbox Code Playgroud)
在这两种情况下,我都没有.
所以我的问题是 - 我能找出哪个ViewController正在添加searchDateViewController一个子视图?如果是这样的话?或者,如果我的逻辑完全搞砸了,我该怎么做呢?
谢谢!