本文整理汇总了Java中org.apache.cxf.binding.soap.SoapMessage.getContent方法的典型用法代码示例。如果您正苦于以下问题:Java SoapMessage.getContent方法的具体用法?Java SoapMessage.getContent怎么用?Java SoapMessage.getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.binding.soap.SoapMessage
的用法示例。
在下文中一共展示了SoapMessage.getContent方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault {
Fault fault = (Fault) message.getContent(Exception.class);
LOG.warn("Error: " + fault, fault);
if (fault.getCause() instanceof SonosSoapFault) {
SonosSoapFault cause = (SonosSoapFault) fault.getCause();
fault.setFaultCode(new QName(cause.getFaultCode()));
fault.setMessage(cause.getFaultCode());
Document document = DOMUtils.createDocument();
Element details = document.createElement("detail");
fault.setDetail(details);
details.appendChild(document.createElement("ExceptionInfo"));
Element sonosError = document.createElement("SonosError");
sonosError.setTextContent(String.valueOf(cause.getSonosError()));
details.appendChild(sonosError);
}
}
示例2: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(final SoapMessage message) throws Fault {
final Fault fault = (Fault) message.getContent(Exception.class);
// Only change the fault code if it was not generated by Cyclos
if (!WebServiceHelper.isFromCyclos(fault)) {
final Throwable exception = fault.getCause() == null ? fault : fault.getCause();
final SoapFault soapFault = WebServiceHelper.fault(exception);
fault.setDetail(null);
fault.setFaultCode(soapFault.getFaultCode());
fault.setMessage(message(exception));
}
// there are cases where this interceptor is invoked but the context wasn't initialized
// (e.g.: there is a unmarshalling error when CXF is trying to convert the request parameters)
//
if (WebServiceContext.isInitialized()) {
final HttpServletRequest request = WebServiceContext.getRequest();
request.setAttribute("soapFault", fault);
}
webServiceHelper.error(fault);
}
示例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(new OracleEbMSXMLPrefixFixingOutEndingInterceptor());
}
catch (Exception e)
{
throw new Fault(e);
}
}
示例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 XMLSecSignatureOutEndingInterceptor());
}
catch (XMLStreamException e)
{
throw new Fault(e);
}
}
示例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(getEndingInterceptor());
}
catch (XMLStreamException e)
{
throw new Fault(e);
}
}
示例6: 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);
}
}
示例7: 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);
}
}
示例8: 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));
}
}
示例9: 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);
}
示例10: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage soapMessage) throws Fault {
Fault fault = (Fault) soapMessage.getContent(Exception.class);
Throwable faultCause = fault.getCause();
String faultMessage = fault.getMessage();
if (containsFaultIndicatingNotSchemeCompliantXml(faultCause, faultMessage)) {
LOG.schemaValidationError(FaultConst.SCHEME_VALIDATION_ERROR, faultMessage);
WeatherSoapFaultHelper.buildWeatherFaultAndSet2SoapMessage(soapMessage, FaultConst.SCHEME_VALIDATION_ERROR);
} else if (containsFaultIndicatingSyntacticallyIncorrectXml(faultCause)) {
LOG.schemaValidationError(FaultConst.SYNTACTICALLY_INCORRECT_XML_ERROR, faultMessage);
WeatherSoapFaultHelper.buildWeatherFaultAndSet2SoapMessage(soapMessage, FaultConst.SYNTACTICALLY_INCORRECT_XML_ERROR);
}
}
示例11: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
public void handleMessage(SoapMessage message) {
// remove the soap header to avoid the endless loop
SOAPMessage saaj = message.getContent(SOAPMessage.class);
if (saaj != null) {
// AS CXF_MESSAGE already build up all the SOAP message
// need to clean up the soap Header from message to avoid endless loop
message.getHeaders().clear();
}
}
示例12: getParameter
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
public static <T> T getParameter(final SoapMessage message) {
final List parameterValues = message.getContent(List.class);
if (CollectionUtils.isNotEmpty(parameterValues)) {
return (T) parameterValues.iterator().next();
} else {
return (T) message.getContent(Object.class);
}
}
示例13: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
if (message.getContent(SOAPMessage.class) == null)
{
return;
}
authManager.secureResponse(message);
}
示例14: secureResponse
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
public void secureResponse(SoapMessage message)
{
SOAPMessage request = message.getExchange().getInMessage().get(SOAPMessage.class);
SOAPMessage response = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(request, response);
AuthStatus authStatus = null;
try
{
authStatus = sctx.secureResponse(messageInfo, null);
}
catch (AuthException e)
{
if (isSOAP12(message))
{
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getReceiver());
throw soap12Fault;
}
else
{
throw new SoapFault(e.getMessage(), new QName("", "jaspi AuthException"));
}
}
if (messageInfo.getResponseMessage() != null && !message.getExchange().isOneWay())
{
if (AuthStatus.SEND_CONTINUE == authStatus)
{
message.put(Message.RESPONSE_CODE, Integer.valueOf(303));
}
if (AuthStatus.SEND_FAILURE == authStatus)
{
message.put(Message.RESPONSE_CODE, Integer.valueOf(500));
}
}
}
示例15: secureRequest
import org.apache.cxf.binding.soap.SoapMessage; //导入方法依赖的package包/类
public void secureRequest(SoapMessage message)
{
SOAPMessage soapMessage = message.getContent(SOAPMessage.class);
MessageInfo messageInfo = new GenericMessageInfo(soapMessage, null);
String authContextID = clientConfig.getAuthContextID(messageInfo);
Properties serverContextProperties = new Properties();
serverContextProperties.put("security-domain", securityDomain);
serverContextProperties.put("jaspi-policy", jpi);
Subject clientSubject = new Subject();
@SuppressWarnings("unused")
AuthStatus authStatus = null;
try
{
ClientAuthContext cctx = clientConfig.getAuthContext(authContextID, clientSubject, serverContextProperties);
authStatus = cctx.secureRequest(messageInfo, clientSubject);
}
catch (AuthException e)
{
if (isSOAP12(message))
{
SoapFault soap12Fault = new SoapFault(e.getMessage(), Soap12.getInstance().getSender());
throw soap12Fault;
}
else
{
throw new SoapFault(e.getMessage(), new QName("", "japsi AuthException"));
}
}
//TODO:look at how to handle AuthStatus
}