Java Code Examples for org.opensaml.ws.soap.soap11.Envelope#setBody()
The following examples show how to use
org.opensaml.ws.soap.soap11.Envelope#setBody() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CasHTTPSOAP11Encoder.java From cas4.0.x-server-wechat with Apache License 2.0 | 6 votes |
@Override protected Envelope buildSOAPMessage(final SAMLObject samlMessage) { final XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory(); final SOAPObjectBuilder<Envelope> envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME); final Envelope envelope = envBuilder.buildObject( SOAPConstants.SOAP11_NS, Envelope.DEFAULT_ELEMENT_LOCAL_NAME, OPENSAML_11_SOAP_NS_PREFIX); final SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME); final Body body = bodyBuilder.buildObject( SOAPConstants.SOAP11_NS, Body.DEFAULT_ELEMENT_LOCAL_NAME, OPENSAML_11_SOAP_NS_PREFIX); body.getUnknownXMLObjects().add(samlMessage); envelope.setBody(body); return envelope; }
Example 2
Source File: HTTPSOAP11Encoder.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Builds the SOAP message to be encoded. * * @param samlMessage body of the SOAP message * * @return the SOAP message */ @SuppressWarnings("unchecked") protected Envelope buildSOAPMessage(SAMLObject samlMessage) { log.debug("Building SOAP message"); XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory(); SOAPObjectBuilder<Envelope> envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory .getBuilder(Envelope.DEFAULT_ELEMENT_NAME); Envelope envelope = envBuilder.buildObject(); log.debug("Adding SAML message to the SOAP message's body"); SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory .getBuilder(Body.DEFAULT_ELEMENT_NAME); Body body = bodyBuilder.buildObject(); body.getUnknownXMLObjects().add(samlMessage); envelope.setBody(body); return envelope; }
Example 3
Source File: HTTPSOAP11Encoder.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Builds the SOAP message to be encoded. * * @param samlMessage body of the SOAP message * * @return the SOAP message */ @SuppressWarnings("unchecked") protected Envelope buildSOAPMessage(SAMLObject samlMessage) { if (log.isDebugEnabled()) { log.debug("Building SOAP message"); } XMLObjectBuilderFactory builderFactory = Configuration.getBuilderFactory(); SOAPObjectBuilder<Envelope> envBuilder = (SOAPObjectBuilder<Envelope>) builderFactory .getBuilder(Envelope.DEFAULT_ELEMENT_NAME); Envelope envelope = envBuilder.buildObject(); if (log.isDebugEnabled()) { log.debug("Adding SAML message to the SOAP message's body"); } SOAPObjectBuilder<Body> bodyBuilder = (SOAPObjectBuilder<Body>) builderFactory .getBuilder(Body.DEFAULT_ELEMENT_NAME); Body body = bodyBuilder.buildObject(); body.getUnknownXMLObjects().add(samlMessage); envelope.setBody(body); return envelope; }
Example 4
Source File: HandlerChainAwareHTTPSOAP11Encoder.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Perform final binding-specific processing of message context and prepare it for encoding * to the transport. * * <p> * This should include constructing and populating all binding-specific structure and data that needs to be * reflected by the message context's properties. * </p> * * <p> * This method is called prior to {@link #processOutboundHandlerChain(MessageContext)}. * </p> * * @param messageContext the message context to process * @throws MessageEncodingException thrown if there is a problem preparing the message context * for encoding */ protected void prepareMessageContext(MessageContext messageContext) throws MessageEncodingException { SAMLMessageContext samlMsgCtx = (SAMLMessageContext) messageContext; SAMLObject samlMessage = samlMsgCtx.getOutboundSAMLMessage(); if (samlMessage == null) { throw new MessageEncodingException("No outbound SAML message contained in message context"); } signMessage(samlMsgCtx); log.debug("Building SOAP envelope"); Envelope envelope = envBuilder.buildObject(); Body body = bodyBuilder.buildObject(); envelope.setBody(body); body.getUnknownXMLObjects().add(samlMessage); messageContext.setOutboundMessage(envelope); }
Example 5
Source File: SOAP11Encoder.java From lams with GNU General Public License v2.0 | 5 votes |
/** * Builds the SOAP envelope and body skeleton to be encoded. * * @param messageContext the message context being processed * * @return the minimal SOAP message envelope skeleton */ protected Envelope buildSOAPEnvelope(MessageContext messageContext) { log.debug("Building SOAP envelope"); Envelope envelope = envBuilder.buildObject(); Body body = bodyBuilder.buildObject(); envelope.setBody(body); return envelope; }
Example 6
Source File: EnvelopeUnmarshaller.java From lams with GNU General Public License v2.0 | 5 votes |
/** {@inheritDoc} */ protected void processChildElement(XMLObject parentXMLObject, XMLObject childXMLObject) throws UnmarshallingException { Envelope envelope = (Envelope) parentXMLObject; if (childXMLObject instanceof Header) { envelope.setHeader((Header) childXMLObject); } else if (childXMLObject instanceof Body) { envelope.setBody((Body) childXMLObject); } else { envelope.getUnknownXMLObjects().add(childXMLObject); } }
Example 7
Source File: ArtifactBindingHelper.java From secure-data-service with Apache License 2.0 | 5 votes |
/** * * @param artifactResolutionRequest * @return */ protected Envelope generateSOAPEnvelope(ArtifactResolve artifactResolutionRequest) { XMLObjectBuilderFactory xmlObjectBuilderFactory = Configuration.getBuilderFactory(); Envelope envelope = (Envelope) xmlObjectBuilderFactory.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).buildObject(Envelope.DEFAULT_ELEMENT_NAME); Body body = (Body) xmlObjectBuilderFactory.getBuilder(Body.DEFAULT_ELEMENT_NAME).buildObject(Body.DEFAULT_ELEMENT_NAME); body.getUnknownXMLObjects().add(artifactResolutionRequest); envelope.setBody(body); return envelope; }