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); } }
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()); } } }
/** * 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; }
} catch (ProtocolException pe) { assertEquals("expected duplicate message ID failure", "Duplicate Message ID " + msgId, pe.getMessage()); checkVerification();
/** * 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; }
assertEquals(clientHandlerMessage, e.getMessage());
public void handleMessage(Message message) throws Fault { String str = new String("Collocated Invocation should have been detected."); throw new ProtocolException(str); } }
fail("did not get expected exception"); } catch (ProtocolException e) { assertEquals(clientHandlerMessage, e.getMessage());
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); } } }
fail("did not get expected exception"); } catch (ProtocolException e) { assertEquals(clientHandlerMessage, e.getMessage());
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; }
assertEquals(clientHandlerMessage, e.getMessage());
@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; }
@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; }
@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; }
sslEngine.beginHandshake(); } catch (SSLException e) { throw new ProtocolException(e);
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; }
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; }
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; }
/** * 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); } } }