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/bus.h>
00008 #include <it_bus/sequence_complex_type.h>
00009 #include <it_bus_config/http_wsdl_extension_element.h>
00010 #include <it_bus/complex_type_reader.h>
00011 #include <it_bus/complex_type_writer.h>
00012 #include <it_bus_pdk/messaging_transport.h>
00013 #include <it_bus_pdk/context_attrs/http_conf_xsdTypes.h>
00014
00015 namespace IT_Bus
00016 {
00017 class BusContextRegistry;
00018 }
00019
00020 namespace IT_HTTP
00021 {
00022 class HTTPClient;
00023 class HTTPClientInputMessageAttributes;
00024 class HttpWSDLExtensionFactory;
00025
00030 class IT_BUS_API HTTPClientConfiguration :
00031 public IT_HTTP::HttpWSDLExtensionElement,
00032 public IT_Bus::SequenceComplexType
00033 {
00034
00035 public:
00036
00037 HTTPClientConfiguration(
00038 IT_Bus::BusContextRegistry* registry
00039 );
00040
00041 HTTPClientConfiguration(
00042 IT_HTTP::HttpWSDLExtensionFactory* factory,
00043 IT_WSDL::WSDLExtensibleNode* parent,
00044 IT_Bus::BusContextRegistry* registry
00045 );
00046
00047 virtual
00048 ~HTTPClientConfiguration();
00049
00053 void
00054 set_defaults();
00055
00056 bool
00057 parse(
00058 const IT_Bus::XMLIterator& element_iterator,
00059 const IT_Bus::XMLNode& element,
00060 IT_WSDL::WSDLErrorHandler& error_handler
00061 );
00062
00063 void
00064 initialize(
00065 IT_Bus::XMLHelper& configuration
00066 );
00067
00068 void
00069 initialize(
00070 const IT_Bus::XMLIterator& configuration
00071 );
00072
00078 void
00079 ReadCookieConfiguration(
00080 IT_Bus::XMLHelper& Configuration
00081 );
00082
00086 void
00087 ReadCookieConfiguration(
00088 const IT_Bus::XMLIterator& Configuration
00089 );
00090
00091 void
00092 SetConnectParameters(
00093 HTTPClient& HTTPClient,
00094 IT_Bus::ContextContainer * context_container = 0
00095 );
00096
00102 void
00103 setUseSecureSockets(
00104 const IT_Bool& bUseSecureSockets
00105 )
00106 {
00107 m_bUseSecureSockets = bUseSecureSockets;
00108 }
00109
00115 const IT_Bool&
00116 getUseSecureSockets() const
00117 {
00118 return m_bUseSecureSockets;
00119 }
00120
00126 IT_Bool&
00127 getUseSecureSockets()
00128 {
00129 return m_bUseSecureSockets;
00130 }
00131
00138 void
00139 setClientCertificate(
00140 const IT_Bus::String& strClientCertificate
00141 )
00142 {
00143 m_ClientCertificate = strClientCertificate;
00144 }
00145
00152 const IT_Bus::String&
00153 getClientCertificate() const
00154 {
00155 return m_ClientCertificate;
00156 }
00157
00164 IT_Bus::String&
00165 getClientCertificate()
00166 {
00167 return m_ClientCertificate;
00168 }
00169
00177 void
00178 setClientPrivateKey(
00179 const IT_Bus::String& strClientPrivateKey
00180 )
00181 {
00182 m_ClientPrivateKey = strClientPrivateKey;
00183 }
00184
00191 const IT_Bus::String&
00192 getClientPrivateKey() const
00193 {
00194 return m_ClientPrivateKey;
00195 }
00196
00203 IT_Bus::String&
00204 getClientPrivateKey()
00205 {
00206 return m_ClientPrivateKey;
00207 }
00208
00215 void
00216 setClientPrivateKeyPassword(
00217 const IT_Bus::String& strClientPrivateKeyPassword
00218 )
00219 {
00220 m_ClientPrivateKeyPassword = strClientPrivateKeyPassword;
00221 }
00222
00228 const IT_Bus::String&
00229 getClientPrivateKeyPassword() const
00230 {
00231 return m_ClientPrivateKeyPassword;
00232 }
00233
00239 IT_Bus::String&
00240 getClientPrivateKeyPassword()
00241 {
00242 return m_ClientPrivateKeyPassword;
00243 }
00244
00251 void
00252 setTrustedRootCertificates(
00253 const IT_Bus::String& strTrustedRootCertificates
00254 )
00255 {
00256 m_TrustedRootCertificates = strTrustedRootCertificates;
00257 }
00258
00264 const IT_Bus::String&
00265 getTrustedRootCertificates() const
00266 {
00267 return m_TrustedRootCertificates;
00268 }
00269
00275 IT_Bus::String&
00276 getTrustedRootCertificates()
00277 {
00278 return m_TrustedRootCertificates;
00279 }
00280
00288 void
00289 setClientCertificateChain(
00290 const IT_Bus::String& strClientCertificateChain
00291 )
00292 {
00293 m_ClientCertificateChain = strClientCertificateChain;
00294 }
00295
00302 const IT_Bus::String&
00303 getClientCertificateChain() const
00304 {
00305 return m_ClientCertificateChain;
00306 }
00307
00314 IT_Bus::String&
00315 getClientCertificateChain()
00316 {
00317 return m_ClientCertificateChain;
00318 }
00319
00326 void
00327 setPort(
00328 const IT_ULong& ulPort
00329 )
00330 {
00331 m_ulPort = ulPort;
00332 }
00333
00339 const IT_ULong&
00340 getPort() const
00341 {
00342 return m_ulPort;
00343 }
00344
00351 void
00352 set_connection_attempts(
00353 unsigned short connection_attempts
00354 )
00355 {
00356 m_connection_attempts = connection_attempts;
00357 }
00358
00364 unsigned short
00365 get_connection_attempts() const
00366 {
00367 return m_connection_attempts;
00368 }
00369
00376 void
00377 setSendTimeout(
00378 const IT_ULong& lSendTimeout
00379 )
00380 {
00381 m_lSendTimeout = lSendTimeout;
00382 }
00383
00389 const IT_ULong&
00390 getSendTimeout() const
00391 {
00392 return m_lSendTimeout;
00393 }
00394
00401 void
00402 setReceiveTimeout(
00403 const IT_ULong& lReceiveTimeout
00404 )
00405 {
00406 m_lReceiveTimeout = lReceiveTimeout;
00407 }
00408
00414 const IT_ULong&
00415 getReceiveTimeout() const
00416 {
00417 return m_lReceiveTimeout;
00418 }
00419
00426 void
00427 setMethod(
00428 const IT_Bus::String& strMethod
00429 )
00430 {
00431 m_Method = strMethod;
00432 }
00433
00439 const IT_Bus::String&
00440 getMethod() const
00441 {
00442 return m_Method;
00443 }
00444
00451 void
00452 setURL(
00453 const IT_Bus::String& strURL
00454 )
00455 {
00456 m_URL = strURL;
00457 if (!m_bUseSecureSockets)
00458 {
00459
00460 if (strncasecmp(m_URL.c_str(), "https://", strlen("https://")) == 0)
00461 {
00462 m_bUseSecureSockets = true;
00463 }
00464 }
00465
00466 if (m_bUseSecureSockets)
00467 {
00468 m_ulPort = 443;
00469 }
00470 else
00471 {
00472 m_ulPort = 80;
00473 }
00474 }
00475
00481 const IT_Bus::String&
00482 getURL() const
00483 {
00484 return m_URL;
00485 }
00486
00492 void
00493 setAuthorization(
00494 const IT_Bus::String& strAuthorization
00495 )
00496 {
00497 m_Authorization = strAuthorization;
00498 }
00499
00505 const IT_Bus::String&
00506 getAuthorization() const
00507 {
00508 return m_Authorization;
00509 }
00510
00516 void
00517 setAuthorizationType(
00518 const IT_Bus::String& strAuthorizationType
00519 )
00520 {
00521 m_AuthorizationType = strAuthorizationType;
00522 }
00523
00529 const IT_Bus::String&
00530 getAuthorizationType() const
00531 {
00532 return m_AuthorizationType;
00533 }
00534
00542 void
00543 setUserName(
00544 const IT_Bus::String& strUserName
00545 )
00546 {
00547 m_UserName = strUserName;
00548 }
00549
00555 const IT_Bus::String&
00556 getUserName() const
00557 {
00558 return m_UserName;
00559 }
00560
00568 void
00569 setPassword(
00570 const IT_Bus::String& strPassword
00571 )
00572 {
00573 m_Password = strPassword;
00574 }
00575
00581 const IT_Bus::String&
00582 getPassword() const
00583 {
00584 return m_Password;
00585 }
00586
00593 void
00594 setProxyServer(
00595 const IT_Bus::String& strProxyServer
00596 )
00597 {
00598 m_ProxyServer = strProxyServer;
00599 }
00600
00606 const IT_Bus::String&
00607 getProxyServer() const
00608 {
00609 return m_ProxyServer;
00610 }
00611
00617 void
00618 setProxyAuthorization(
00619 const IT_Bus::String& strProxyAuthorization
00620 )
00621 {
00622 m_ProxyAuthorization = strProxyAuthorization;
00623 }
00624
00630 const IT_Bus::String&
00631 getProxyAuthorization() const
00632 {
00633 return m_ProxyAuthorization;
00634 }
00635
00641 void
00642 setProxyAuthorizationType(
00643 const IT_Bus::String& strProxyAuthorizationType
00644 )
00645 {
00646 m_ProxyAuthorizationType = strProxyAuthorizationType;
00647 }
00648
00654 const IT_Bus::String&
00655 getProxyAuthorizationType() const
00656 {
00657 return m_ProxyAuthorizationType;
00658 }
00659
00665 void
00666 setProxyUserName(
00667 const IT_Bus::String& strProxyUserName
00668 )
00669 {
00670 m_ProxyUserName = strProxyUserName;
00671 }
00672
00678 const IT_Bus::String&
00679 getProxyUserName() const
00680 {
00681 return m_ProxyUserName;
00682 }
00683
00689 void
00690 setProxyPassword(
00691 const IT_Bus::String& strProxyPassword
00692 )
00693 {
00694 m_ProxyPassword = strProxyPassword;
00695 }
00696
00702 const IT_Bus::String&
00703 getProxyPassword() const
00704 {
00705 return m_ProxyPassword;
00706 }
00707
00713 void
00714 setAccept(
00715 const IT_Bus::String& strAccept
00716 )
00717 {
00718 m_Accept = strAccept;
00719 }
00720
00726 const IT_Bus::String&
00727 getAccept() const
00728 {
00729 return m_Accept;
00730 }
00731
00737 void
00738 setAcceptLanguage(
00739 const IT_Bus::String& strAcceptLanguage
00740 )
00741 {
00742 m_AcceptLanguage = strAcceptLanguage;
00743 }
00744
00750 const IT_Bus::String&
00751 getAcceptLanguage() const
00752 {
00753 return m_AcceptLanguage;
00754 }
00755
00762 void
00763 setAcceptEncoding(
00764 const IT_Bus::String& strAcceptEncoding
00765 )
00766 {
00767 m_AcceptEncoding = strAcceptEncoding;
00768 }
00769
00775 const IT_Bus::String&
00776 getAcceptEncoding() const
00777 {
00778 return m_AcceptEncoding;
00779 }
00780
00787 void
00788 setContentType(
00789 const IT_Bus::String& strContentType
00790 )
00791 {
00792 m_ContentType = strContentType;
00793 }
00794
00800 const IT_Bus::String&
00801 getContentType() const
00802 {
00803 return m_ContentType;
00804 }
00805
00812 void
00813 setHost(
00814 const IT_Bus::String& strHost
00815 )
00816 {
00817 m_Host = strHost;
00818 }
00819
00825 const IT_Bus::String&
00826 getHost() const
00827 {
00828 return m_Host;
00829 }
00830
00837 void
00838 setConnection(
00839 const IT_Bus::String& strConnection
00840 )
00841 {
00842 m_Connection = strConnection;
00843 }
00844
00850 const IT_Bus::String&
00851 getConnection() const
00852 {
00853 return m_Connection;
00854 }
00855
00861 void
00862 setKeepAlive(
00863 const IT_Bool& bKeepAlive
00864 )
00865 {
00866 m_bKeepAlive = bKeepAlive;
00867 }
00868
00874 const IT_Bool&
00875 getKeepAlive() const
00876 {
00877 return m_bKeepAlive;
00878 }
00879
00885 void
00886 setCacheControl(
00887 const IT_Bus::String& strCacheControl
00888 )
00889 {
00890 m_CacheControl = strCacheControl;
00891 }
00892
00898 const IT_Bus::String&
00899 getCacheControl() const
00900 {
00901 return m_CacheControl;
00902 }
00903
00910 void
00911 setCacheDNS(
00912 const IT_Bool& cache_dns
00913 )
00914 {
00915 m_cache_dns = cache_dns;
00916 }
00917
00923 const IT_Bool&
00924 getCacheDNS() const
00925 {
00926 return m_cache_dns;
00927 }
00928
00934 void
00935 setCookie(
00936 const IT_Bus::String& strCookie
00937 )
00938 {
00939 m_Cookie = strCookie;
00940 }
00941
00947 const IT_Bus::String&
00948 getCookie() const
00949 {
00950 return m_Cookie;
00951 }
00952
00953
00954
00955
00956
00957
00958
00959
00960 void
00961 setBrowserType(
00962 const IT_Bus::String& strBrowserType
00963 )
00964 {
00965 m_BrowserType = strBrowserType;
00966 }
00967
00968
00969
00970
00971
00972
00973 const IT_Bus::String&
00974 getBrowserType() const
00975 {
00976 return m_BrowserType;
00977 }
00978
00979
00980 void
00981 setReferer(
00982 const IT_Bus::String& strReferer
00983 )
00984 {
00985 m_Referer = strReferer;
00986 }
00987
00988 const IT_Bus::String&
00989 getReferer() const
00990 {
00991 return m_Referer;
00992 }
00993
00994
00995 void
00996 setIfModifiedSince(
00997 const IT_Bus::String& strIfModifiedSince
00998 )
00999 {
01000 m_IfModifiedSince = strIfModifiedSince;
01001 }
01002
01003 const IT_Bus::String&
01004 getIfModifiedSince() const
01005 {
01006 return m_IfModifiedSince;
01007 }
01008
01009
01010 void
01011 setETag(
01012 const IT_Bus::String& strETag
01013 )
01014 {
01015 m_ETag = strETag;
01016 }
01017
01018 const IT_Bus::String&
01019 getETag() const
01020 {
01021 return m_ETag;
01022 }
01023
01024
01025 void
01026 setUsingHTTP11(
01027 const IT_Bool& bUsingHTTP11
01028 )
01029 {
01030 m_bUsingHTTP11 = bUsingHTTP11;
01031 }
01032
01033 const IT_Bool&
01034 getUsingHTTP11() const
01035 {
01036 return m_bUsingHTTP11;
01037 }
01038
01039
01040 void
01041 setSuppressTLSv1(
01042 const IT_Bool& bSuppressTLSv1
01043 )
01044 {
01045 m_bSuppressTLSv1 = bSuppressTLSv1;
01046 }
01047
01048 const IT_Bool&
01049 getSuppressTLSv1() const
01050 {
01051 return m_bSuppressTLSv1;
01052 }
01053
01054
01055 void
01056 setSuppressBugTolerance(
01057 const IT_Bool& bSuppressBugTolerance
01058 )
01059 {
01060 m_bSuppressBugTolerance = bSuppressBugTolerance;
01061 }
01062
01063 const IT_Bool&
01064 getSuppressBugTolerance() const
01065 {
01066 return m_bSuppressBugTolerance;
01067 }
01068
01074 void
01075 setSoapAction(
01076 const IT_Bus::String& strSoapAction
01077 )
01078 {
01079 m_SoapAction = strSoapAction;
01080 }
01081
01087 const IT_Bus::String&
01088 getSoapAction() const
01089 {
01090 return m_SoapAction;
01091 }
01092
01096 HTTPClientConfiguration(
01097 const HTTPClientConfiguration& copyThis
01098 );
01099
01103 const HTTPClientConfiguration&
01104 operator=
01105 (
01106 const HTTPClientConfiguration& assignThis
01107 );
01108
01115 void
01116 InitializeFromURL(
01117 const IT_Bus::String& strURL
01118 );
01119
01126 void
01127 InitializeFromFile(
01128 const IT_Bus::String& strFile
01129 );
01130
01137 virtual void
01138 write(
01139 IT_Bus::XMLOutputStream & stream
01140 ) const throw((IT_Bus::IOException));
01141
01147 virtual void
01148 write_attributes(
01149 IT_Bus::XMLOutputStream & stream
01150 ) const throw((IT_Bus::IOException));
01151
01152 virtual bool
01153 export_to_client() const
01154 {
01155 return true;
01156 }
01157
01158
01159
01160
01161
01162 virtual void
01163 read_contents(
01164 IT_Bus::ComplexTypeReader & os
01165 ) throw((IT_Bus::DeserializationException));
01166
01167 virtual void
01168 write_contents(
01169 IT_Bus::ComplexTypeWriter & os
01170 ) const throw((IT_Bus::SerializationException));
01171
01172 virtual void
01173 read(
01174 const IT_Bus::QName& element_name,
01175 IT_Bus::ComplexTypeReader & reader
01176 ) throw((IT_Bus::DeserializationException));
01177
01178 virtual void
01179 write(
01180 const IT_Bus::QName& element_name,
01181 IT_Bus::ComplexTypeWriter & writer
01182 ) const throw((IT_Bus::SerializationException));
01183
01184 virtual void
01185 write_attributes(
01186 IT_Bus::ComplexTypeWriter & writer
01187 ) const throw((IT_Bus::SerializationException));
01188
01189 virtual void
01190 read_attributes(
01191 IT_Bus::ComplexTypeReader & reader
01192 ) throw((IT_Bus::DeserializationException));
01193
01194 virtual const IT_Bus::QName &
01195 get_type() const;
01196
01197 virtual
01198 IT_Bus::AnyType&
01199 copy(
01200 const IT_Bus::AnyType& rhs
01201 );
01202
01209 IT_WSDL::WSDLExtensionElement*
01210 clone() const;
01211
01219 static HTTPClientConfiguration*
01220 get_from_port(
01221 const IT_WSDL::WSDLPort& wsdl_port
01222 );
01223
01224 private:
01225
01226 void EnsureHTTP11Compliance();
01227 void set_proxy_server(
01228 const IT_Bus::XMLIterator& iter_protocol_config
01229 );
01230
01231
01232 IT_Bool m_bUseSecureSockets;
01233 IT_Bus::String m_ClientCertificate;
01234
01235
01236 IT_Bus::String m_ClientPrivateKey;
01237
01238 IT_Bus::String m_ClientPrivateKeyPassword;
01239 IT_Bus::String m_TrustedRootCertificates;
01240
01241
01242 IT_Bus::String m_ClientCertificateChain;
01243
01244
01245 IT_ULong m_ulPort;
01246 IT_ULong m_lSendTimeout;
01247 IT_ULong m_lReceiveTimeout;
01248
01249 IT_Bus::String m_Method;
01250 IT_Bus::String m_URL;
01251
01252 IT_Bus::String m_Authorization;
01253 IT_Bus::String m_AuthorizationType;
01254 IT_Bus::String m_UserName;
01255 IT_Bus::String m_Password;
01256
01257 IT_Bus::String m_ProxyServer;
01258 IT_Bus::String m_ProxyAuthorization;
01259 IT_Bus::String m_ProxyAuthorizationType;
01260 IT_Bus::String m_ProxyUserName;
01261 IT_Bus::String m_ProxyPassword;
01262
01263 IT_Bus::String m_Accept;
01264 IT_Bus::String m_AcceptLanguage;
01265 IT_Bus::String m_AcceptEncoding;
01266
01267 IT_Bus::String m_ContentType;
01268 IT_Bus::String m_Host;
01269 IT_Bus::String m_Connection;
01270 unsigned short m_connection_attempts;
01271 IT_Bool m_bKeepAlive;
01272 IT_Bus::String m_CacheControl;
01273 IT_Bool m_cache_dns;
01274
01275 IT_Bus::String m_Cookie;
01276 IT_Bus::String m_BrowserType;
01277 IT_Bus::String m_Referer;
01278 IT_Bus::String m_IfModifiedSince;
01279
01280 IT_Bus::String m_ETag;
01281
01282 IT_Bool m_bUsingHTTP11;
01283
01284 IT_Bool m_bSuppressTLSv1;
01285 IT_Bool m_bSuppressBugTolerance;
01286
01287 IT_Bus::String m_SoapAction;
01288
01289 IT_Bus::BinaryBuffer m_ClientTrustedRootCertificatesData;
01290
01291
01292 IT_Bus::BinaryBuffer m_ClientPrivateKeyData;
01293
01294 IT_Bus::BinaryBuffer m_ClientCertificateData;
01295
01296
01297 IT_Bus::BinaryBuffer m_ClientCertificateChainData;
01298
01299
01300 char m_szAuthorizationHeader[256];
01301 char m_szProxyAuthorizationHeader[256];
01302
01303 IT_HTTP::HttpWSDLExtensionFactory* m_extension_factory;
01304
01305
01306 IT_Bus::String m_encoding;
01307 IT_Bus::BusContextRegistry* m_ctx_registry;
01308 };
01309
01310 }
01311
01312 #endif