-
Notifications
You must be signed in to change notification settings - Fork 15
/
SOAPPart1_1Impl.java
82 lines (66 loc) · 2.54 KB
/
SOAPPart1_1Impl.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/*
* Copyright (c) 1997, 2022 Oracle and/or its affiliates. All rights reserved.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Distribution License v. 1.0, which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
package com.sun.xml.messaging.saaj.soap.ver1_1;
import java.util.logging.Logger;
import jakarta.xml.soap.SOAPConstants;
import jakarta.xml.soap.SOAPException;
import javax.xml.transform.Source;
import com.sun.xml.messaging.saaj.soap.*;
import com.sun.xml.messaging.saaj.soap.impl.EnvelopeImpl;
import com.sun.xml.messaging.saaj.util.LogDomainConstants;
import com.sun.xml.messaging.saaj.util.XMLDeclarationParser;
public class SOAPPart1_1Impl extends SOAPPartImpl implements SOAPConstants {
private static final Logger log =
Logger.getLogger(LogDomainConstants.SOAP_VER1_1_DOMAIN,
"com.sun.xml.messaging.saaj.soap.ver1_1.LocalStrings");
public SOAPPart1_1Impl() {
super();
}
public SOAPPart1_1Impl(MessageImpl message) {
super(message);
}
@Override
protected String getContentType() {
return isFastInfoset() ? "application/fastinfoset" : "text/xml";
}
@Override
protected Envelope createEnvelopeFromSource() throws SOAPException {
// Record the presence of xml declaration before the envelope gets
// created.
XMLDeclarationParser parser = lookForXmlDecl();
Source tmp = source;
source = null;
EnvelopeImpl envelope =
(EnvelopeImpl) EnvelopeFactory.createEnvelope(tmp, this);
if (!envelope.getNamespaceURI().equals(SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE)) {
log.severe("SAAJ0304.ver1_1.msg.invalid.SOAP1.1");
throw new SOAPException("InputStream does not represent a valid SOAP 1.1 Message");
}
if (parser != null && !omitXmlDecl) {
envelope.setOmitXmlDecl("no");
envelope.setXmlDecl(parser.getXmlDeclaration());
envelope.setCharsetEncoding(parser.getEncoding());
}
return envelope;
}
@Override
protected Envelope createEmptyEnvelope(String prefix)
throws SOAPException {
return new Envelope1_1Impl(getDocument(), prefix, true, true);
}
@Override
protected SOAPPartImpl duplicateType() {
return new SOAPPart1_1Impl();
}
@Override
public String getSOAPNamespace() {
return SOAPConstants.URI_NS_SOAP_1_1_ENVELOPE;
}
}