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 {
String baseType = contentType.getBaseType().toLowerCase();
String soapContentType;
if (baseType.equals(MTOMConstants.MTOM_TYPE)) {
isMTOM = true;
String typeParam = contentType.getParameter("type");
if (typeParam == null) {
throw new SOAPException("Missing 'type' parameter in XOP content type");
} else {
soapContentType = typeParam.toLowerCase();
}
} else {
isMTOM = false;
soapContentType = baseType;
}
if (soapContentType.equals(HTTPConstants.MEDIA_TYPE_TEXT_XML)) {
soapEnvelopeNamespaceURI = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
soapFactory = metaFactory.getSOAP11Factory();
} else if (soapContentType.equals(HTTPConstants.MEDIA_TYPE_APPLICATION_SOAP_XML)) {
soapEnvelopeNamespaceURI = SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI;
soapFactory = metaFactory.getSOAP12Factory();
} else {
throw new SOAPException("Unrecognized content type '" + soapContentType + "'");
}
charset = contentType.getParameter("charset");