java


SOAP - ServerSOAPFaultException is thrown instead of appropriate #WebFault exception


I have generated POJO's from WSDL schema, but errors don't seem to be mapped to appropriate #Webfault exception. Instead of getting AXLError I receive ServerSOAPFaultException.
Generated exception file:
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;
}
}
Response returned from server:
<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>
The following exception is thrown:
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)
...
Could you please point me why I never receive an AXLError?
This is CXF's standard way to map a #WebFault. If you try/catch a WebService method which receives a WebFault, it will raise a AXLError exception, which will contain the details of the fault in com.cisco.axl.api._11.AXLError getFaultInfo().
I do not see the CXF classes being invoked in stack trace. Seems your client is using the internal implementation of JAX-WS included in JDK. Perhaps you have forgotten to add the CXF jars to the runtime dependencies? If you use maven, you can add them to your classpath with the following snippet:
<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>

Related Links

Exception in thread “main” org.hibernate.HibernateException: hibernate.cfg.xml not found
WSDL and JAVA in Web Service
Canonical representation of a BigDecimal
Error creating and casting an array of objects
Assistance on State Machine Compiler
How to navigate between html & jsp pages in spring
How to host java application in aws?
How to serialize this program and deserialize it
Initialization statement
return id in ON DUPLICATE KEY in JOOQ
how to draw lines with opencv in java
The Composite doesn't scroll when its inner components enlarge in swt
Java and CMD Runtime Executor
What's the convention for reusing variable names for both JSP pages and Java Servlets?
How can I run integration tests on a jersey application without restarting the server for every test?
#Autowire failure for JPA Repository in multi-module project

Categories

HOME
maven
deployment
deezer
pycharm
onedrive
q
at-command
microservices
c#-2.0
umd
angular-ui-bootstrap
blueprintjs
upload
awesome-wm
here-api
kentor-authservices
modx-revolution
nstableview
gz
ups
quartz-scheduler
libtiff
telephony
tostring
flux
django-cms
php-openssl
sqlcipher
tdd
pepper
publish
typo3-6.2.x
log4js-node
msys2
nat
stormpath
catch-all
stacked
simplexml
dynamics-crm-2013
user-controls
graphenedb
mapzen
avro4s
nand2tetris
nomethoderror
fakeiteasy
heightmap
total-commander
checkboxlist
flashair
slick-3.0
sas-jmp
user-accounts
dotcover
rainbowtable
hendrix
typescript1.8
return-value
colorama
migradoc
azure-sdk
home-directory
plottable.js
firebaseui
multiple-regression
packagist
revolution-r
ios8-today-widget
msys
thredds
intellij-14
cannon.js
libressl
drawbitmap
splash
pretty-print
streambase
dd
codeigniter-routing
asp.net-web-api-odata
flask-cors
xojo
mesa
android-radiobutton
article
navigationservice
reactfx
dealloc
transcoding
typo3-neos
centos5
imdbpy
industrial
floating-point-precision
ms-project-server-2010
blending
ember-app-kit
flashvars
jelly
tinn-r
browser-detection
google-email-migration
automount
chrono
uiviewanimation-curve
custom-backend
ecl
remember-me
xsdobjectgen
mirah
vc90
memory-size
scripting-languages
grid-system

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App