01: /*
02: * soapUI, copyright (C) 2004-2007 eviware.com
03: *
04: * soapUI is free software; you can redistribute it and/or modify it under the
05: * terms of version 2.1 of the GNU Lesser General Public License as published by
06: * the Free Software Foundation.
07: *
08: * soapUI is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
09: * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10: * See the GNU Lesser General Public License for more details at gnu.org.
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: public static final SoapVersion11 Soap11 = SoapVersion11.instance;
34: public static final SoapVersion12 Soap12 = SoapVersion12.instance;
35:
36: public QName getEnvelopeQName();
37:
38: public QName getBodyQName();
39:
40: public QName getHeaderQName();
41:
42: public void validateSoapEnvelope(String soapMessage,
43: 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,
52: IOException;
53:
54: public XmlObject getSoapEnvelopeSchema() throws XmlException,
55: IOException;
56:
57: /**
58: * Checks if the specified validation error should be ignored for a message with
59: * this SOAP version. (The SOAP-spec may allow some constructions not allowed by
60: * the corresponding XML-Schema)
61: */
62:
63: public boolean shouldIgnore(XmlValidationError xmlError);
64:
65: public String getContentType();
66:
67: public SchemaType getEnvelopeType();
68:
69: public SchemaType getFaultType();
70:
71: public String getName();
72:
73: /**
74: * Utilities
75: *
76: * @author ole.matzura
77: */
78:
79: public static class Utils {
80: public static SoapVersion getSoapVersionForContentType(
81: String contentType) {
82: SoapVersion soapVersion = contentType
83: .startsWith(SoapVersion.Soap11.getContentType()) ? SoapVersion.Soap11
84: : null;
85: soapVersion = soapVersion == null
86: && contentType.startsWith(SoapVersion.Soap12
87: .getContentType()) ? SoapVersion.Soap12
88: : soapVersion;
89:
90: return soapVersion;
91: }
92: }
93: }
|