javax.xml.ws.ProtocolException类的使用及代码示例

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

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

ProtocolException介绍

[英]The ProtocolException class is a base class for exceptions related to a specific protocol binding. Subclasses are used to communicate protocol level fault information to clients and may be used on the server to control the protocol specific fault representation.
[中]ProtocolException类是与特定协议绑定相关的异常的基类。子类用于将协议级故障信息传递给客户端,并可在服务器上用于控制特定于协议的故障表示。

代码示例

代码示例来源: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: gmazza/blog-samples

public static void doubleIt(DoubleItPortType port, int numToDouble,
     Map<String, Object> propertyMap) {

   if (propertyMap != null)
     HandlerUtils.printMessageContext("SOAP Client", propertyMap);

   try {
     int resp = port.doubleIt(numToDouble);
     System.out.println("The number " + numToDouble + " doubled is " + resp);
   } catch (ProtocolException e) {
     System.out.println("SOAP Call Error: " + e.getMessage());
   }
  }
}

代码示例来源: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

} catch (ProtocolException pe) {
  assertEquals("expected duplicate message ID failure",
        "Duplicate Message ID " + msgId, pe.getMessage());
  checkVerification();

代码示例来源:origin: apache/axis2-java

/**
 * 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

assertEquals(clientHandlerMessage, e.getMessage());

代码示例来源: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: apache/cxf

fail("did not get expected exception");
} catch (ProtocolException e) {
  assertEquals(clientHandlerMessage, e.getMessage());

代码示例来源: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: apache/cxf

fail("did not get expected exception");
} catch (ProtocolException e) {
  assertEquals(clientHandlerMessage, e.getMessage());

代码示例来源: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: apache/cxf

assertEquals(clientHandlerMessage, e.getMessage());

代码示例来源: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 static Object unmarshall(JAXBContext context, Schema schema, Node srcNode, QName elName) {
  Object obj = null;
  try {
    Unmarshaller u = context.createUnmarshaller();
    u.setSchema(schema);
    obj = u.unmarshal(srcNode);
    
    if (obj instanceof JAXBElement<?>) {
      JAXBElement<?> el = (JAXBElement<?>)obj;
      if (el.getName().equals(elName)) {
        obj = el.getValue();
      }
    }
  } catch (UnmarshalException ue) {
    // It's helpful to include the cause in the case of
    // schema validation exceptions.
    String message = "Unmarshalling error ";
    if (ue.getCause() != null) {
      message += ue.getCause();
    }
    throw new ProtocolException(message, ue);
    
  } catch (Exception ex) {
    throw new ProtocolException("Unmarshalling error", ex);
  }
  return obj;
}

代码示例来源: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.objectweb.celtix/celtix-rt

public static Object unmarshall(JAXBContext context, Schema schema,
                Node srcNode, QName elName, Class<?> clazz) {
  Object obj = null;
  try {
    if (context == null) {
      context = JAXBContext.newInstance(clazz);
    }
    Unmarshaller u = context.createUnmarshaller();
    u.setSchema(schema);
    obj = (clazz != null) ? u.unmarshal(srcNode, clazz) : u.unmarshal(srcNode);
    
    if (obj instanceof JAXBElement<?>) {
      JAXBElement<?> el = (JAXBElement<?>)obj;
      if (isSame(el.getName(), elName)) {
        obj = el.getValue();
      }
    }
  } catch (UnmarshalException ue) {
    // It's helpful to include the cause in the case of
    // schema validation exceptions.
    String message = "Unmarshalling error ";
    if (ue.getCause() != null) {
      message += ue.getCause();
    }
    throw new ProtocolException(message, ue);
  } catch (Exception ex) {
    throw new ProtocolException("Unmarshalling error", ex);
  }
  return obj;
}

代码示例来源: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);
    }
  }
}

相关文章