use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class SOAP11ClientHandler method getContentType.
protected ContentType getContentType(MessageContext msgContext) {
ContentType contentType = null;
try {
// Metro does not process this header into the message
@SuppressWarnings("unchecked") Map<String, List<String>> headers = (Map<String, List<String>>) msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
List<String> ctype = (headers == null) ? null : headers.get("Content-Type");
if (ctype == null) {
// Cxf stores it in lower case
ctype = (headers == null) ? null : headers.get("content-type");
}
log.info("ctype=" + ctype);
if (ctype == null) {
// Native has already processed this header into the message
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
String[] ct = mimeHeaders.getHeader("Content-Type");
log.info("ct=" + ct);
if (ct != null) {
contentType = new ContentType(ct[0]);
}
} else {
contentType = new ContentType(ctype.get(0));
}
} catch (ParseException e) {
throw new WebServiceException(e);
}
return contentType;
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class SOAP11ServerHandler method getContentType.
protected ContentType getContentType(MessageContext msgContext) {
ContentType contentType = null;
try {
// Metro does not process this header into the message
@SuppressWarnings("unchecked") Map<String, List<String>> headers = (Map<String, List<String>>) msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
List<String> ctype = (headers == null) ? null : headers.get("Content-Type");
if (ctype == null) {
// Cxf stores it in lower case
ctype = (headers == null) ? null : headers.get("content-type");
}
log.info("ctype=" + ctype);
if (ctype == null) {
// Native has already processed this header into the message
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
String[] ct = mimeHeaders.getHeader("Content-Type");
log.info("ct=" + ct);
if (ct != null) {
contentType = new ContentType(ct[0]);
}
} else {
contentType = new ContentType(ctype.get(0));
}
} catch (ParseException e) {
throw new WebServiceException(e);
}
return contentType;
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class SOAP12ClientHandler method getContentType.
protected ContentType getContentType(MessageContext msgContext) {
ContentType contentType = null;
try {
// Metro does not process this header into the message
@SuppressWarnings("unchecked") Map<String, List<String>> headers = (Map<String, List<String>>) msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
List<String> ctype = (headers == null) ? null : headers.get("Content-Type");
if (ctype == null) {
// Cxf stores it in lower case
ctype = (headers == null) ? null : headers.get("content-type");
}
log.info("ctype=" + ctype);
if (ctype == null) {
// Native has already processed this header into the message
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
String[] ct = mimeHeaders.getHeader("Content-Type");
log.info("ct=" + ct);
if (ct != null) {
contentType = new ContentType(ct[0]);
}
} else {
contentType = new ContentType(ctype.get(0));
}
} catch (ParseException e) {
throw new WebServiceException(e);
}
return contentType;
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class SOAP12ServerHandler method getContentType.
protected ContentType getContentType(SOAPMessageContext msgContext) {
ContentType contentType = null;
try {
// Metro does not process this header into the message
@SuppressWarnings("unchecked") Map<String, List<String>> headers = (Map<String, List<String>>) msgContext.get(MessageContext.HTTP_REQUEST_HEADERS);
List<String> ctype = (headers == null) ? null : headers.get("Content-Type");
if (ctype == null) {
// Cxf stores it in lower case
ctype = (headers == null) ? null : headers.get("content-type");
}
log.info("ctype=" + ctype);
if (ctype == null) {
// Native has already processed this header into the message
SOAPMessage soapMessage = ((SOAPMessageContext) msgContext).getMessage();
MimeHeaders mimeHeaders = soapMessage.getMimeHeaders();
String[] ct = mimeHeaders.getHeader("Content-Type");
log.info("ct=" + ct);
if (ct != null) {
contentType = new ContentType(ct[0]);
}
} else {
contentType = new ContentType(ctype.get(0));
}
} catch (ParseException e) {
throw new WebServiceException(e);
}
return contentType;
}
use of javax.xml.ws.handler.soap.SOAPMessageContext in project jbossws-cxf by jbossws.
the class SOAP12ServerHandler method handleInbound.
@Override
public boolean handleInbound(SOAPMessageContext msgContext) {
log.info("handleInbound");
ContentType contentType = getContentType(msgContext);
if (contentType != null) {
log.info("contentType=" + contentType);
String startInfo = contentType.getParameter("start-info");
if (!startInfo.equals(SOAPConstants.SOAP_1_2_CONTENT_TYPE)) {
return false;
}
} else {
return false;
}
try {
SOAPEnvelope soapEnvelope = ((SOAPMessageContext) msgContext).getMessage().getSOAPPart().getEnvelope();
String nsURI = soapEnvelope.getNamespaceURI();
log.info("nsURI=" + nsURI);
if (!SOAPConstants.URI_NS_SOAP_1_2_ENVELOPE.equals(nsURI)) {
return false;
}
} catch (SOAPException se) {
throw new WebServiceException(se);
}
return true;
}
Aggregations