File Coverage

blib/lib/SOAP/Constants.pm
Criterion Covered Total %
statement 54 54 100.0
branch n/a
condition n/a
subroutine 18 18 100.0
pod n/a
total 72 72 100.0


line stmt bran cond sub pod time code
1             # ======================================================================
2             #
3             # Copyright (C) 2000-2004 Paul Kulchenko (paulclinger@yahoo.com)
4             #
5             # SOAP::Lite is free software; you can redistribute it
6             # and/or modify it under the same terms as Perl itself.
7             #
8             # ======================================================================
9             package SOAP::Constants;
10 25     25   115 use strict;
  25         39  
  25         972  
11 25     25   131 use SOAP::Lite;
  25         36  
  25         1149  
12              
13             our $VERSION = 1.12;
14              
15 25     25   159 use constant URI_1999_SCHEMA_XSD => "http://www.w3.org/1999/XMLSchema";
  25         63  
  25         1922  
16 25     25   128 use constant URI_1999_SCHEMA_XSI => "http://www.w3.org/1999/XMLSchema-instance";
  25         31  
  25         1219  
17 25     25   116 use constant URI_2000_SCHEMA_XSD => "http://www.w3.org/2000/10/XMLSchema";
  25         32  
  25         1322  
18 25     25   117 use constant URI_2000_SCHEMA_XSI => "http://www.w3.org/2000/10/XMLSchema-instance";
  25         38  
  25         1576  
19 25     25   114 use constant URI_2001_SCHEMA_XSD => "http://www.w3.org/2001/XMLSchema";
  25         39  
  25         1071  
20 25     25   112 use constant URI_2001_SCHEMA_XSI => "http://www.w3.org/2001/XMLSchema-instance";
  25         59  
  25         1015  
21 25     25   111 use constant URI_LITERAL_ENC => "";
  25         34  
  25         1134  
22 25     25   127 use constant URI_SOAP11_ENC => "http://schemas.xmlsoap.org/soap/encoding/";
  25         34  
  25         1246  
23 25     25   113 use constant URI_SOAP11_ENV => "http://schemas.xmlsoap.org/soap/envelope/";
  25         41  
  25         1133  
24 25     25   128 use constant URI_SOAP11_NEXT_ACTOR => "http://schemas.xmlsoap.org/soap/actor/next";
  25         76  
  25         1093  
25 25     25   111 use constant URI_SOAP12_ENC => "http://www.w3.org/2003/05/soap-encoding";
  25         32  
  25         1098  
26 25     25   112 use constant URI_SOAP12_ENV => "http://www.w3.org/2003/05/soap-envelope";
  25         31  
  25         1524  
27 25     25   143 use constant URI_SOAP12_NOENC => "http://www.w3.org/2003/05/soap-envelope/encoding/none";
  25         40  
  25         1243  
28 25     25   134 use constant URI_SOAP12_NEXT_ACTOR => "http://www.w3.org/2003/05/soap-envelope/role/next";
  25         36  
  25         1371  
29              
30 25     25   138 use vars qw($NSMASK $ELMASK);
  25         42  
  25         2101  
31              
32             $NSMASK = '[a-zA-Z_:][\w.\-:]*';
33             $ELMASK = '^(?![xX][mM][lL])[a-zA-Z_][\w.\-]*$';
34              
35 25         16664 use vars qw($NEXT_ACTOR $NS_ENV $NS_ENC $NS_APS
36             $FAULT_CLIENT $FAULT_SERVER $FAULT_VERSION_MISMATCH
37             $HTTP_ON_FAULT_CODE $HTTP_ON_SUCCESS_CODE $FAULT_MUST_UNDERSTAND
38             $NS_XSI_ALL $NS_XSI_NILS %XML_SCHEMAS $DEFAULT_XML_SCHEMA
39             $DEFAULT_HTTP_CONTENT_TYPE
40             $SOAP_VERSION %SOAP_VERSIONS $WRONG_VERSION
41             $NS_SL_HEADER $NS_SL_PERLTYPE $PREFIX_ENV $PREFIX_ENC
42             $DO_NOT_USE_XML_PARSER $DO_NOT_CHECK_MUSTUNDERSTAND
43             $DO_NOT_USE_CHARSET $DO_NOT_PROCESS_XML_IN_MIME
44             $DO_NOT_USE_LWP_LENGTH_HACK $DO_NOT_CHECK_CONTENT_TYPE
45             $MAX_CONTENT_SIZE $PATCH_HTTP_KEEPALIVE $DEFAULT_PACKAGER
46             @SUPPORTED_ENCODING_STYLES $OBJS_BY_REF_KEEPALIVE
47             $DEFAULT_CACHE_TTL
48             %XML_SCHEMA_OF
49             $HAS_ENCODE
50 25     25   112 );
  25         36  
51              
52             $FAULT_CLIENT = 'Client';
53             $FAULT_SERVER = 'Server';
54             $FAULT_VERSION_MISMATCH = 'VersionMismatch';
55             $FAULT_MUST_UNDERSTAND = 'MustUnderstand';
56              
57             $HTTP_ON_SUCCESS_CODE = 200; # OK
58             $HTTP_ON_FAULT_CODE = 500; # INTERNAL_SERVER_ERROR
59              
60             @SUPPORTED_ENCODING_STYLES = ( URI_LITERAL_ENC,URI_SOAP11_ENC,URI_SOAP12_ENC,URI_SOAP12_NOENC );
61              
62             $WRONG_VERSION = 'Wrong SOAP version specified.';
63              
64             $SOAP_VERSION = '1.1';
65             %SOAP_VERSIONS = (
66             1.1 => {
67             NEXT_ACTOR => URI_SOAP11_NEXT_ACTOR,
68             NS_ENV => URI_SOAP11_ENV,
69             NS_ENC => URI_SOAP11_ENC,
70             DEFAULT_XML_SCHEMA => URI_2001_SCHEMA_XSD,
71             DEFAULT_HTTP_CONTENT_TYPE => 'text/xml',
72             },
73             1.2 => {
74             NEXT_ACTOR => URI_SOAP12_NEXT_ACTOR,
75             NS_ENV => URI_SOAP12_ENV,
76             NS_ENC => URI_SOAP12_ENC,
77             DEFAULT_XML_SCHEMA => URI_2001_SCHEMA_XSD,
78             DEFAULT_HTTP_CONTENT_TYPE => 'application/soap+xml',
79             },
80             );
81              
82             # schema namespaces
83             %XML_SCHEMAS = ( # The '()' is necessary to put constants in SCALAR form
84             URI_1999_SCHEMA_XSD() => 'SOAP::XMLSchema1999',
85             URI_2001_SCHEMA_XSD() => 'SOAP::XMLSchema2001',
86             URI_SOAP11_ENC() => 'SOAP::XMLSchemaSOAP1_1',
87             URI_SOAP12_ENC() => 'SOAP::XMLSchemaSOAP1_2',
88             );
89              
90             # schema namespaces
91             %XML_SCHEMA_OF = ( # The '()' is necessary to put constants in SCALAR form
92             URI_1999_SCHEMA_XSD() => 'XMLSchema1999',
93             URI_2001_SCHEMA_XSD() => 'XMLSchema2001',
94             URI_SOAP11_ENC() => 'XMLSchemaSOAP1_1',
95             URI_SOAP12_ENC() => 'XMLSchemaSOAP1_2',
96             );
97              
98              
99             $NS_XSI_ALL = join join('|', map {"$_-instance"} grep {/XMLSchema/} keys %XML_SCHEMAS), '(?:', ')';
100             $NS_XSI_NILS = join join('|', map { my $class = $XML_SCHEMAS{$_} . '::Serializer'; "\{($_)-instance\}" . $class->nilValue
101             } grep {/XMLSchema/} keys %XML_SCHEMAS),
102             '(?:', ')';
103              
104             # ApacheSOAP namespaces
105             $NS_APS = 'http://xml.apache.org/xml-soap';
106              
107             # SOAP::Lite namespace
108             $NS_SL_HEADER = 'http://namespaces.soaplite.com/header';
109             $NS_SL_PERLTYPE = 'http://namespaces.soaplite.com/perl';
110              
111             # default prefixes
112             $PREFIX_ENV = 'soap';
113             $PREFIX_ENC = 'soapenc';
114              
115             # others
116             $DO_NOT_USE_XML_PARSER = 0;
117             $DO_NOT_CHECK_MUSTUNDERSTAND = 0;
118             $DO_NOT_USE_CHARSET = 0;
119             $DO_NOT_PROCESS_XML_IN_MIME = 0;
120             $DO_NOT_USE_LWP_LENGTH_HACK = 0;
121             $DO_NOT_CHECK_CONTENT_TYPE = 0;
122             $PATCH_HTTP_KEEPALIVE = 1;
123             $OBJS_BY_REF_KEEPALIVE = 600; # seconds
124              
125             # TODO - use default packager constant somewhere
126             $DEFAULT_PACKAGER = "SOAP::Packager::MIME";
127             $DEFAULT_CACHE_TTL = 0;
128              
129             $HAS_ENCODE = eval "require Encode; 1";
130              
131             1;
132              
133             __END__