本文整理汇总了Java中org.apache.cxf.binding.soap.SoapMessage类的典型用法代码示例。如果您正苦于以下问题:Java SoapMessage类的具体用法?Java SoapMessage怎么用?Java SoapMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SoapMessage类属于org.apache.cxf.binding.soap包,在下文中一共展示了SoapMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
@SuppressWarnings("nls")
@Override
public void handleMessage(SoapMessage message) throws Fault
{
final UserState us = CurrentUser.getUserState();
XMLStreamWriterCallback obj = new XMLStreamWriterCallback()
{
@Override
public void write(XMLStreamWriter writer) throws Fault, XMLStreamException
{
writer.writeEmptyElement("equella");
writer.writeAttribute("session", us.getSessionID());
writer.writeAttribute("id", us.getUserBean().getUniqueID());
writer.writeAttribute("username", us.getUserBean().getUsername());
}
};
message.getHeaders().add(new Header(new QName("equella"), obj, new StaxDataBinding()));
}
示例2: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault
{
Header header = message.getHeader(new QName("equella"));
if( header != null )
{
Element e = (Element) header.getObject();
PropBagEx equella = new PropBagEx(e);
String token = equella.getNode("token");
if( !Check.isEmpty(token) )
{
HttpServletRequest request = (HttpServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
try
{
userService.loginWithToken(token, userService.getWebAuthenticationDetails(request), true);
}
catch( RuntimeException ex )
{
LOGGER.error("Error initialising session with SOAP header token '" + token + "' for URL "
+ request.getRequestURL().toString());
throw ex;
}
}
}
}
示例3: initServerLookupMap
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
/**
* Iterate over all available servers registered on the bus and build a map
* consisting of (namespace, server) pairs for later lookup, so we can
* redirect to the version-specific implementation according to the namespace
* of the incoming message.
*/
private void initServerLookupMap(SoapMessage message) {
Bus bus = message.getExchange().getBus();
ServerRegistry serverRegistry = bus.getExtension(ServerRegistry.class);
if (serverRegistry == null) {
return;
}
List<Server> temp = serverRegistry.getServers();
for (Server server : temp) {
EndpointInfo info = server.getEndpoint().getEndpointInfo();
String address = info.getAddress();
// exclude the 'dummy' routing server
if (CONFIG.getRouterEndpointPath().equals(address)) {
continue;
}
String serverNamespace = info.getName().getNamespaceURI();
actualServers.put(serverNamespace, server);
}
}
示例4: getMsgType
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
private int getMsgType(SoapMessage soapMessage)
{
if (null == soapMessage)
{
return UNKNOWNMESSAGE;
}
int msgType = UNKNOWNMESSAGE;
QName actionName = (QName)soapMessage.get("javax.xml.ws.wsdl.port");
if (null == actionName)
{
return UNKNOWNMESSAGE;
}
if (actionName.toString().contains("IM") && actionName.toString().contains("Port"))
{
msgType = IMMESSAGE;
}
else
{
msgType = OTHERMESSAGE;
}
return msgType;
}
示例5: verifyPlaintextPassword
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
@Override
protected void verifyPlaintextPassword(UsernameToken usernameToken, RequestData data) throws WSSecurityException {
logger.debug("userIdString=" + usernameToken.getName());
logger.debug("password=" + usernameToken.getPassword());
try {
Integer securityUserId = Integer.parseInt(usernameToken.getName());
Security security = securityDao.find(securityUserId);
// if it's all good just return
SoapMessage soapMessage = (SoapMessage) data.getMsgContext();
HttpServletRequest request = (HttpServletRequest) soapMessage.get(AbstractHTTPDestination.HTTP_REQUEST);
if (WsUtils.checkAuthenticationAndSetLoggedInInfo(request, security, usernameToken.getPassword())) return;
} catch (NumberFormatException e) {
logger.error("userIdString is not a number? usernameToken.getName()='" + usernameToken.getName() + '\'');
}
throw new WSSecurityException(WSSecurityException.FAILED_AUTHENTICATION);
}
示例6: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
@Override
public void handleMessage(SoapMessage message) throws Fault {
super.handleMessage(message);
MessageContentsList contents = MessageContentsList.getContentsList(message);
if (contents != null && contents.size() == 1) {
Object requestObj = contents.get(0);
if (requestObj instanceof TrzbaType) {
TrzbaType request = (TrzbaType) requestObj;
TrzbaHlavickaType header = request.getHlavicka();
// validation is required if isOvereni is unspecified or false.
boolean required = header == null || !Boolean.TRUE.equals(header.isOvereni());
message.getExchange().put(WSS4JEetInInterceptor.PROP_SIGNATURE_REQUIRED, required);
}
}
}
示例7: 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);
}
}
示例8: 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);
}
示例9: resolveOperations
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
/**
* Resolve the possible operations for the current request
*/
private ServiceOperation[] resolveOperations(final SoapMessage message) {
final MessageInfo messageInfo = message.get(MessageInfo.class);
final OperationInfo operation = messageInfo.getOperation();
final QName operationQName = operation.getName();
// Try to find the operations in the cache
ServiceOperation[] operations = cachedOperations.get(operationQName);
if (operations == null) {
// Cache miss... find the interface method
final String operationName = operationQName.getLocalPart();
final String serviceName = operation.getInterface().getService().getName().getLocalPart();
final Class<?> serviceInterface = CyclosWebServicesClientFactory.serviceInterfaceForName(serviceName);
for (final Method m : serviceInterface.getMethods()) {
if (m.getName().equals(operationName)) {
final Permission permission = m.getAnnotation(Permission.class);
operations = permission == null ? new ServiceOperation[0] : permission.value();
break;
}
}
// Store the operations on the cache for further access
cachedOperations.put(operationQName, operations);
}
return operations;
}
示例10: processRequest
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
@Override
protected IheFormReceiverTestcaseResult processRequest(AnyXmlContentType request, SoapMessage message, @Nonnegative long submittedTimestamp, String txId)
throws Exception {
IheFormReceiverTestcaseResult result;
if (request.getAny().get(0) instanceof SdcSubmissionPackage) {
SdcSubmissionPackage submissionPackage = (SdcSubmissionPackage) request.getAny().get(0);
List<FormDesignType> formDesigns = submissionPackage.getFormDesigns();
if (!formDesigns.isEmpty()) {
String formId = formDesigns.get(0).getId();
IheFormReceiverTestcase iheFormReceiverTestcase = this.findTestcase(request, this.iheFormReceiverTestcases, formId);
result = this.createResult(iheFormReceiverTestcase, message, formId, submittedTimestamp, txId);
} else {
result = this.createResult(null, message, null, submittedTimestamp, txId);
}
} else {
result = this.createResult(null, message, null, submittedTimestamp, txId);
}
return result;
}
示例11: processRequest
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
@Override
protected IheFormArchiverTestcaseResult processRequest(AnyXmlContentType request, SoapMessage message, @Nonnegative long submittedTimestamp, String txId)
throws Exception {
IheFormArchiverTestcaseResult result;
if (request.getAny().get(0) instanceof SdcSubmissionPackage) {
SdcSubmissionPackage submissionPackage = (SdcSubmissionPackage) request.getAny().get(0);
List<FormDesignType> formDesigns = submissionPackage.getFormDesigns();
if (!formDesigns.isEmpty()) {
String formId = formDesigns.get(0).getId();
IheFormArchiverTestcase iheFormArchiverTestcase = this.findTestcase(request, this.iheFormArchiverTestcases, formId);
result = this.createResult(iheFormArchiverTestcase, message, formId, submittedTimestamp, txId);
} else {
result = this.createResult(null, message, null, submittedTimestamp, txId);
}
} else {
result = this.createResult(null, message, null, submittedTimestamp, txId);
}
return result;
}
示例12: handleMessage
import org.apache.cxf.binding.soap.SoapMessage; //导入依赖的package包/类
public void handleMessage(SoapMessage message) {
try {
// 1. Build effective policy for response
org.apache.cxf.ws.policy.PolicyBuilder builder = message
.getExchange().getBus()
.getExtension(org.apache.cxf.ws.policy.PolicyBuilder.class);
InputStream xmlGenericPolicy = new FileInputStream("/home/hans/workspace/TechyTax/src/org/techytax/xbrl/policy.xml");
Policy effectivePolicy = builder.getPolicy(xmlGenericPolicy);
// 2. Apply effective policy
message.put(PolicyConstants.POLICY_OVERRIDE, effectivePolicy);
} catch (Exception e) {
e.printStackTrace();
}
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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);
}
}