本文整理汇总了Java中com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl类的典型用法代码示例。如果您正苦于以下问题:Java SOAPExceptionImpl类的具体用法?Java SOAPExceptionImpl怎么用?Java SOAPExceptionImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SOAPExceptionImpl类属于com.sun.xml.internal.messaging.saaj包,在下文中一共展示了SOAPExceptionImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: appendFaultSubcode
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
@Override
public void appendFaultSubcode(QName subcode) throws SOAPException {
if (subcode == null) {
return;
}
if (subcode.getNamespaceURI() == null ||
"".equals(subcode.getNamespaceURI())) {
log.severe("SAAJ0432.ver1_2.subcode.not.ns.qualified");
throw new SOAPExceptionImpl("A Subcode must be namespace-qualified");
}
if (innermostSubCodeElement == null) {
if (faultCodeElement == null)
findFaultCodeElement();
innermostSubCodeElement = faultCodeElement;
}
String prefix = null;
if (subcode.getPrefix() == null || "".equals(subcode.getPrefix())) {
prefix =
((ElementImpl) innermostSubCodeElement).getNamespacePrefix(
subcode.getNamespaceURI());
} else
prefix = subcode.getPrefix();
if (prefix == null || "".equals(prefix)) {
prefix = "ns1";
}
innermostSubCodeElement =
innermostSubCodeElement.addChildElement(subcodeName);
SOAPElement subcodeValueElement =
innermostSubCodeElement.addChildElement(valueName);
((ElementImpl) subcodeValueElement).ensureNamespaceIsDeclared(
prefix,
subcode.getNamespaceURI());
subcodeValueElement.addTextNode(prefix + ":" + subcode.getLocalPart());
}
示例2: lookForEnvelope
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
protected void lookForEnvelope() throws SOAPException {
Element envelopeChildElement = document.doGetDocumentElement();
if (envelopeChildElement == null || envelopeChildElement instanceof Envelope) {
envelope = (EnvelopeImpl) envelopeChildElement;
} else if (!(envelopeChildElement instanceof ElementImpl)) {
log.severe("SAAJ0512.soap.incorrect.factory.used");
throw new SOAPExceptionImpl("Unable to create envelope: incorrect factory used during tree construction");
} else {
ElementImpl soapElement = (ElementImpl) envelopeChildElement;
if (soapElement.getLocalName().equalsIgnoreCase("Envelope")) {
String prefix = soapElement.getPrefix();
String uri = (prefix == null) ? soapElement.getNamespaceURI() : soapElement.getNamespaceURI(prefix);
if(!uri.equals(NameImpl.SOAP11_NAMESPACE) && !uri.equals(NameImpl.SOAP12_NAMESPACE)) {
log.severe("SAAJ0513.soap.unknown.ns");
throw new SOAPVersionMismatchException("Unable to create envelope from given source because the namespace was not recognized");
}
} else {
log.severe("SAAJ0514.soap.root.elem.not.named.envelope");
throw new SOAPExceptionImpl(
"Unable to create envelope from given source because the root element is not named \"Envelope\"");
}
}
}
示例3: getContent
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public Object getContent() throws SOAPException {
try {
if (mimePart != null) {
//return an inputstream
return mimePart.read();
}
if (dataHandler != null) {
return getDataHandler().getContent();
} else if (rawContent != null) {
return rawContent.getContent();
} else {
log.severe("SAAJ0572.soap.no.content.for.attachment");
throw new SOAPExceptionImpl("No data handler/content associated with this attachment");
}
} catch (Exception ex) {
log.log(Level.SEVERE, "SAAJ0575.soap.attachment.getcontent.exception", ex);
throw new SOAPExceptionImpl(ex.getLocalizedMessage());
}
}
示例4: getMimePart
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
MimeBodyPart getMimePart() throws SOAPException {
try {
if (this.mimePart != null) {
return new MimeBodyPart(mimePart);
}
if (rawContent != null) {
copyMimeHeaders(headers, rawContent);
return rawContent;
}
MimeBodyPart envelope = new MimeBodyPart();
envelope.setDataHandler(dataHandler);
copyMimeHeaders(headers, envelope);
return envelope;
} catch (Exception ex) {
log.severe("SAAJ0504.soap.cannot.externalize.attachment");
throw new SOAPExceptionImpl("Unable to externalize attachment", ex);
}
}
示例5: copyMimeHeaders
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public static void copyMimeHeaders(MimeBodyPart mbp, AttachmentPartImpl ap)
throws SOAPException {
try {
List hdr = mbp.getAllHeaders();
int sz = hdr.size();
for( int i=0; i<sz; i++ ) {
Header h = (Header)hdr.get(i);
if(h.getName().equalsIgnoreCase("Content-Type"))
continue; // skip
ap.addMimeHeader(h.getName(), h.getValue());
}
} catch (Exception ex) {
log.severe("SAAJ0506.soap.cannot.copy.mime.hdrs.into.attachment");
throw new SOAPExceptionImpl(
"Unable to copy MIME headers into attachment",
ex);
}
}
示例6: createName
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
@Override
public Name createName(String localName, String prefix, String uri)
throws SOAPException {
// validating parameters before passing them on
// to make sure that the namespace specification rules are followed
// reserved xmlns prefix cannot be used.
if ("xmlns".equals(prefix)) {
log.severe("SAAJ0123.impl.no.reserved.xmlns");
throw new SOAPExceptionImpl("Cannot declare reserved xmlns prefix");
}
// Qualified name cannot be xmlns.
if ((prefix == null) && ("xmlns".equals(localName))) {
log.severe("SAAJ0124.impl.qualified.name.cannot.be.xmlns");
throw new SOAPExceptionImpl("Qualified name cannot be xmlns");
}
return NameImpl.create(localName, prefix, uri);
}
示例7: setRawContentBytes
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public void setRawContentBytes(
byte[] content, int off, int len, String contentType)
throws SOAPException {
if (mimePart != null) {
mimePart.close();
mimePart = null;
}
if (content == null) {
throw new SOAPExceptionImpl("Null content passed to setRawContentBytes");
}
dataHandler = null;
try {
InternetHeaders hdrs = new InternetHeaders();
hdrs.setHeader("Content-Type", contentType);
rawContent = new MimeBodyPart(hdrs, content, off, len);
setMimeHeader("Content-Type", contentType);
} catch (Exception e) {
log.log(Level.SEVERE,
"SAAJ0576.soap.attachment.setrawcontent.exception", e);
throw new SOAPExceptionImpl(e.getLocalizedMessage());
}
}
示例8: getFaultReasonLocales
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
@Override
public Iterator<Locale> getFaultReasonLocales() throws SOAPException {
// Fault Reason has similar semantics as faultstring
if (this.faultStringElement == null)
findReasonElement();
Iterator eachTextElement =
this.faultStringElement.getChildElements(textName);
List<Locale> localeSet = new ArrayList<>();
while (eachTextElement.hasNext()) {
SOAPElement textElement = (SOAPElement) eachTextElement.next();
Locale thisLocale = getLocale(textElement);
if (thisLocale == null) {
log.severe("SAAJ0431.ver1_2.xml.lang.missing");
throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
}
localeSet.add(thisLocale);
}
if (localeSet.isEmpty()) {
log.severe("SAAJ0434.ver1_2.text.element.not.present");
throw new SOAPExceptionImpl("env:Text elements with mandatory xml:lang attributes must be present inside env:Reason");
}
return localeSet.iterator();
}
示例9: parseContentType
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
private static ContentType parseContentType(MimeHeaders headers) throws SOAPExceptionImpl {
final String ct;
if (headers != null)
ct = getContentType(headers);
else {
log.severe("SAAJ0550.soap.null.headers");
throw new SOAPExceptionImpl("Cannot create message: " +
"Headers can't be null");
}
if (ct == null) {
log.severe("SAAJ0532.soap.no.Content-Type");
throw new SOAPExceptionImpl("Absent Content-Type");
}
try {
return new ContentType(ct);
} catch (Throwable ex) {
log.severe("SAAJ0535.soap.cannot.internalize.message");
throw new SOAPExceptionImpl("Unable to internalize message", ex);
}
}
示例10: createName
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public Name createName(String localName, String prefix, String uri)
throws SOAPException {
// validating parameters before passing them on
// to make sure that the namespace specification rules are followed
// reserved xmlns prefix cannot be used.
if ("xmlns".equals(prefix)) {
log.severe("SAAJ0123.impl.no.reserved.xmlns");
throw new SOAPExceptionImpl("Cannot declare reserved xmlns prefix");
}
// Qualified name cannot be xmlns.
if ((prefix == null) && ("xmlns".equals(localName))) {
log.severe("SAAJ0124.impl.qualified.name.cannot.be.xmlns");
throw new SOAPExceptionImpl("Qualified name cannot be xmlns");
}
return NameImpl.create(localName, prefix, uri);
}
示例11: addHeaderElement
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public SOAPHeaderElement addHeaderElement(Name name) throws SOAPException {
SOAPElement newHeaderElement =
ElementFactory.createNamedElement(
((SOAPDocument) getOwnerDocument()).getDocument(),
name.getLocalName(),
name.getPrefix(),
name.getURI());
if (newHeaderElement == null
|| !(newHeaderElement instanceof SOAPHeaderElement)) {
newHeaderElement = createHeaderElement(name);
}
// header elements must be namespace qualified
// check that URI is not empty, ensuring that the element is NS qualified.
String uri = newHeaderElement.getElementQName().getNamespaceURI();
if ((uri == null) || ("").equals(uri)) {
log.severe("SAAJ0131.impl.header.elems.ns.qualified");
throw new SOAPExceptionImpl("HeaderElements must be namespace qualified");
}
addNode(newHeaderElement);
return (SOAPHeaderElement) newHeaderElement;
}
示例12: getFaultReasonTexts
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
@Override
public Iterator<String> getFaultReasonTexts() throws SOAPException {
// Fault Reason has similar semantics as faultstring
if (this.faultStringElement == null)
findReasonElement();
Iterator eachTextElement =
this.faultStringElement.getChildElements(textName);
List<String> texts = new ArrayList<>();
while (eachTextElement.hasNext()) {
SOAPElement textElement = (SOAPElement) eachTextElement.next();
Locale thisLocale = getLocale(textElement);
if (thisLocale == null) {
log.severe("SAAJ0431.ver1_2.xml.lang.missing");
throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
}
texts.add(textElement.getValue());
}
if (texts.isEmpty()) {
log.severe("SAAJ0434.ver1_2.text.element.not.present");
throw new SOAPExceptionImpl("env:Text must be present inside env:Reason");
}
return texts.iterator();
}
示例13: addHeaderElement
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
@Override
public SOAPHeaderElement addHeaderElement(QName name) throws SOAPException {
SOAPElement newHeaderElement =
ElementFactory.createNamedElement(
((SOAPDocument) getOwnerDocument()).getDocument(),
name.getLocalPart(),
name.getPrefix(),
name.getNamespaceURI());
if (newHeaderElement == null
|| !(newHeaderElement instanceof SOAPHeaderElement)) {
newHeaderElement = createHeaderElement(name);
}
// header elements must be namespace qualified
// check that URI is not empty, ensuring that the element is NS qualified.
String uri = newHeaderElement.getElementQName().getNamespaceURI();
if ((uri == null) || ("").equals(uri)) {
log.severe("SAAJ0131.impl.header.elems.ns.qualified");
throw new SOAPExceptionImpl("HeaderElements must be namespace qualified");
}
addNode(newHeaderElement);
return (SOAPHeaderElement) newHeaderElement;
}
示例14: getFaultReasonTexts
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public Iterator getFaultReasonTexts() throws SOAPException {
// Fault Reason has similar semantics as faultstring
if (this.faultStringElement == null)
findReasonElement();
Iterator eachTextElement =
this.faultStringElement.getChildElements(textName);
List texts = new ArrayList();
while (eachTextElement.hasNext()) {
SOAPElement textElement = (SOAPElement) eachTextElement.next();
Locale thisLocale = getLocale(textElement);
if (thisLocale == null) {
log.severe("SAAJ0431.ver1_2.xml.lang.missing");
throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
}
texts.add(textElement.getValue());
}
if (texts.isEmpty()) {
log.severe("SAAJ0434.ver1_2.text.element.not.present");
throw new SOAPExceptionImpl("env:Text must be present inside env:Reason");
}
return texts.iterator();
}
示例15: getFaultReasonLocales
import com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl; //导入依赖的package包/类
public Iterator getFaultReasonLocales() throws SOAPException {
// Fault Reason has similar semantics as faultstring
if (this.faultStringElement == null)
findReasonElement();
Iterator eachTextElement =
this.faultStringElement.getChildElements(textName);
List localeSet = new ArrayList();
while (eachTextElement.hasNext()) {
SOAPElement textElement = (SOAPElement) eachTextElement.next();
Locale thisLocale = getLocale(textElement);
if (thisLocale == null) {
log.severe("SAAJ0431.ver1_2.xml.lang.missing");
throw new SOAPExceptionImpl("\"xml:lang\" attribute is not present on the Text element");
}
localeSet.add(thisLocale);
}
if (localeSet.isEmpty()) {
log.severe("SAAJ0434.ver1_2.text.element.not.present");
throw new SOAPExceptionImpl("env:Text elements with mandatory xml:lang attributes must be present inside env:Reason");
}
return localeSet.iterator();
}