/** * Store the constructed SOAP envelope in the message context for later encoding. * * @param envelope the SOAP envelope */ protected void storeSOAPEnvelope(final Envelope envelope) { getMessageContext().getSubcontext(SOAP11Context.class, true).setEnvelope(envelope); }
/** * Store the constructed SOAP envelope in the message context for later encoding. * * @param envelope the SOAP envelope */ protected void storeSOAPEnvelope(Envelope envelope) { getMessageContext().getSubcontext(SOAP11Context.class, true).setEnvelope(envelope); }
/** * Store the constructed SOAP envelope in the message context for later encoding. * * @param envelope the SOAP envelope */ protected void storeSOAPEnvelope(Envelope envelope) { getMessageContext().getSubcontext(SOAP11Context.class, true).setEnvelope(envelope); }
/** * Process a successful response, i.e. one where the HTTP response code was 200. * * @param httpResponse the HTTP client response * @param soapContext the SOAP11Context instance * * @throws MessageDecodingException if message can not be unmarshalled * @throws IOException if there is a problem with the response entity input stream */ protected void processSuccessResponse(HttpResponse httpResponse, SOAP11Context soapContext) throws MessageDecodingException, IOException { if (httpResponse.getEntity() == null) { throw new MessageDecodingException("No response body from server"); } Envelope soapMessage = (Envelope) unmarshallMessage(httpResponse.getEntity().getContent()); // Defensive sanity check, otherwise body handler could later fail non-gracefully with runtime exception Fault fault = getFault(soapMessage); if (fault != null) { throw new SOAP11FaultDecodingException(fault); } soapContext.setEnvelope(soapMessage); soapContext.setHTTPResponseStatus(httpResponse.getStatusLine().getStatusCode()); }
/** * Process a successful, as determined by an HTTP 200 status code, response. * * @param httpResponse the HTTP response * @param context current operation context * * @throws SOAPClientException thrown if there is a problem reading the response from the {@link HttpPost} */ protected void processSuccessfulResponse(@Nonnull final HttpResponse httpResponse, @Nonnull final InOutOperationContext context) throws SOAPClientException { try { if (httpResponse.getEntity() == null) { throw new SOAPClientException("No response body from server"); } final Envelope response = unmarshallResponse(httpResponse.getEntity().getContent()); context.setInboundMessageContext(new MessageContext()); context.getInboundMessageContext().getSubcontext(SOAP11Context.class, true).setEnvelope(response); //TODO: goes away? //evaluateSecurityPolicy(messageContext); } catch (final IOException e) { throw new SOAPClientException("Unable to read response", e); } }
try { soapMessage = (Envelope) unmarshallMessage(request.getInputStream()); messageContext.getSubcontext(SOAP11Context.class, true).setEnvelope(soapMessage); } catch (IOException e) { log.error("Unable to obtain input stream from HttpServletRequest", e);
try { soapMessage = (Envelope) unmarshallMessage(request.getInputStream()); messageContext.getSubcontext(SOAP11Context.class, true).setEnvelope(soapMessage); } catch (final IOException e) { log.error("Unable to obtain input stream from HttpServletRequest", e);
context.getInboundMessageContext().getSubcontext(SOAP11Context.class, true).setEnvelope(response);
@Override protected void doDecode() throws MessageDecodingException { final SAML2MessageContext messageContext = new SAML2MessageContext(); if (ContextHelper.isPost(context)) { final String relayState = this.context.getRequestParameter("RelayState"); logger.debug("Decoded SAML relay state of: {}", relayState); SAMLBindingSupport.setRelayState(messageContext, relayState); final byte[] base64DecodedMessage = this.getBase64DecodedMessage(); final XMLObject xmlObject = this.unmarshallMessage(new ByteArrayInputStream(base64DecodedMessage)); final SAMLObject inboundMessage; if (xmlObject instanceof Envelope) { Envelope soapMessage = (Envelope) xmlObject; messageContext.getSOAP11Context().setEnvelope(soapMessage); try { new SAMLSOAPDecoderBodyHandler().invoke(messageContext); } catch (final MessageHandlerException e) { throw new MessageDecodingException("Cannot decode SOAP envelope", e); } } else { inboundMessage = (SAMLObject) xmlObject; messageContext.setMessage(inboundMessage); } logger.debug("Decoded SAML message"); this.populateBindingContext(messageContext); this.setMessageContext(messageContext); } else { throw new MessageDecodingException("This message decoder only supports the HTTP POST method"); } }
@Override protected Event doExecute( final @Nonnull RequestContext springRequestContext, final @Nonnull ProfileRequestContext profileRequestContext) { final MessageContext<SAMLObject> msgContext = new MessageContext<>(); try { msgContext.setMessage(buildSamlResponse(springRequestContext, profileRequestContext)); } catch (final IllegalStateException e) { return ProtocolError.IllegalState.event(this); } final SAMLBindingContext bindingContext = new SAMLBindingContext(); bindingContext.setBindingUri(SAMLConstants.SAML1_SOAP11_BINDING_URI); msgContext.addSubcontext(bindingContext); // Ensure message uses SOAP-ENV ns prefix required by old/broken CAS clients final Envelope envelope = (Envelope) XMLObjectSupport.buildXMLObject(envelopeName); envelope.setBody((Body) XMLObjectSupport.buildXMLObject(bodyName)); final SOAP11Context soapCtx = new SOAP11Context(); soapCtx.setEnvelope(envelope); msgContext.addSubcontext(soapCtx); profileRequestContext.setOutboundMessageContext(msgContext); return ActionSupport.buildProceedEvent(this); }
val result = new MessageContext(); val ctx = result.getSubcontext(SOAP11Context.class, true); ctx.setEnvelope(envelope); val encoder = new HTTPSOAP11Encoder(); encoder.setHttpServletResponse(httpResponse);