Duplicate element defination will be genereate in the WSDL for the WebFault
while using Doc/Literal SOAP style. e.g.
<xsd:element name="ServiceException" nillable="true"
type="ns0:serviceFaultDetail"/>
<xsd:element name="ServiceException" nillable="true"
type="ns0:serviceFaultDetail"/>
and it is no problem in the WSDL if using rpc/Literal style by using the
following annotation in the webservice interface
@SOAPBinding(style= SOAPBinding.Style.RPC, use= SOAPBinding.Use.LITERAL)
MyService.java :
@WebService (name="MyService")
public interface MyService {
public java.lang.String getValue() throws ServiceException;
}
ServiceException.java :
@WebFault (name="ServiceException")
public class ServiceException extends Exception {
private ServiceFaultDetail faultInfo;
public ServiceException() {
super();
}
public ServiceException(String arg0, ServiceFaultDetail faultInfo) {
super(arg0);
}
public ServiceFaultDetail getFaultInfo() {
ServiceFaultDetail faultInfo = new ServiceFaultDetail();
faultInfo.setFaultDetail("This is the Fault Info of " +
this.getClass().getName());
return faultInfo;
}
}
ServiceFaultDetail .java :
@XmlRootElement(name="ServiceDetail" )
public class ServiceFaultDetail {
private String faultDetail;
public ServiceFaultDetail() {}
public ServiceFaultDetail(String detail) {
this.faultDetail = detail;
}
public String getFaultDetail() {
return faultDetail;
}
public void setFaultDetail(String faultDetail) {
this.faultDetail = faultDetail;
}
}
--
View this message in context:
http://www.nabble.com/WSDL-problem-on-WebFault-while-using-Doc-Literal-SOAP-style-tf4316302.html#a12290101
Sent from the cxf-user mailing list archive at Nabble.com.