cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shadowlaw <aymen.benhm...@gmail.com>
Subject Jaxb MArshalling Problem
Date Fri, 14 Sep 2012 13:57:03 GMT
I'm trying to return a soap fault to the client from my service in which i
succeed partially but in log i can see that i have a marshalling problem  

here is the response i get

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Body>
      <soap:Fault>
         <faultcode>soap:Server</faultcode>
         <faultstring>MaxLengthExceeded</faultstring>
         <detail/>
      </soap:Fault>
   </soap:Body>
</soap:Envelope>

the detail tag is emty.

my exception class 

@WebFault(name = "ServiceFault")
public class ServiceException extends Exception {


    private ServiceFault fault;

    /**
     * Constructs a new runtime exception with <code>null</code> as its
     * detail message.  The cause is not initialized, and may subsequently
be
     * initialized by a call to {@link #initCause}.
     */
    public ServiceException() {
    }

    /**
     * Constructs a new runtime exception with the specified detail message.
     * The cause is not initialized, and may subsequently be initialized by
a
     * call to {@link #initCause}.
     *
     * @param message the detail message. The detail message is saved for
     *                later retrieval by the {@link #getMessage()} method.
     */
    public ServiceException(String message) {
        super(message);
    }

    /**
     * Constructs a new exception with <code>null</code> as its detail
message.
     * The cause is not initialized, and may subsequently be initialized by
a
     * call to {@link #initCause}.
     */
    public ServiceException(String message, ServiceFault fault) {
        super(message);
        this.fault = fault;
    }

    public ServiceException(String message, ServiceFault serviceFault,
Throwable cause) {
        super(message, cause);
        this.fault = serviceFault;
    }

    public ServiceFault getFaultInfo() {
        return this.fault;
    }
}

and the jaxb class

@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "ServiceFault", propOrder = {
        "message"
})
@XmlRootElement(name = "ServiceFault")
public class ServiceFault {
    @XmlElement(required = true)
    protected String message;

    public String getMessage() {
        return message;
    }

    public void setMessage(String value) {
        this.message = value;
    }
}

here is where i construct my fault

ServiceFault faultDetail = new ServiceFault();
           
faultDetail.setMessage("errorrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr");
            ServiceException exception = new
ServiceException("MaxLengthExceeded", faultDetail);
            throw exception;

any has an idea?





--
View this message in context: http://cxf.547215.n5.nabble.com/Jaxb-MArshalling-Problem-tp5713944.html
Sent from the cxf-user mailing list archive at Nabble.com.

Mime
View raw message