00001 #ifndef _IT_BUS_CONFIG_HTTPCLIENT_H_
00002 #define _IT_BUS_CONFIG_HTTPCLIENT_H_
00003
00004 #include <it_dsa/vector.h>
00005 #include <it_bus/api_defines.h>
00006 #include <it_bus/qname.h>
00007 #include <it_bus/sequence_complex_type.h>
00008 #include <it_bus_config/http_wsdl_extension_element.h>
00009 #include <it_bus/complex_type_reader.h>
00010 #include <it_bus/complex_type_writer.h>
00011 #include <it_bus_pdk/context_attrs/http_conf_xsdTypes.h>
00012 #ifndef IT_MINIMISE_INCLUDES
00013 #include <it_bus/bus.h>
00014 #include <it_bus_pdk/messaging_transport.h>
00015 #endif
00016
00017 namespace IT_Bus
00018 {
00019 class BusContextRegistry;
00020 class ContextContainer;
00021 }
00022 namespace IT_WSDL
00023 {
00024 class WSDLPort;
00025 }
00026
00027 namespace IT_HTTP
00028 {
00029 class HTTPClient;
00030 class HTTPClientInputMessageAttributes;
00031 class HttpWSDLExtensionFactory;
00032
00037 class IT_BUS_API HTTPClientConfiguration :
00038 public IT_HTTP::HttpWSDLExtensionElement,
00039 public IT_Bus::SequenceComplexType
00040 {
00041
00042 public:
00043
00044 HTTPClientConfiguration(
00045 IT_Bus::BusContextRegistry* registry
00046 );
00047
00048 HTTPClientConfiguration(
00049 IT_HTTP::HttpWSDLExtensionFactory* factory,
00050 IT_WSDL::WSDLExtensibleNode* parent,
00051 IT_Bus::BusContextRegistry* registry
00052 );
00053
00054 virtual
00055 ~HTTPClientConfiguration();
00056
00060 void
00061 set_defaults();
00062
00063 bool
00064 parse(
00065 const IT_Bus::XMLIterator& element_iterator,
00066 const IT_Bus::XMLNode& element,
00067 IT_WSDL::WSDLErrorHandler& error_handler
00068 );
00069
00070 void
00071 initialize(
00072 IT_Bus::XMLHelper& configuration
00073 );
00074
00075 void
00076 initialize(
00077 const IT_Bus::XMLIterator& configuration
00078 );
00079
00085 void
00086 ReadCookieConfiguration(
00087 IT_Bus::XMLHelper& Configuration
00088 );
00089
00093 void
00094 ReadCookieConfiguration(
00095 const IT_Bus::XMLIterator& Configuration
00096 );
00097
00098 void
00099 SetConnectParameters(
00100 HTTPClient& HTTPClient,
00101 IT_Bus::ContextContainer * context_container = 0
00102 );
00103
00109 void
00110 setUseSecureSockets(
00111 const IT_Bool& bUseSecureSockets
00112 )
00113 {
00114 m_bUseSecureSockets = bUseSecureSockets;
00115 }
00116
00122 const IT_Bool&
00123 getUseSecureSockets() const
00124 {
00125 return m_bUseSecureSockets;
00126 }
00127
00133 IT_Bool&
00134 getUseSecureSockets()
00135 {
00136 return m_bUseSecureSockets;
00137 }
00138
00145 void
00146 setClientCertificate(
00147 const IT_Bus::String& strClientCertificate
00148 )
00149 {
00150 m_ClientCertificate = strClientCertificate;
00151 }
00152
00159 const IT_Bus::String&
00160 getClientCertificate() const
00161 {
00162 return m_ClientCertificate;
00163 }
00164
00171 IT_Bus::String&
00172 getClientCertificate()
00173 {
00174 return m_ClientCertificate;
00175 }
00176
00184 void
00185 setClientPrivateKey(
00186 const IT_Bus::String& strClientPrivateKey
00187 )
00188 {
00189 m_ClientPrivateKey = strClientPrivateKey;
00190 }
00191
00198 const IT_Bus::String&
00199 getClientPrivateKey() const
00200 {
00201 return m_ClientPrivateKey;
00202 }
00203
00210 IT_Bus::String&
00211 getClientPrivateKey()
00212 {
00213 return m_ClientPrivateKey;
00214 }
00215
00222 void
00223 setClientPrivateKeyPassword(
00224 const IT_Bus::String& strClientPrivateKeyPassword
00225 )
00226 {
00227 m_ClientPrivateKeyPassword = strClientPrivateKeyPassword;
00228 }
00229
00235 const IT_Bus::String&
00236 getClientPrivateKeyPassword() const
00237 {
00238 return m_ClientPrivateKeyPassword;
00239 }
00240
00246 IT_Bus::String&
00247 getClientPrivateKeyPassword()
00248 {
00249 return m_ClientPrivateKeyPassword;
00250 }
00251
00258 void
00259 setTrustedRootCertificates(
00260 const IT_Bus::String& strTrustedRootCertificates
00261 )
00262 {
00263 m_TrustedRootCertificates = strTrustedRootCertificates;
00264 }
00265
00271 const IT_Bus::String&
00272 getTrustedRootCertificates() const
00273 {
00274 return m_TrustedRootCertificates;
00275 }
00276
00282 IT_Bus::String&
00283 getTrustedRootCertificates()
00284 {
00285 return m_TrustedRootCertificates;
00286 }
00287
00295 void
00296 setClientCertificateChain(
00297 const IT_Bus::String& strClientCertificateChain
00298 )
00299 {
00300 m_ClientCertificateChain = strClientCertificateChain;
00301 }
00302
00309 const IT_Bus::String&
00310 getClientCertificateChain() const
00311 {
00312 return m_ClientCertificateChain;
00313 }
00314
00321 IT_Bus::String&
00322 getClientCertificateChain()
00323 {
00324 return m_ClientCertificateChain;
00325 }
00326
00333 void
00334 setPort(
00335 const IT_ULong& ulPort
00336 )
00337 {
00338 m_ulPort = ulPort;
00339 }
00340
00346 const IT_ULong&
00347 getPort() const
00348 {
00349 return m_ulPort;
00350 }
00351
00358 void
00359 set_connection_attempts(
00360 unsigned short connection_attempts
00361 )
00362 {
00363 m_connection_attempts = connection_attempts;
00364 }
00365
00371 unsigned short
00372 get_connection_attempts() const
00373 {
00374 return m_connection_attempts;
00375 }
00376
00383 void
00384 setSendTimeout(
00385 const IT_ULong& lSendTimeout
00386 )
00387 {
00388 m_lSendTimeout = lSendTimeout;
00389 }
00390
00396 const IT_ULong&
00397 getSendTimeout() const
00398 {
00399 return m_lSendTimeout;
00400 }
00401
00408 void
00409 setReceiveTimeout(
00410 const IT_ULong& lReceiveTimeout
00411 )
00412 {
00413 m_lReceiveTimeout = lReceiveTimeout;
00414 }
00415
00421 const IT_ULong&
00422 getReceiveTimeout() const
00423 {
00424 return m_lReceiveTimeout;
00425 }
00426
00433 void
00434 setMethod(
00435 const IT_Bus::String& strMethod
00436 )
00437 {
00438 m_Method = strMethod;
00439 }
00440
00446 const IT_Bus::String&
00447 getMethod() const
00448 {
00449 return m_Method;
00450 }
00451
00458 void
00459 setURL(
00460 const IT_Bus::String& strURL
00461 )
00462 {
00463 m_URL = strURL;
00464 if (!m_bUseSecureSockets)
00465 {
00466
00467 if (strncasecmp(m_URL.c_str(), "https://", strlen("https://")) == 0)
00468 {
00469 m_bUseSecureSockets = true;
00470 }
00471 }
00472
00473 if (m_bUseSecureSockets)
00474 {
00475 m_ulPort = 443;
00476 }
00477 else
00478 {
00479 m_ulPort = 80;
00480 }
00481 }
00482
00488 const IT_Bus::String&
00489 getURL() const
00490 {
00491 return m_URL;
00492 }
00493
00499 void
00500 setAuthorization(
00501 const IT_Bus::String& strAuthorization
00502 )
00503 {
00504 m_Authorization = strAuthorization;
00505 }
00506
00512 const IT_Bus::String&
00513 getAuthorization() const
00514 {
00515 return m_Authorization;
00516 }
00517
00523 void
00524 setAuthorizationType(
00525 const IT_Bus::String& strAuthorizationType
00526 )
00527 {
00528 m_AuthorizationType = strAuthorizationType;
00529 }
00530
00536 const IT_Bus::String&
00537 getAuthorizationType() const
00538 {
00539 return m_AuthorizationType;
00540 }
00541
00549 void
00550 setUserName(
00551 const IT_Bus::String& strUserName
00552 )
00553 {
00554 m_UserName = strUserName;
00555 }
00556
00562 const IT_Bus::String&
00563 getUserName() const
00564 {
00565 return m_UserName;
00566 }
00567
00575 void
00576 setPassword(
00577 const IT_Bus::String& strPassword
00578 )
00579 {
00580 m_Password = strPassword;
00581 }
00582
00588 const IT_Bus::String&
00589 getPassword() const
00590 {
00591 return m_Password;
00592 }
00593
00600 void
00601 setProxyServer(
00602 const IT_Bus::String& strProxyServer
00603 )
00604 {
00605 m_ProxyServer = strProxyServer;
00606 }
00607
00613 const IT_Bus::String&
00614 getProxyServer() const
00615 {
00616 return m_ProxyServer;
00617 }
00618
00624 void
00625 setProxyAuthorization(
00626 const IT_Bus::String& strProxyAuthorization
00627 )
00628 {
00629 m_ProxyAuthorization = strProxyAuthorization;
00630 }
00631
00637 const IT_Bus::String&
00638 getProxyAuthorization() const
00639 {
00640 return m_ProxyAuthorization;
00641 }
00642
00648 void
00649 setProxyAuthorizationType(
00650 const IT_Bus::String& strProxyAuthorizationType
00651 )
00652 {
00653 m_ProxyAuthorizationType = strProxyAuthorizationType;
00654 }
00655
00661 const IT_Bus::String&
00662 getProxyAuthorizationType() const
00663 {
00664 return m_ProxyAuthorizationType;
00665 }
00666
00672 void
00673 setProxyUserName(
00674 const IT_Bus::String& strProxyUserName
00675 )
00676 {
00677 m_ProxyUserName = strProxyUserName;
00678 }
00679
00685 const IT_Bus::String&
00686 getProxyUserName() const
00687 {
00688 return m_ProxyUserName;
00689 }
00690
00696 void
00697 setProxyPassword(
00698 const IT_Bus::String& strProxyPassword
00699 )
00700 {
00701 m_ProxyPassword = strProxyPassword;
00702 }
00703
00709 const IT_Bus::String&
00710 getProxyPassword() const
00711 {
00712 return m_ProxyPassword;
00713 }
00714
00720 void
00721 setAccept(
00722 const IT_Bus::String& strAccept
00723 )
00724 {
00725 m_Accept = strAccept;
00726 }
00727
00733 const IT_Bus::String&
00734 getAccept() const
00735 {
00736 return m_Accept;
00737 }
00738
00744 void
00745 setAcceptLanguage(
00746 const IT_Bus::String& strAcceptLanguage
00747 )
00748 {
00749 m_AcceptLanguage = strAcceptLanguage;
00750 }
00751
00757 const IT_Bus::String&
00758 getAcceptLanguage() const
00759 {
00760 return m_AcceptLanguage;
00761 }
00762
00769 void
00770 setAcceptEncoding(
00771 const IT_Bus::String& strAcceptEncoding
00772 )
00773 {
00774 m_AcceptEncoding = strAcceptEncoding;
00775 }
00776
00782 const IT_Bus::String&
00783 getAcceptEncoding() const
00784 {
00785 return m_AcceptEncoding;
00786 }
00787
00794 void
00795 setContentType(
00796 const IT_Bus::String& strContentType
00797 )
00798 {
00799 m_ContentType = strContentType;
00800 }
00801
00807 const IT_Bus::String&
00808 getContentType() const
00809 {
00810 return m_ContentType;
00811 }
00812
00819 void
00820 setHost(
00821 const IT_Bus::String& strHost
00822 )
00823 {
00824 m_Host = strHost;
00825 }
00826
00832 const IT_Bus::String&
00833 getHost() const
00834 {
00835 return m_Host;
00836 }
00837
00844 void
00845 setConnection(
00846 const IT_Bus::String& strConnection
00847 )
00848 {
00849 m_Connection = strConnection;
00850 }
00851
00857 const IT_Bus::String&
00858 getConnection() const
00859 {
00860 return m_Connection;
00861 }
00862
00868 void
00869 setKeepAlive(
00870 const IT_Bool& bKeepAlive
00871 )
00872 {
00873 m_bKeepAlive = bKeepAlive;
00874 }
00875
00881 const IT_Bool&
00882 getKeepAlive() const
00883 {
00884 return m_bKeepAlive;
00885 }
00886
00892 void
00893 setCacheControl(
00894 const IT_Bus::String& strCacheControl
00895 )
00896 {
00897 m_CacheControl = strCacheControl;
00898 }
00899
00905 const IT_Bus::String&
00906 getCacheControl() const
00907 {
00908 return m_CacheControl;
00909 }
00910
00917 void
00918 setCacheDNS(
00919 const IT_Bool& cache_dns
00920 )
00921 {
00922 m_cache_dns = cache_dns;
00923 }
00924
00930 const IT_Bool&
00931 getCacheDNS() const
00932 {
00933 return m_cache_dns;
00934 }
00935
00941 void
00942 setCookie(
00943 const IT_Bus::String& strCookie
00944 )
00945 {
00946 m_Cookie = strCookie;
00947 }
00948
00954 const IT_Bus::String&
00955 getCookie() const
00956 {
00957 return m_Cookie;
00958 }
00959
00960
00961
00962
00963
00964
00965
00966
00967 void
00968 setBrowserType(
00969 const IT_Bus::String& strBrowserType
00970 )
00971 {
00972 m_BrowserType = strBrowserType;
00973 }
00974
00975
00976
00977
00978
00979
00980 const IT_Bus::String&
00981 getBrowserType() const
00982 {
00983 return m_BrowserType;
00984 }
00985
00986
00987 void
00988 setReferer(
00989 const IT_Bus::String& strReferer
00990 )
00991 {
00992 m_Referer = strReferer;
00993 }
00994
00995 const IT_Bus::String&
00996 getReferer() const
00997 {
00998 return m_Referer;
00999 }
01000
01001
01002 void
01003 setIfModifiedSince(
01004 const IT_Bus::String& strIfModifiedSince
01005 )
01006 {
01007 m_IfModifiedSince = strIfModifiedSince;
01008 }
01009
01010 const IT_Bus::String&
01011 getIfModifiedSince() const
01012 {
01013 return m_IfModifiedSince;
01014 }
01015
01016
01017 void
01018 setETag(
01019 const IT_Bus::String& strETag
01020 )
01021 {
01022 m_ETag = strETag;
01023 }
01024
01025 const IT_Bus::String&
01026 getETag() const
01027 {
01028 return m_ETag;
01029 }
01030
01031
01032 void
01033 setUsingHTTP11(
01034 const IT_Bool& bUsingHTTP11
01035 )
01036 {
01037 m_bUsingHTTP11 = bUsingHTTP11;
01038 }
01039
01040 const IT_Bool&
01041 getUsingHTTP11() const
01042 {
01043 return m_bUsingHTTP11;
01044 }
01045
01046
01047 void
01048 setSuppressTLSv1(
01049 const IT_Bool& bSuppressTLSv1
01050 )
01051 {
01052 m_bSuppressTLSv1 = bSuppressTLSv1;
01053 }
01054
01055 const IT_Bool&
01056 getSuppressTLSv1() const
01057 {
01058 return m_bSuppressTLSv1;
01059 }
01060
01061
01062 void
01063 setSuppressBugTolerance(
01064 const IT_Bool& bSuppressBugTolerance
01065 )
01066 {
01067 m_bSuppressBugTolerance = bSuppressBugTolerance;
01068 }
01069
01070 const IT_Bool&
01071 getSuppressBugTolerance() const
01072 {
01073 return m_bSuppressBugTolerance;
01074 }
01075
01081 void
01082 setSoapAction(
01083 const IT_Bus::String& strSoapAction
01084 )
01085 {
01086 m_SoapAction = strSoapAction;
01087 }
01088
01094 const IT_Bus::String&
01095 getSoapAction() const
01096 {
01097 return m_SoapAction;
01098 }
01099
01103 HTTPClientConfiguration(
01104 const HTTPClientConfiguration& copyThis
01105 );
01106
01110 const HTTPClientConfiguration&
01111 operator=
01112 (
01113 const HTTPClientConfiguration& assignThis
01114 );
01115
01122 void
01123 InitializeFromURL(
01124 const IT_Bus::String& strURL
01125 );
01126
01133 void
01134 InitializeFromFile(
01135 const IT_Bus::String& strFile
01136 );
01137
01144 virtual void
01145 write(
01146 IT_Bus::XMLOutputStream & stream
01147 ) const throw((IT_Bus::IOException));
01148
01154 virtual void
01155 write_attributes(
01156 IT_Bus::XMLOutputStream & stream
01157 ) const throw((IT_Bus::IOException));
01158
01159 virtual bool
01160 export_to_client() const
01161 {
01162 return true;
01163 }
01164
01165
01166
01167
01168
01169 virtual void
01170 read_contents(
01171 IT_Bus::ComplexTypeReader & os
01172 ) throw((IT_Bus::DeserializationException));
01173
01174 virtual void
01175 write_contents(
01176 IT_Bus::ComplexTypeWriter & os
01177 ) const throw((IT_Bus::SerializationException));
01178
01179 virtual void
01180 read(
01181 const IT_Bus::QName& element_name,
01182 IT_Bus::ComplexTypeReader & reader
01183 ) throw((IT_Bus::DeserializationException));
01184
01185 virtual void
01186 write(
01187 const IT_Bus::QName& element_name,
01188 IT_Bus::ComplexTypeWriter & writer
01189 ) const throw((IT_Bus::SerializationException));
01190
01191 virtual void
01192 write_attributes(
01193 IT_Bus::ComplexTypeWriter & writer
01194 ) const throw((IT_Bus::SerializationException));
01195
01196 virtual void
01197 read_attributes(
01198 IT_Bus::ComplexTypeReader & reader
01199 ) throw((IT_Bus::DeserializationException));
01200
01201 virtual const IT_Bus::QName &
01202 get_type() const;
01203
01204 virtual
01205 IT_Bus::AnyType&
01206 copy(
01207 const IT_Bus::AnyType& rhs
01208 );
01209
01216 IT_WSDL::WSDLExtensionElement*
01217 clone() const;
01218
01226 static HTTPClientConfiguration*
01227 get_from_port(
01228 const IT_WSDL::WSDLPort& wsdl_port
01229 );
01230
01231 private:
01232
01233 void EnsureHTTP11Compliance();
01234 void set_proxy_server(
01235 const IT_Bus::XMLIterator& iter_protocol_config
01236 );
01237
01238
01239 IT_Bool m_bUseSecureSockets;
01240 IT_Bus::String m_ClientCertificate;
01241
01242
01243 IT_Bus::String m_ClientPrivateKey;
01244
01245 IT_Bus::String m_ClientPrivateKeyPassword;
01246 IT_Bus::String m_TrustedRootCertificates;
01247
01248
01249 IT_Bus::String m_ClientCertificateChain;
01250
01251
01252 IT_ULong m_ulPort;
01253 IT_ULong m_lSendTimeout;
01254 IT_ULong m_lReceiveTimeout;
01255
01256 IT_Bus::String m_Method;
01257 IT_Bus::String m_URL;
01258
01259 IT_Bus::String m_Authorization;
01260 IT_Bus::String m_AuthorizationType;
01261 IT_Bus::String m_UserName;
01262 IT_Bus::String m_Password;
01263
01264 IT_Bus::String m_ProxyServer;
01265 IT_Bus::String m_ProxyAuthorization;
01266 IT_Bus::String m_ProxyAuthorizationType;
01267 IT_Bus::String m_ProxyUserName;
01268 IT_Bus::String m_ProxyPassword;
01269
01270 IT_Bus::String m_Accept;
01271 IT_Bus::String m_AcceptLanguage;
01272 IT_Bus::String m_AcceptEncoding;
01273
01274 IT_Bus::String m_ContentType;
01275 IT_Bus::String m_Host;
01276 IT_Bus::String m_Connection;
01277 unsigned short m_connection_attempts;
01278 IT_Bool m_bKeepAlive;
01279 IT_Bus::String m_CacheControl;
01280 IT_Bool m_cache_dns;
01281
01282 IT_Bus::String m_Cookie;
01283 IT_Bus::String m_BrowserType;
01284 IT_Bus::String m_Referer;
01285 IT_Bus::String m_IfModifiedSince;
01286
01287 IT_Bus::String m_ETag;
01288
01289 IT_Bool m_bUsingHTTP11;
01290
01291 IT_Bool m_bSuppressTLSv1;
01292 IT_Bool m_bSuppressBugTolerance;
01293
01294 IT_Bus::String m_SoapAction;
01295
01296 IT_Bus::BinaryBuffer m_ClientTrustedRootCertificatesData;
01297
01298
01299 IT_Bus::BinaryBuffer m_ClientPrivateKeyData;
01300
01301 IT_Bus::BinaryBuffer m_ClientCertificateData;
01302
01303
01304 IT_Bus::BinaryBuffer m_ClientCertificateChainData;
01305
01306
01307 char m_szAuthorizationHeader[256];
01308 char m_szProxyAuthorizationHeader[256];
01309
01310 IT_HTTP::HttpWSDLExtensionFactory* m_extension_factory;
01311
01312
01313 IT_Bus::String m_encoding;
01314 IT_Bus::BusContextRegistry* m_ctx_registry;
01315 };
01316
01317 }
01318
01319 #endif