当前位置: 首页>>代码示例>>Java>>正文


Java Envelope.setBody方法代码示例

本文整理汇总了Java中org.opensaml.ws.soap.soap11.Envelope.setBody方法的典型用法代码示例。如果您正苦于以下问题:Java Envelope.setBody方法的具体用法?Java Envelope.setBody怎么用?Java Envelope.setBody使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.opensaml.ws.soap.soap11.Envelope的用法示例。


在下文中一共展示了Envelope.setBody方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: buildSOAPMessage

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
@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;
}
 
开发者ID:luotuo,项目名称:cas4.0.x-server-wechat,代码行数:20,代码来源:CasHTTPSOAP11Encoder.java

示例2: buildSOAPMessage

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:26,代码来源:HTTPSOAP11Encoder.java

示例3: buildSOAPMessage

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:30,代码来源:HTTPSOAP11Encoder.java

示例4: prepareMessageContext

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
/**
 * 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);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:37,代码来源:HandlerChainAwareHTTPSOAP11Encoder.java

示例5: testGetTokenFault

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
@Test(expected=TrustException.class)
public void testGetTokenFault() throws Exception {
	client.setAppliesTo("urn:service");

	final Envelope response = SAMLUtil.buildXMLObject(Envelope.class);
	response.setBody(SAMLUtil.buildXMLObject(Body.class));
	Fault fault = SAMLUtil.buildXMLObject(Fault.class);
	fault.setDetail(SAMLUtil.buildXMLObject(Detail.class));
	response.getBody().getUnknownXMLObjects().add(fault);
	context.checking(new Expectations() {{
		one(soapClient).wsCall(with(equal(ADDRESS)), with(aNull(String.class)), with(aNull(String.class)), with(equal(true)), with(any(String.class)), with(equal("http://docs.oasis-open.org/ws-sx/ws-trust/200512/RST/Issue")));
		will(returnValue(response));
	}});
	
	client.getToken();
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:17,代码来源:TokenClientTest.java

示例6: buildSOAPEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
/**
 * 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;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:18,代码来源:SOAP11Encoder.java

示例7: processChildElement

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
/** {@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);
    }
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:EnvelopeUnmarshaller.java

示例8: makeSoapEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
private Envelope makeSoapEnvelope(XMLObject obj) {
  Body body = getSoapBody();
  body.getUnknownXMLObjects().add(obj);
  Envelope evp = (Envelope) _bf.getBuilder(Envelope.DEFAULT_ELEMENT_NAME).
                                  buildObject(Envelope.DEFAULT_ELEMENT_NAME);
  evp.setBody(body);
 
  return evp;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:10,代码来源:SamlSecurityProvider.java

示例9: getSoapEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
public Envelope getSoapEnvelope(Body body) {
  Envelope evp = (Envelope) _bf.
        getBuilder(Envelope.DEFAULT_ELEMENT_NAME).
          buildObject(Envelope.DEFAULT_ELEMENT_NAME);
  evp.setBody(body);
  
  return evp;
}
 
开发者ID:osbitools,项目名称:OsBiToolsWs,代码行数:9,代码来源:SamlSecurityProvider.java

示例10: testHandleFault

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
@Test(expected=LoginException.class)
public void testHandleFault() throws Exception {
	when(req.getParameter("wa")).thenReturn("wsignin1.0");
	Envelope env = SAMLUtil.buildXMLObject(Envelope.class);
	env.setBody(SAMLUtil.buildXMLObject(Body.class));
	Fault fault = SAMLUtil.buildXMLObject(Fault.class);
	FaultCode code = SAMLUtil.buildXMLObject(FaultCode.class);
	code.setValue(new QName("urn:test", "test", "t"));
	fault.setCode(code);
	env.getBody().getUnknownXMLObjects().add(fault);
	
	when(req.getParameter("wresult")).thenReturn(XMLHelper.nodeToString(SAMLUtil.marshallObject(env)));
	
	handler.handleGet(rc);
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:16,代码来源:ConsumerHandlerTest.java

示例11: run

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
public void run() {
	try {
		
		Socket client = ss.accept();
		BufferedReader in = new BufferedReader(new InputStreamReader(client.getInputStream()));
		
		StringBuilder sb = new StringBuilder();
		String line = null;
		
		headers = new HashMap<String, String>();
		while ((line = in.readLine()) != null) {
			if ("".equals(line.trim())) {
				for (int i = 0; i < Integer.parseInt(headers.get("Content-Length")); i++) {
					sb.append((char)in.read());
				}
				break;
			}
			String[] h = line.split(": ");
			if (h.length == 2) {
				headers.put(h[0], h[1]);
			}
		}
		PrintWriter pw = new PrintWriter(client.getOutputStream());
		pw.println("HTTP/1.1 200 OK");
		pw.println("Server: test");
		pw.println();

		Envelope env = SAMLUtil.buildXMLObject(Envelope.class);
		Body body = SAMLUtil.buildXMLObject(Body.class);
		env.setBody(body);
		body.getUnknownXMLObjects().add(SAMLUtil.buildXMLObject(ArtifactResponse.class));
		pw.println(XMLHelper.nodeToString(SAMLUtil.marshallObject(env)));
		pw.close();
		
	} catch (IOException e) {
		e.printStackTrace();
	}

}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:40,代码来源:HttpSOAPClientTest.java

示例12: generateSOAPEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
/**
 *
 * @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;
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:16,代码来源:ArtifactBindingHelper.java

示例13: wrapInSOAPEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
public static Envelope wrapInSOAPEnvelope(final XMLObject xmlObject) throws IllegalAccessException {
    Envelope envelope = OpenSAMLUtils.buildSAMLObject(Envelope.class);
    Body body = OpenSAMLUtils.buildSAMLObject(Body.class);

    body.getUnknownXMLObjects().add(xmlObject);

    envelope.setBody(body);

    return envelope;
}
 
开发者ID:rasmusson,项目名称:webprofile-ref-project,代码行数:11,代码来源:OpenSAMLUtils.java

示例14: wrapInSOAPEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
public static Envelope wrapInSOAPEnvelope(final XMLObject xmlObject) {
    Envelope envelope = OpenSAMLUtils.buildSAMLObject(Envelope.class);
    Body body = OpenSAMLUtils.buildSAMLObject(Body.class);

    body.getUnknownXMLObjects().add(xmlObject);

    envelope.setBody(body);

    return envelope;
}
 
开发者ID:rasmusson,项目名称:webprofile-ref-project,代码行数:11,代码来源:ArtifactResolutionServlet.java

示例15: wrapInSOAPEnvelope

import org.opensaml.ws.soap.soap11.Envelope; //导入方法依赖的package包/类
public static Envelope wrapInSOAPEnvelope(final XMLObject xmlObject) throws IllegalAccessException {
	Envelope envelope = buildXMLObjectDefaultName(Envelope.class);
	Body body = buildXMLObjectDefaultName(Body.class);

	body.getUnknownXMLObjects().add(xmlObject);

	envelope.setBody(body);

	return envelope;
}
 
开发者ID:rasmusson,项目名称:MockIDP,代码行数:11,代码来源:MockIDPArtifactResolve.java


注:本文中的org.opensaml.ws.soap.soap11.Envelope.setBody方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。