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


Java SoapMessage.setContent方法代码示例

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


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

示例1: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
   try
	{
   	OutputStream originalOs = message.getContent(OutputStream.class);
		message.put(OUTPUT_STREAM_HOLDER,originalOs);
     CachedOutputStream cos = new CachedOutputStream();
     message.setContent(OutputStream.class,cos); 
		message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
    message.getInterceptorChain().add(new OracleEbMSXMLPrefixFixingOutEndingInterceptor()); 
	}
	catch (Exception e)
	{
		throw new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:OracleEbMSXMLPrefixFixingOutInterceptor.java

示例2: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
   try
	{
   		OutputStream originalOs = message.getContent(OutputStream.class);
		message.put(OUTPUT_STREAM_HOLDER,originalOs);
		CachedOutputStream cos = new CachedOutputStream();
		message.setContent(OutputStream.class,cos);
		message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
		message.getInterceptorChain().add(new XMLSecSignatureOutEndingInterceptor()); 
	}
	catch (XMLStreamException e)
	{
		throw new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:XMLSecSignatureOutInterceptor.java

示例3: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	try
	{
		OutputStream originalOs = message.getContent(OutputStream.class);
		message.put(OUTPUT_STREAM_HOLDER,originalOs);
		CachedOutputStream cos = new CachedOutputStream();
		message.setContent(OutputStream.class,cos);
		message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
		message.getInterceptorChain().add(getEndingInterceptor()); 
	}
	catch (XMLStreamException e)
	{
		throw new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:EbMSSecSignatureOutInterceptor.java

示例4: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
   try
	{
   	OutputStream originalOs = message.getContent(OutputStream.class);
		message.put(OUTPUT_STREAM_HOLDER,originalOs);
     CachedOutputStream cos = new CachedOutputStream();
     message.setContent(OutputStream.class,cos); 
		message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
    message.getInterceptorChain().add(new XMLDSignatureOutEndingInterceptor()); 
	}
	catch (XMLStreamException e)
	{
		throw new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:XMLDSignatureOutInterceptor.java

示例5: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
   try
	{
   	OutputStream originalOs = message.getContent(OutputStream.class);
		message.put(OUTPUT_STREAM_HOLDER,originalOs);
     CachedOutputStream cos = new CachedOutputStream();
     message.setContent(OutputStream.class,cos); 
		message.setContent(XMLStreamWriter.class,StaxOutInterceptor.getXMLOutputFactory(message).createXMLStreamWriter(cos,getEncoding(message)));
    message.getInterceptorChain().add(new LoggingOutEndingInterceptor()); 
	}
	catch (XMLStreamException e)
	{
		throw new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:18,代码来源:LoggingOutInterceptor.java

示例6: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	String mappedNamespace = message.getExchange().getService().getName().getNamespaceURI();
	InputStream in = message.getContent(InputStream.class);
	if( in != null )
	{
		// ripped from StaxInInterceptor
		String contentType = (String) message.get(Message.CONTENT_TYPE);
		if( contentType == null )
		{
			// if contentType is null, this is likely a an empty
			// post/put/delete/similar, lets see if it's
			// detectable at all
			Map<String, List<String>> m = CastUtils.cast((Map<?, ?>) message.get(Message.PROTOCOL_HEADERS));
			if( m != null )
			{
				List<String> contentLen = HttpHeaderHelper.getHeader(m, HttpHeaderHelper.CONTENT_LENGTH);
				List<String> contentTE = HttpHeaderHelper.getHeader(m, HttpHeaderHelper.CONTENT_TRANSFER_ENCODING);
				if( (StringUtils.isEmpty(contentLen) || "0".equals(contentLen.get(0)))
					&& StringUtils.isEmpty(contentTE) )
				{
					return;
				}
			}
		}

		// Inject our LegacyPythonHack
		XMLStreamReader reader = StaxUtils.createXMLStreamReader(in);
		message.setContent(XMLStreamReader.class, new LegacyPythonClientXMLStreamReader(reader, mappedNamespace));
	}
}
 
开发者ID:equella,项目名称:Equella,代码行数:33,代码来源:LegacyPythonClientInInterceptor.java

示例7: buildWeatherFaultAndSet2SoapMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
public static void buildWeatherFaultAndSet2SoapMessage(SoapMessage message, FaultConst faultContent) {
	Fault exceptionFault = (Fault) message.getContent(Exception.class);
	String originalFaultMessage = exceptionFault.getMessage();
	exceptionFault.setMessage(faultContent.getMessage());
	exceptionFault.setDetail(createFaultDetailWithWeatherException(originalFaultMessage, faultContent));
	message.setContent(Exception.class, exceptionFault);
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:8,代码来源:WeatherSoapFaultHelper.java

示例8: handleMessageInternal

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
protected void handleMessageInternal(SoapMessage message) throws Exception {
    CacheAndWriteOutputStream cachedStream = new CacheAndWriteOutputStream(message.getContent(OutputStream.class));
    cachedStream.close();

    cachedStream.registerCallback(this.buildCallback(message));
    message.setContent(OutputStream.class, cachedStream);
}
 
开发者ID:esacinc,项目名称:sdcct,代码行数:9,代码来源:AbstractServerIheTestcaseOutInterceptor.java

示例9: reserialize

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
private void reserialize(SoapMessage message) throws Exception {
    SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
    if (soapMessage == null) {
        return;
    }

    DOMSource bodySource = new DOMSource(soapMessage.getSOAPPart());
    XMLStreamReader xmlReader = StaxUtils.createXMLStreamReader(bodySource);
    message.setContent(XMLStreamReader.class, xmlReader);
}
 
开发者ID:apache,项目名称:tomee,代码行数:11,代码来源:EjbInterceptor.java

示例10: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
public final void handleMessage(SoapMessage message) {
    String schemaNamespace = "";
    InterceptorChain chain = message.getInterceptorChain();

    // Scan the incoming message for its schema namespace
    try {
        // Create a buffered stream so that we get back the original stream after scanning
        InputStream is = message.getContent(InputStream.class);
        BufferedInputStream bis = new BufferedInputStream(is);
        bis.mark(bis.available());
        message.setContent(InputStream.class, bis);

        String encoding = (String) message.get(Message.ENCODING);
        XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(bis, encoding);
        DepthXMLStreamReader xmlReader = new DepthXMLStreamReader(reader);

        if (xmlReader.nextTag() == XMLStreamConstants.START_ELEMENT) {
            String ns = xmlReader.getNamespaceURI();
            SoapVersion soapVersion = SoapVersionFactory.getInstance().getSoapVersion(ns);
            // Advance just past header
            StaxUtils.toNextTag(xmlReader, soapVersion.getBody());
            // Past body
            xmlReader.nextTag();
        }
        schemaNamespace = xmlReader.getName().getNamespaceURI();
        bis.reset();

    } catch (IOException | XMLStreamException ex) {
        log.error("Exception happened", ex);
    }

    // Init the lookup, when the first message ever arrives
    if (actualServers.isEmpty()) {
        initServerLookupMap(message);
    }

    // We redirect the message to the actual OCPP service
    Server targetServer = actualServers.get(schemaNamespace);

    // Redirect the request
    if (targetServer != null) {
        MessageObserver mo = targetServer.getDestination().getMessageObserver();
        mo.onMessage(message);
    }

    // Now the response has been put in the message, abort the chain
    chain.abort();
}
 
开发者ID:RWTH-i5-IDSG,项目名称:steve-plugsurfing,代码行数:49,代码来源:MediatorInInterceptor.java

示例11: handleMessage

import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
	try
	{
		KeyStore keyStore = SecurityUtils.loadKeyStore(keyStorePath,keyStorePassword);

		XMLStreamReader reader = message.getContent(XMLStreamReader.class);
		Document document = StaxUtils.read(reader);
		XMLStreamReader copy = StaxUtils.createXMLStreamReader(document);
		message.setContent(XMLStreamReader.class,copy);

		List<EbMSDataSource> dataSources = new ArrayList<EbMSDataSource>();
		if (message.getAttachments() != null)
			for (Attachment attachment : message.getAttachments())
				dataSources.add(new EbMSDataSource(attachment.getDataHandler().getDataSource(),attachment.getId(),attachment.getDataHandler().getName()));

		NodeList signatureNodeList = document.getElementsByTagNameNS(org.apache.xml.security.utils.Constants.SignatureSpecNS,org.apache.xml.security.utils.Constants._TAG_SIGNATURE);
		if (signatureNodeList.getLength() > 0)
		{
			boolean isValid = false;
			X509Certificate certificate = getCertificate(document);
			if (certificate != null)
			{
				isValid = validateCertificate(keyStore,certificate,new Date()/*TODO get date from message???*/);
				if (!isValid)
					logger.info("Certificate invalid.");
				else
				{
					isValid = verify(certificate,signatureNodeList,dataSources);
					logger.info("Signature" + (isValid ? " " : " in") + "valid.");
				}
			}
			SignatureManager.set(new Signature(certificate,XMLMessageBuilder.getInstance(SignatureType.class).handle(signatureNodeList.item(0)),isValid));
		}
		else
			SignatureManager.set(null);
	}
	catch (Exception e)
	{
		throw new Fault(e);
	}
}
 
开发者ID:mprins,项目名称:muleebmsadapter,代码行数:44,代码来源:EbMSSecSignatureInInterceptor.java


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