You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "Jarada, Hussam" <Hu...@corp.aol.com> on 2007/11/28 22:57:23 UTC
Help in XFireFault
Hi,
Can someone please help me in resolving the following issue with using
Xfire 1.2.6 ... I know this listserve is for CXF but per our
unsuccessful tries to port our existing code to CXF we decided to keep
using Xfire.
Right now I am trying to throw an exception like this ...
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<soapenv:Fault
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">soapenv:Server
</faultcode>
<faultstring>Login Id exists</faultstring>
<faultactor>soapenv:Client</faultactor>
<detail>
<rsp:RSPException xmlns:rsp="http://schemas.aol.com/reg/rsp/">
<rsp:ErrorNumber>1202</rsp:ErrorNumber>
<rsp:System>MADCAP</rsp:System>
<rsp:ErrorType>RSPApplicationException</rsp:ErrorType>
<rsp:ErrorMessage>Login Id exists</rsp:ErrorMessage>
</rsp:RSPException>
</detail>
</soapenv:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
The msg we are getting is as follows
R E S P O N S E:
HTTP/1.1 500 Internal Server ErrorServer: Apache-Coyote/1.1Content-Type:
text/xml;charset=UTF-8Date: Wed, 28 Nov 2007 21:22:3
0 GMTConnection: close<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001
/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:F
ault><faultcode>soap:Client</faultcode><f
aultstring>Fault:
java.lang.reflect.UndeclaredThrowableException</faultstring></soap:Fault
></soap:Body></soap:Envelope>
For some reason Xfire is not setting as expecting some fields like
details, faultactor even with calling xf.setDetail(detailElement);
xf.setRole("soapenv:Client");
Also calling xf.setFaultCode(faultName); does not set the correct data
but shows as above "soap:Client" which was set for Role/Actor in my
code.
As always, thanks in advance.
/**
* Soap fault constant for exception name
*/
private final static String NAME_ = "RSPException";
/**
* Soap fault constant for error number
*/
private final static String ERROR_NUMBER_ = "ErrorNumber";
/**
* Soap fault constant for system
*/
private final static String SYSTEM_ = "System";
/**
* Soap fault constant for error type
*/
private final static String ERROR_TYPE_ = "ErrorType";
/**
* Soap fault constant for error message
*/
private final static String ERROR_MESSAGE_ = "ErrorMessage";
...
XFireFault xf = null;
try{
xf = XFireFault.createFault(exception);
org.jdom.Element detailElement = new Element("detail", "soap",
"http://schemas.xmlsoap.org/soap/envelope/");
org.jdom.Element rspExceptionElement = new Element(NAME_);
org.jdom.Element errorNumberElement = new
Element(ERROR_NUMBER_);
errorNumberElement.setText(new
Integer(exception.getErrorNumber()).toString());
rspExceptionElement.addContent(0, errorNumberElement);
org.jdom.Element systemElement = new Element(SYSTEM_);
systemElement.setText(exception.getSystem());
rspExceptionElement.addContent(1, systemElement);
org.jdom.Element errorTypeElement = new Element(ERROR_TYPE_);
errorTypeElement.setText(DataConvertUtil.getLastNodeOfClassName(exceptio
n));
rspExceptionElement.addContent(2, errorTypeElement);
org.jdom.Element errorMessageElement = new
Element(ERROR_MESSAGE_);
errorMessageElement.setText("<![CDATA[" +
exception.getMessage() + "]]>");
rspExceptionElement.addContent(3, errorMessageElement);
detailElement.addContent(0, rspExceptionElement);
QName faultName = new
QName("http://schemas.xmlsoap.org/soap/envelope/", "Server");
xf.setDetail(detailElement);
xf.setRole("soapenv:Client");
xf.setFaultCode(faultName);
xf.setMessage(exception.getMessage());
}catch( Exception e ){
e.printStackTrace();
}
return xf;
Jarada
Help in XFireFault
Posted by "Jarada, Hussam" <Hu...@corp.aol.com>.
Hi,
Can someone please help me in resolving the following issue with using
Xfire 1.2.6 ... I know this listserve is for CXF but per our
unsuccessful tries to port our existing code to CXF we decided to keep
using Xfire.
Right now I am trying to throw an exception like this ...
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<soapenv:Fault
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<faultcode
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">soapenv:Server
</faultcode>
<faultstring>Login Id exists</faultstring>
<faultactor>soapenv:Client</faultactor>
<detail>
<rsp:RSPException xmlns:rsp="http://schemas.aol.com/reg/rsp/">
<rsp:ErrorNumber>1202</rsp:ErrorNumber>
<rsp:System>MADCAP</rsp:System>
<rsp:ErrorType>RSPApplicationException</rsp:ErrorType>
<rsp:ErrorMessage>Login Id exists</rsp:ErrorMessage> </rsp:RSPException>
</detail> </soapenv:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
The msg we are getting is as follows
R E S P O N S E:
HTTP/1.1 500 Internal Server ErrorServer: Apache-Coyote/1.1Content-Type:
text/xml;charset=UTF-8Date: Wed, 28 Nov 2007 21:22:3 0 GMTConnection:
close<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001 /XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soap:Body><soap:F
ault><faultcode>soap:Client</faultcode><f
aultstring>Fault:
aultstring>java.lang.reflect.UndeclaredThrowableException</faultstring><
aultstring>/soap:Fault></soap:Body></soap:Envelope>
For some reason Xfire is not setting as expecting some fields like
details, faultactor even with calling xf.setDetail(detailElement);
xf.setRole("soapenv:Client"); Also calling xf.setFaultCode(faultName);
does not set the correct data but shows as above "soap:Client" which was
set for Role/Actor in my code.
As always, thanks in advance.
/**
* Soap fault constant for exception name
*/
private final static String NAME_ = "RSPException";
/**
* Soap fault constant for error number
*/
private final static String ERROR_NUMBER_ = "ErrorNumber";
/**
* Soap fault constant for system
*/
private final static String SYSTEM_ = "System";
/**
* Soap fault constant for error type
*/
private final static String ERROR_TYPE_ = "ErrorType";
/**
* Soap fault constant for error message
*/
private final static String ERROR_MESSAGE_ = "ErrorMessage";
...
XFireFault xf = null;
try{
xf = XFireFault.createFault(exception);
org.jdom.Element detailElement = new Element("detail", "soap",
"http://schemas.xmlsoap.org/soap/envelope/");
org.jdom.Element rspExceptionElement = new Element(NAME_);
org.jdom.Element errorNumberElement = new
Element(ERROR_NUMBER_);
errorNumberElement.setText(new
Integer(exception.getErrorNumber()).toString());
rspExceptionElement.addContent(0, errorNumberElement);
org.jdom.Element systemElement = new Element(SYSTEM_);
systemElement.setText(exception.getSystem());
rspExceptionElement.addContent(1, systemElement);
org.jdom.Element errorTypeElement = new Element(ERROR_TYPE_);
errorTypeElement.setText(DataConvertUtil.getLastNodeOfClassName(exceptio
n));
rspExceptionElement.addContent(2, errorTypeElement);
org.jdom.Element errorMessageElement = new
Element(ERROR_MESSAGE_);
errorMessageElement.setText("<![CDATA[" +
exception.getMessage() + "]]>");
rspExceptionElement.addContent(3, errorMessageElement);
detailElement.addContent(0, rspExceptionElement);
QName faultName = new
QName("http://schemas.xmlsoap.org/soap/envelope/", "Server");
xf.setDetail(detailElement);
xf.setRole("soapenv:Client");
xf.setFaultCode(faultName);
xf.setMessage(exception.getMessage());
}catch( Exception e ){
e.printStackTrace();
}
return xf;
Jarada