1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.impl.wsdl.support.soap;
14
15 import java.io.IOException;
16 import java.util.List;
17
18 import javax.xml.namespace.QName;
19
20 import org.apache.xmlbeans.SchemaType;
21 import org.apache.xmlbeans.XmlError;
22 import org.apache.xmlbeans.XmlException;
23 import org.apache.xmlbeans.XmlObject;
24 import org.apache.xmlbeans.XmlValidationError;
25
26 /***
27 * Public behaviour for a SOAP Version
28 *
29 * @author ole.matzura
30 */
31
32 public interface SoapVersion
33 {
34 public static final SoapVersion11 Soap11 = SoapVersion11.instance;
35 public static final SoapVersion12 Soap12 = SoapVersion12.instance;
36
37 public QName getEnvelopeQName();
38
39 public QName getBodyQName();
40
41 public QName getHeaderQName();
42
43 public void validateSoapEnvelope(String soapMessage, List<XmlError> errors);
44
45 public String getContentTypeHttpHeader( String encoding );
46
47 public String getEnvelopeNamespace();
48
49 public String getEncodingNamespace();
50
51 public XmlObject getSoapEncodingSchema() throws XmlException, IOException;
52
53 public XmlObject getSoapEnvelopeSchema() throws XmlException, IOException;
54
55 /***
56 * Checks if the specified validation error should be ignored for a message with
57 * this SOAP version. (The SOAP-spec may allow some constructions not allowed by
58 * the corresponding XML-Schema)
59 */
60
61 public boolean shouldIgnore( XmlValidationError xmlError );
62
63 public String getContentType();
64
65 public SchemaType getEnvelopeType();
66
67 public SchemaType getFaultType();
68
69 public String getName();
70
71 /***
72 * Utilities
73 *
74 * @author ole.matzura
75 */
76
77 public static class Utils
78 {
79 public static SoapVersion getSoapVersionForContentType( String contentType )
80 {
81 SoapVersion soapVersion = contentType.startsWith( SoapVersion.Soap11.getContentType() ) ? SoapVersion.Soap11 : null;
82 soapVersion = soapVersion == null && contentType.startsWith( SoapVersion.Soap12.getContentType() ) ? SoapVersion.Soap12 : soapVersion;
83
84 return soapVersion;
85 }
86 }
87 }