use of javax.xml.soap.SOAPEnvelope in project arctic-sea by 52North.
the class Soap11Encoder method addSchemaLocationForExceptionToSOAPMessage.
private void addSchemaLocationForExceptionToSOAPMessage(SOAPMessage soapResponseMessage) throws SOAPException {
SOAPEnvelope envelope = soapResponseMessage.getSOAPPart().getEnvelope();
envelope.addNamespaceDeclaration(W3CConstants.NS_XSI_PREFIX, W3CConstants.NS_XSI);
StringBuilder schemaLocation = new StringBuilder();
schemaLocation.append(envelope.getNamespaceURI());
schemaLocation.append(" ");
schemaLocation.append(envelope.getNamespaceURI());
schemaLocation.append(" ");
schemaLocation.append(N52XmlHelper.getSchemaLocationForOWS110Exception());
envelope.addAttribute(N52XmlHelper.getSchemaLocationQNameWithPrefix(), schemaLocation.toString());
}
use of javax.xml.soap.SOAPEnvelope in project jbossws-cxf by jbossws.
the class JBossWSClientAuthConfig method getAuthContextID.
@SuppressWarnings("rawtypes")
public String getAuthContextID(MessageInfo messageInfo) {
SOAPMessage request = (SOAPMessage) messageInfo.getRequestMessage();
if (request == null) {
return null;
}
String authContext = null;
MimeHeaders headers = request.getMimeHeaders();
if (headers != null) {
String[] soapActions = headers.getHeader("SOAPAction");
if (soapActions != null && soapActions.length > 0) {
authContext = soapActions[0];
if (!StringUtils.isEmpty(authContext)) {
return authContext;
}
}
}
SOAPPart soapMessage = request.getSOAPPart();
if (soapMessage != null) {
try {
SOAPEnvelope envelope = soapMessage.getEnvelope();
if (envelope != null) {
SOAPBody body = envelope.getBody();
if (body != null) {
Iterator it = body.getChildElements();
while (it.hasNext()) {
Object o = it.next();
if (o instanceof SOAPElement) {
QName name = ((SOAPElement) o).getElementQName();
return name.getLocalPart();
}
}
}
}
} catch (SOAPException se) {
// ignore;
Logger.getLogger(JBossWSClientAuthConfig.class).trace(se);
}
}
return null;
}
use of javax.xml.soap.SOAPEnvelope in project jbossws-cxf by jbossws.
the class JBossWSServerAuthConfig method getAuthContextID.
@SuppressWarnings("rawtypes")
public String getAuthContextID(MessageInfo messageInfo) {
SOAPMessage request = (SOAPMessage) messageInfo.getRequestMessage();
if (request == null) {
return null;
}
String authContext = null;
MimeHeaders headers = request.getMimeHeaders();
if (headers != null) {
String[] soapActions = headers.getHeader("SOAPAction");
if (soapActions != null && soapActions.length > 0) {
authContext = soapActions[0];
if (!StringUtils.isEmpty(authContext)) {
return authContext;
}
}
}
SOAPPart soapMessage = request.getSOAPPart();
if (soapMessage != null) {
try {
SOAPEnvelope envelope = soapMessage.getEnvelope();
if (envelope != null) {
SOAPBody body = envelope.getBody();
if (body != null) {
Iterator it = body.getChildElements();
while (it.hasNext()) {
Object o = it.next();
if (o instanceof SOAPElement) {
QName name = ((SOAPElement) o).getElementQName();
return name.getLocalPart();
}
}
}
}
} catch (SOAPException se) {
// ignore;
Logger.getLogger(JBossWSServerAuthConfig.class).trace(se);
}
}
return null;
}
use of javax.xml.soap.SOAPEnvelope in project jbossws-cxf by jbossws.
the class TestHandler method checkEnvelope.
private void checkEnvelope(SOAPMessage soapMessage) throws SOAPException {
SOAPPart part = soapMessage.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
String namespace = envelope.getNamespaceURI();
if (envelopeNamespace.equals(namespace) == false) {
throw new RuntimeException("Expected '" + envelopeNamespace + "' namespace, actual '" + namespace + "'");
}
}
use of javax.xml.soap.SOAPEnvelope in project jbossws-cxf by jbossws.
the class MTOMProtocolHandler method verifyXOPPackage.
private boolean verifyXOPPackage(MessageContext context) {
try {
SOAPMessageContext msgContext = (SOAPMessageContext) context;
SOAPMessage soapMsg = msgContext.getMessage();
SOAPEnvelope soapEnv = soapMsg.getSOAPPart().getEnvelope();
SOAPBody body = soapEnv.getBody();
boolean found = scanNodes(body.getChildNodes());
if (found)
throw new IllegalStateException("XOP request not properly inlined");
} catch (SOAPException ex) {
throw new WebServiceException(ex);
}
return true;
}
Aggregations