soapMessage = parentSoapMsg;
String charset;
boolean isMTOM;
String soapEnvelopeNamespaceURI;
OMMetaFactory metaFactory = OMAbstractFactory.getMetaFactory(OMAbstractFactory.FEATURE_DOM);
SOAPFactory soapFactory;
if (contentType == null) {
charset = null;
isMTOM = false;
soapFactory = metaFactory.getSOAP11Factory();
soapEnvelopeNamespaceURI = null;
} else {
MediaType baseType = contentType.getMediaType();
MediaType soapContentType;
if (baseType.equals(MediaType.APPLICATION_XOP_XML)) {
isMTOM = true;
String typeParam = contentType.getParameter("type");
if (typeParam == null) {
throw new SOAPException("Missing 'type' parameter in XOP content type");
} else {
try {
soapContentType = new ContentType(typeParam).getMediaType();
} catch (ParseException ex) {
throw new SOAPException("Failed to parse the 'type' parameter", ex);
}
}
} else {
isMTOM = false;
soapContentType = baseType;
}
if (soapContentType.equals(MediaType.TEXT_XML)) {
soapEnvelopeNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
soapFactory = metaFactory.getSOAP11Factory();
} else if (soapContentType.equals(MediaType.APPLICATION_SOAP_XML)) {
soapEnvelopeNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
soapFactory = metaFactory.getSOAP12Factory();
} else {
throw new SOAPException("Unrecognized content type '" + soapContentType + "'");
}
charset = contentType.getParameter("charset");