本文整理了Java中org.codehaus.xfire.fault.XFireFault.<init>()
方法的一些代码示例,展示了XFireFault.<init>()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XFireFault.<init>()
方法的具体详情如下:
包路径:org.codehaus.xfire.fault.XFireFault
类名称:XFireFault
方法名:<init>
[英]Create a fault.
[中]制造错误。
代码示例来源:origin: org.codehaus.xfire/xfire-core
/**
* Creates a <code>XFireFault</code> from the given throwable. If the throwable is a <code>XFireFault</code>, it is
* not wrapped.
*
* @param throwable the throwable
* @return the fault
*/
public static XFireFault createFault(Throwable throwable)
{
XFireFault fault = null;
if (throwable instanceof XFireFault)
{
fault = (XFireFault) throwable;
}
else
{
fault = new XFireFault(throwable);
}
return fault;
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-client-tools
/**
* Loads the property descriptors for the ordered properties of the specified class.
*
* @param wrapperClass The wrapper class.
* @return The ordered property descriptors.
*/
protected PropertyDescriptor[] loadOrderedProperties(Class wrapperClass) throws XFireFault {
String[] propOrder = annotations.getPropertyOrder(wrapperClass);
if (propOrder == null) {
throw new XFireFault("Unable use use " + wrapperClass.getName() + " as a wrapper class: no propOrder specified.", XFireFault.RECEIVER);
}
BeanInfo responseBeanInfo;
try {
responseBeanInfo = Introspector.getBeanInfo(wrapperClass, Object.class);
}
catch (IntrospectionException e) {
throw new XFireFault("Unable to introspect " + wrapperClass.getName(), e, XFireFault.RECEIVER);
}
return PropertyUtil.sortProperties(wrapperClass, responseBeanInfo.getPropertyDescriptors(), propOrder);
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* Loads the property descriptors for the ordered properties of the specified class.
*
* @param wrapperClass The wrapper class.
* @return The ordered property descriptors.
*/
protected PropertyDescriptor[] loadOrderedProperties(Class wrapperClass) throws XFireFault {
String[] propOrder = annotations.getPropertyOrder(wrapperClass);
if (propOrder == null) {
throw new XFireFault("Unable use use " + wrapperClass.getName() + " as a wrapper class: no propOrder specified.", XFireFault.RECEIVER);
}
BeanInfo responseBeanInfo;
try {
responseBeanInfo = Introspector.getBeanInfo(wrapperClass, Object.class);
}
catch (IntrospectionException e) {
throw new XFireFault("Unable to introspect " + wrapperClass.getName(), e, XFireFault.RECEIVER);
}
return PropertyUtil.sortProperties(wrapperClass, responseBeanInfo.getPropertyDescriptors(), propOrder);
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-client-tools
/**
* Reads the bytes of the specified data handler to a byte array.
*
* @param dataHandler The data handler to read.
* @return The bytes that were read.
*/
public static byte[] readBytes(DataHandler dataHandler) throws XFireFault {
ByteArrayOutputStream out = new ByteArrayOutputStream();
try {
InputStream in = dataHandler.getInputStream();
byte[] inBytes = new byte[1024 * 10]; //10 K?
int len;
while ((len = in.read(inBytes)) > 0) {
out.write(inBytes, 0, len);
}
return out.toByteArray();
}
catch (IOException e) {
throw new XFireFault(e, XFireFault.RECEIVER);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
protected Object getClientParam(Object[] values, MessagePartInfo outParam, MessageContext context)
throws XFireFault
{
if (outParam.getIndex() >= values.length)
{
throw new XFireFault("Not enough input parameters were supplied!", XFireFault.SENDER);
}
return values[outParam.getIndex()];
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public Object getServiceObject(MessageContext context)
throws XFireFault{
try{
return getScopedFactory(context).create();
}
catch(XFireFault e){
throw e;
}
catch(Throwable e){
throw new XFireFault(e);
}
}
private Factory getScopedFactory(MessageContext context){
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void writeMessage(OutMessage out, XMLStreamWriter writer, MessageContext ctx)
throws XFireFault
{
try
{
STAXUtils.copy((XMLStreamReader) out.getBody(), writer);
}
catch (XMLStreamException e)
{
throw new XFireFault("Couldn't write to stream.", e, XFireFault.RECEIVER);
}
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-tools
public EnunciatedJAXWSOperationBinding(OperationInfo op) throws XFireFault {
this.requestInfo = getRequestInfo(op);
this.responseInfo = getResponseInfo(op);
ArrayList<Class> contextClasses = new ArrayList<Class>(2);
if (this.requestInfo != null) {
contextClasses.add(this.requestInfo.getBeanClass());
}
if (this.responseInfo != null) {
contextClasses.add(this.responseInfo.getBeanClass());
}
try {
this.jaxbContext = JAXBContext.newInstance(contextClasses.toArray(new Class[contextClasses.size()]));
}
catch (JAXBException e) {
throw new XFireFault("Unable to create a binding for " + op.getMethod() + ".", e, XFireFault.RECEIVER);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
private void assertSingle(Element root, String tagName, Namespace wsa)
throws XFireFault
{
List list = root.getChildren(tagName,wsa);
if( list!= null ){
if(list.size()> 1){
XFireFault fault = new XFireFault("Invalid header",new QName(wsa.getURI(),"Sender"));
fault.addNamespace("wsa",wsa.getURI());
fault.setSubCode(new QName(wsa.getURI(),"InvalidAddressingHeader"));
Element detail = new Element("ProblemHeaderQName",wsa);
detail.addContent(tagName);
fault.setDetail(detail);
throw fault;
}
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
public EnunciatedJAXWSOperationBinding(OperationInfo op) throws XFireFault {
this.requestInfo = getRequestInfo(op);
this.responseInfo = getResponseInfo(op);
ArrayList<Class> contextClasses = new ArrayList<Class>(2);
if (this.requestInfo != null) {
contextClasses.add(this.requestInfo.getBeanClass());
}
if (this.responseInfo != null) {
contextClasses.add(this.responseInfo.getBeanClass());
}
try {
this.jaxbContext = JAXBContext.newInstance(contextClasses.toArray(new Class[contextClasses.size()]));
}
catch (JAXBException e) {
throw new XFireFault("Unable to create a binding for " + op.getMethod() + ".", e, XFireFault.RECEIVER);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void writeMessage(OutMessage message, XMLStreamWriter writer, MessageContext context)
throws XFireFault
{
Document doc = (Document) message.getBody();
StaxSerializer serializer = new StaxSerializer();
try
{
serializer.writeElement(doc.getRootElement(), writer);
}
catch (XMLStreamException e)
{
throw new XFireFault("Couldn't write message.", e, XFireFault.RECEIVER);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
/**
* Assert that a service understands a particular header. If not, a fault is thrown.
*
* @param context
* @param name
* @throws XFireFault
*/
protected void assertUnderstandsHeader(MessageContext context, QName name)
throws XFireFault
{
if (context.getInPipeline().understands(name))
return;
if (context.getOutPipeline().understands(name))
return;
// TODO: Check Out pipeline for understanding
throw new XFireFault("Header {" + name.getLocalPart() + "}" + name.getNamespaceURI()
+ " was not undertsood by the service.", XFireFault.MUST_UNDERSTAND);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
protected void handleFault(MessageContext context, XFireFault fault, Throwable cause, MessagePartInfo faultPart)
throws XFireFault
{
JDOMStreamWriter writer = new JDOMStreamWriter(fault.getDetail());
Object faultBean = getFaultBean(cause, faultPart, context);
try
{
AbstractBinding.writeParameter(writer, context, faultBean, faultPart, faultPart.getName().getNamespaceURI());
}
catch (XMLStreamException e)
{
throw new XFireFault("Could not write to outgoing stream.", e, XFireFault.RECEIVER);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void readMessage(InMessage message, MessageContext context)
throws XFireFault
{
StaxBuilder builder = new StaxBuilder();
try
{
Document doc = builder.build(message.getXMLStreamReader());
message.setBody(doc);
}
catch (XMLStreamException e)
{
throw new XFireFault("Couldn't parse message.", e, XFireFault.SENDER);
}
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void readMessage(InMessage message, MessageContext context)
throws XFireFault
{
if (message.getSoapVersion() instanceof Soap11)
soap11.readMessage(message, context);
else if (message.getSoapVersion() instanceof Soap12)
soap12.readMessage(message, context);
else
throw new XFireFault("Unrecognized soap version.",
(XFireFault) message.getBody(),
XFireFault.SENDER);
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void writeMessage(OutMessage message, XMLStreamWriter writer, MessageContext context)
throws XFireFault
{
if (message.getSoapVersion() instanceof Soap11)
soap11.writeMessage(message, writer, context);
else if (message.getSoapVersion() instanceof Soap12)
soap12.writeMessage(message, writer, context);
else
throw new XFireFault("Unrecognized soap version.",
(XFireFault) message.getBody(),
XFireFault.SENDER);
}
代码示例来源:origin: org.codehaus.xfire/xfire-core
public void invoke(MessageContext context)
throws Exception
{
AbstractSoapBinding binding = (AbstractSoapBinding) context.getBinding();
if (binding == null)
{
throw new XFireFault("Could not find appropriate binding for service: " + context.getService().getName(),
XFireFault.RECEIVER);
}
MessageSerializer ser = binding.getSerializer(context.getExchange().getOperation());
ser.readMessage(context.getInMessage(), context);
}
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-client-tools
/**
* Writes a message. Delegates to the operation binding of the operation in the current message exchange.
*
* @param message The message to write.
* @param writer The writer to which to write.
* @param context The context
*/
public void writeMessage(OutMessage message, XMLStreamWriter writer, MessageContext context) throws XFireFault {
OperationInfo op = context.getExchange().getOperation();
MessageInfo inMessage = op.getInputMessage();
if (inMessage == null) {
throw new XFireFault("No request message was found in the current operation!", XFireFault.RECEIVER);
}
new ElementWriter(writer, inMessage.getName());
getOperationBinding(op).writeMessage(message, writer, context);
//the xfire SoapSerializer makes the strange assumption that the message serializer doesn't close its element...
//elementWriter.close();
}
代码示例来源:origin: org.codehaus.enunciate/enunciate-full
/**
* Writes a message. Delegates to the operation binding of the operation in the current message exchange.
*
* @param message The message to write.
* @param writer The writer to which to write.
* @param context The context
*/
public void writeMessage(OutMessage message, XMLStreamWriter writer, MessageContext context) throws XFireFault {
OperationInfo op = context.getExchange().getOperation();
MessageInfo inMessage = op.getInputMessage();
if (inMessage == null) {
throw new XFireFault("No request message was found in the current operation!", XFireFault.RECEIVER);
}
new ElementWriter(writer, inMessage.getName());
getOperationBinding(op).writeMessage(message, writer, context);
//the xfire SoapSerializer makes the strange assumption that the message serializer doesn't close its element...
//elementWriter.close();
}
代码示例来源:origin: org.codehaus.xfire/xfire-jaxws
public void readMessage(InMessage message, MessageContext context)
throws XFireFault
{
Service endpoint = context.getService();
DepthXMLStreamReader dr = new DepthXMLStreamReader(context.getInMessage().getXMLStreamReader());
if ( !STAXUtils.toNextElement(dr) )
throw new XFireFault("There must be a method name element.", XFireFault.SENDER);
OperationInfo op = context.getExchange().getOperation();
if (!isClientModeOn(context) && op == null)
{
op = endpoint.getServiceInfo().getOperation( dr.getLocalName() );
if (op != null)
{
setOperation(op, context);
JAXWSOperationBinding opBinding = getOperationBinding(op);
opBinding.readMessage(message, context);
return;
}
}
delegate.readMessage(message, context);
}
内容来源于网络,如有侵权,请联系作者删除!