- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我已经从 WSDL 模式生成了 POJO,但错误似乎没有映射到适当的 @Webfault
异常。我收到的是 ServerSOAPFaultException
,而不是 AXLError
。
生成的异常文件:
package com.cisco.axlapiservice;
import javax.xml.ws.WebFault;
/**
* This class was generated by Apache CXF 3.1.8
* 2016-11-13T14:30:37.692+02:00
* Generated source version: 3.1.8
*/
@WebFault(name = "axlError", targetNamespace = "http://www.cisco.com/AXL/API/11.5")
public class AXLError extends Exception {
private com.cisco.axl.api._11.AXLError axlError;
public AXLError() {
super();
}
public AXLError(String message) {
super(message);
}
public AXLError(String message, Throwable cause) {
super(message, cause);
}
public AXLError(String message, com.cisco.axl.api._11.AXLError axlError) {
super(message);
this.axlError = axlError;
}
public AXLError(String message, com.cisco.axl.api._11.AXLError axlError, Throwable cause) {
super(message, cause);
this.axlError = axlError;
}
public com.cisco.axl.api._11.AXLError getFaultInfo() {
return this.axlError;
}
}
服务器返回的响应:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>soapenv:Client</faultcode>
<faultstring>Cannot insert or update pattern. A DN exists with the same pattern and partition.</faultstring>
<detail>
<axlError>
<axlcode>4052</axlcode>
<axlmessage>Cannot insert or update pattern. A DN exists with the same pattern and partition.</axlmessage>
<request>addLine</request>
</axlError>
</detail>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>
抛出以下异常:
com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Cannot insert or update pattern. A DN exists with the same pattern and partition. Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(SOAP11Fault.java:178)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(SOAPFaultBuilder.java:124)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(StubHandler.java:238)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:189)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(DatabindingImpl.java:276)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:104)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:77)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:147)
at com.sun.proxy.$Proxy135.addLine(Unknown Source)
at com.company.product.provisioning.AxlApi.addLine(AxlApi.java:243)
...
您能指出为什么我从未收到 AXLError
吗?
最佳答案
这是 CXF 映射 @WebFault
的标准方法。如果您尝试/捕获接收 WebFault 的 WebService 方法,它将引发 AXLError
异常,其中将包含 com.cisco.axl.api._11.AXLError 中的故障详细信息getFaultInfo()。
我没有看到堆栈跟踪中调用 CXF 类。看来您的客户端正在使用 JDK 中包含的 JAX-WS 的内部实现。也许您忘记将 CXF jar 添加到运行时依赖项中?如果您使用 Maven,您可以使用以下代码片段将它们添加到您的类路径中:
<properties>
<cxf.version>3.1.8</cxf.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<!-- Jetty is needed if you're are not using the CXFServlet -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf.version}</version>
</dependency>
</dependencies>
关于java - SOAP - 抛出 ServerSOAPFaultException 而不是适当的 @WebFault 异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40769618/
我已经编写了一个网络服务并试图抛出我的自定义异常,但我收到错误请帮助我解决它。 import javax.jws.WebService; import javax.xml.ws.Endpoint; @
initiateBatchProcess 方法出错:必须捕获或声明抛出未报告的异常。我有一个带有 @webFault 注释的自定义异常类来处理 jaxb 异常,如本 link 中所建议的那样。 。 我
我正在根据现有的 WSDL 使用 Java 构建 Web 服务。 wsimport 工具已生成绑定(bind)到服务架构中的元素的所有 Java 类。特别是,错误声明产生以下类: @javax.xml
我正在尝试从 python 代码引发 Suds.WebFault。 __init__ 方法\构造函数采用三个参数 __init__(self, fault, document)。故障有fault.fa
我已经从 WSDL 模式生成了 POJO,但错误似乎没有映射到适当的 @Webfault 异常。我收到的是 ServerSOAPFaultException,而不是 AXLError。 生成的异常文件
我正在使用 JAX-RS/Apache CXF、JSON 开发客户端-服务器应用程序 我希望 Apache CXF 在两端透明地处理我的异常:这意味着将异常转换为 bean,使用我的 Jackson
我正在尝试使用 @WebFault 注释,并且我有一个可以抛出多个异常的 Web 服务,例如以下示例类 MyException1。 遵循 http://java.globinch.com/enterp
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getExplicitFaultBeanType()方法的一些代码示例,展示了WebF
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.findExplicitFaultBean()方法的一些代码示例,展示了WebFaul
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getElementName()方法的一些代码示例,展示了WebFault.getEl
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getJavaDoc()方法的一些代码示例,展示了WebFault.getJavaDo
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getProperties()方法的一些代码示例,展示了WebFault.getPro
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.calculateNamespaceURI()方法的一些代码示例,展示了WebFaul
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.()方法的一些代码示例,展示了WebFault.()的具体用法。这些代码示例主要来源于
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getSuperclass()方法的一些代码示例,展示了WebFault.getSup
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getSimpleName()方法的一些代码示例,展示了WebFault.getSim
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getElementDocs()方法的一些代码示例,展示了WebFault.getEl
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getTargetNamespace()方法的一些代码示例,展示了WebFault.g
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getPosition()方法的一些代码示例,展示了WebFault.getPosit
本文整理了Java中org.codehaus.enunciate.contract.jaxws.WebFault.getConstructors()方法的一些代码示例,展示了WebFault.getC
我是一名优秀的程序员,十分优秀!