javax.xml.ws.ProtocolException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-26 转载在 其他  
字(9.3k)|赞(0)|评价(0)|浏览(113)

本文整理了Java中javax.xml.ws.ProtocolException.<init>()方法的一些代码示例,展示了ProtocolException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ProtocolException.<init>()方法的具体详情如下:
包路径:javax.xml.ws.ProtocolException
类名称:ProtocolException
方法名:<init>

ProtocolException.<init>介绍

[英]Constructs a new protocol exception with null as its detail message. The cause is not initialized, and may subsequently be initialized by a call to Throwable.initCause(java.lang.Throwable).
[中]构造一个新的协议异常,其详细信息为null。原因未初始化,随后可能会通过调用Throwable来初始化。initCause(java.lang.Throwable)。

代码示例

代码示例来源:origin: org.objectweb.celtix/celtix-rt

private void throwProtocolException(Throwable t) {
  if (null != t) {
    LOG.log(Level.INFO, "DISPATCH_INVOKE_EXC", cl.getSimpleName());
    throw isJAXWSException(t) 
       ? (WebServiceException)t 
       : new ProtocolException(t);
  }
}

代码示例来源:origin: org.apache.axis2/axis2-metadata

/**
 * Create a ProtocolException
 *
 * @param message
 * @param t       Throwable
 * @return ProtocolException
 */
private static ProtocolException createProtocolException(String message, Throwable t) {
  Throwable rootCause = null;
  if (t != null) {
    rootCause = getRootCause(t);
  }
  rootCause = rootCause == null ? t : rootCause;
  ProtocolException e = null;
  if (message != null) {
    e = new ProtocolException(message, rootCause);
  } else {
    e = new ProtocolException(rootCause);
  }
  if (log.isDebugEnabled()) {
    log.debug("create Exception:", e);
  }
  return e;
}

代码示例来源:origin: apache/cxf

public void handleMessage(Message message) throws Fault {
    String str = new String("Collocated Invocation should have been detected.");
    throw new ProtocolException(str);
  }
}

代码示例来源:origin: org.objectweb.celtix/celtix-api

private void safeRead(InputStreamMessageContext inContext, MessageContext msgContext) {
    try {
      binding.getBindingImpl().read(inContext, msgContext);
    } catch (IOException ex) {
      LOG.log(Level.SEVERE, "READ_IO_FAILURE_MSG", ex);
      throw new ProtocolException(ex);
    }
  }
}

代码示例来源:origin: be.fedict.eid-idp/eid-idp-sp-protocol-ws-federation

public boolean handleMessage(SOAPMessageContext context) {
  Boolean outboundProperty = (Boolean) context
      .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  if (outboundProperty) {
    try {
      handleOutboundMessage(context);
    } catch (Exception e) {
      throw new ProtocolException("error: " + e.getMessage(), e);
    }
  } else {
    try {
      handleInboundMessage(context);
    } catch (Exception e) {
      throw new ProtocolException("error: " + e.getMessage(), e);
    }
  }
  return true;
}

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-common

@Override
public boolean handleMessage(SOAPMessageContext context) {
  Boolean outboundProperty = (Boolean) context
      .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  if (false == outboundProperty) {
    return true;
  }
  try {
    handleOutboundMessage(context);
  } catch (Exception e) {
    LOG.error("outbound exception: " + e.getMessage(), e);
    throw new ProtocolException(e);
  }
  return true;
}

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-saml-sts

@Override
public boolean handleMessage(SOAPMessageContext context) {
  Boolean outboundProperty = (Boolean) context
      .get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  if (false == outboundProperty) {
    return true;
  }
  try {
    handleOutboundMessage(context);
  } catch (Exception e) {
    LOG.error("outbound exception: " + e.getMessage(), e);
    throw new ProtocolException(e);
  }
  return true;
}

代码示例来源:origin: be.e_contract.mycarenet/mycarenet-ehealth-common

@Override
public boolean handleMessage(SOAPMessageContext context) {
  if (null == this.to) {
    return true;
  }
  Boolean outboundProperty = (Boolean) context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  if (false == outboundProperty) {
    return true;
  }
  try {
    handleOutboundMessage(context);
  } catch (Exception e) {
    LOG.error("outbound exception: " + e.getMessage(), e);
    throw new ProtocolException(e);
  }
  return true;
}

代码示例来源:origin: mindwind/craft-atom

sslEngine.beginHandshake();
} catch (SSLException e) {
  throw new ProtocolException(e);

代码示例来源:origin: org.objectweb.celtix/celtix-rt

public boolean hasFault(MessageContext msgContext) {
  boolean hasFault = false;
  SOAPMessage msg = ((SOAPMessageContext)msgContext).getMessage();
  assert msg != null;
  try {
    hasFault = msg.getSOAPBody().hasFault();
  } catch (SOAPException se) {
    LOG.log(Level.SEVERE, "SOAP_UNMARSHALLING_FAILURE_MSG", se);
    throw new ProtocolException(se);
  }
  return hasFault;
}

代码示例来源:origin: org.fabric3/fabric3-binding-ws-metro

/**
 * Sets the callback endpoint address specified by the WSA header in the current work context.
 *
 * @param element     the WSA header
 * @param workContext the current work context
 */
@SuppressWarnings("unchecked")
private void setReturnAddress(SOAPElement element, WorkContext workContext) {
  Iterator<SOAPElement> addresses = (Iterator<SOAPElement>) element.getChildElements(WSA_ADDRESS);
  if (addresses.hasNext()) {
    String address = addresses.next().getValue();
    if (WSA_ANONYMOUS.equals(address)) {
      throw new ProtocolException("Invalid Callback Address: " + WSA_ANONYMOUS);
    }
    if (address != null) {
      workContext.setHeader(CallbackConstants.ENDPOINT_ADDRESS, address);
    }
  }
}

代码示例来源:origin: gmazza/blog-samples

@Override
public boolean handleMessage(LogicalMessageContext mc) {
 HandlerUtils.printMessageContext("Service LogicalHandler", mc);
 if (Boolean.FALSE.equals(mc.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY))) {
   try {
    LogicalMessage msg = mc.getMessage();
    JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
    Object payload = msg.getPayload(jaxbContext);
    if (payload instanceof DoubleIt) {
      DoubleIt req = (DoubleIt) payload;
      if (req.getNumberToDouble() == 30) {
       throw new ProtocolException(
          "Doubling 30 is not allowed by the web service provider.");
      }
    }
   } catch (JAXBException ex) {
    throw new ProtocolException(ex);
   }
 }
 return true;
}

代码示例来源:origin: org.apache.servicemix.examples/cxf-handler-cfg

public final boolean handleMessage(LogicalMessageContext messageContext) {
  //System.out.println("LogicalMessageHandler handleMessage called");
  try {
    // get the LogicalMessage from our context
    LogicalMessage msg = messageContext.getMessage();
    // check the payload, if its an AddNumbers request, we'll intervene
    JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
    Object payload = msg.getPayload(jaxbContext);
    Object value = payload;
    if (payload instanceof JAXBElement) {
      value = ((JAXBElement)payload).getValue();
    }
    if (value instanceof AddNumbers) {
      AddNumbers req = (AddNumbers)value;
      int a = req.getArg0();
      req.setArg0(a * 10);
      msg.setPayload(payload, jaxbContext);
    }
    return true;
  } catch (JAXBException ex) {
    throw new ProtocolException(ex);
  }
}

代码示例来源:origin: org.apache.servicemix.examples/org.apache.servicemix.examples.itests.cxf-handler-cfg

public final boolean handleMessage(LogicalMessageContext messageContext) {
  //System.out.println("LogicalMessageHandler handleMessage called");
  try {
    // get the LogicalMessage from our context
    LogicalMessage msg = messageContext.getMessage();
    // check the payload, if its an AddNumbers request, we'll intervene
    JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
    Object payload = msg.getPayload(jaxbContext);
    Object value = payload;
    if (payload instanceof JAXBElement) {
      value = ((JAXBElement)payload).getValue();
    }
    if (value instanceof AddNumbers) {
      AddNumbers req = (AddNumbers)value;
      int a = req.getArg0();
      req.setArg0(a * 10);
      msg.setPayload(payload, jaxbContext);
    }
    return true;
  } catch (JAXBException ex) {
    throw new ProtocolException(ex);
  }
}

代码示例来源:origin: apache/cxf

public boolean handleMessage(LogicalMessageContext ctx) {
    super.handleMessage(ctx);
    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (outbound) {
      throw new ProtocolException(clientHandlerMessage);
    }
    return true;
  }
};

代码示例来源:origin: apache/cxf

public boolean handleMessage(SOAPMessageContext ctx) {
    super.handleMessage(ctx);
    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (outbound) {
      throw new ProtocolException(clientHandlerMessage);
    }
    return true;
  }
};

代码示例来源:origin: apache/cxf

public boolean handleMessage(SOAPMessageContext ctx) {
    super.handleMessage(ctx);
    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (!outbound) {
      throw new ProtocolException(clientHandlerMessage);
    }
    return true;
  }
};

代码示例来源:origin: apache/cxf

public boolean handleMessage(LogicalMessageContext ctx) {
    super.handleMessage(ctx);
    Boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
    if (!outbound) {
      throw new ProtocolException(clientHandlerMessage);
    }
    return true;
  }
};

代码示例来源:origin: apache/cxf

public final boolean handleMessage(LogicalMessageContext messageContext) {
  //System.out.println("LogicalMessageHandler handleMessage called");
  try {
    // get the LogicalMessage from our context
    LogicalMessage msg = messageContext.getMessage();
    // check the payload, if its an AddNumbers request, we'll intervene
    JAXBContext jaxbContext = JAXBContext.newInstance(ObjectFactory.class);
    Object payload = msg.getPayload(jaxbContext);
    Object value = payload;
    if (payload instanceof JAXBElement) {
      value = ((JAXBElement<?>)payload).getValue();
    }
    if (value instanceof AddNumbers) {
      AddNumbers req = (AddNumbers)value;
      int a = req.getArg0();
      req.setArg0(a * 10);
      msg.setPayload(payload, jaxbContext);
    }
    return true;
  } catch (JAXBException ex) {
    throw new ProtocolException(ex);
  }
}

代码示例来源:origin: apache/cxf

public boolean handleMessage(T ctx) {
  methodCalled("handleMessage");
  printHandlerInfo("handleMessage", isOutbound(ctx));
  boolean outbound = (Boolean)ctx.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY);
  boolean ret = getHandleMessageRet();
  if (!isServerSideHandler()) {
    return true;
  }
  try {
    verifyJAXWSProperties(ctx);
  } catch (PingException e) {
    e.printStackTrace();
    throw new ProtocolException(e);
  }
  Object obj = ctx.getMessage().getPayload(jaxbCtx);
  if (obj instanceof Ping
    || obj instanceof PingResponse) {
    ret = handlePingMessage(outbound, ctx);
  } else if (obj instanceof PingWithArgs) {
    ret = handlePingWithArgsMessage(outbound, ctx);
  }
  return ret;
}

相关文章