soapclient.hpp 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*##############################################################################
  2. HPCC SYSTEMS software Copyright (C) 2012 HPCC Systems®.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. ############################################################################## */
  13. #ifndef _SOAPCLIENT_HPP__
  14. #define _SOAPCLIENT_HPP__
  15. //Jlib
  16. #include "jiface.hpp"
  17. //SCM Interfaces
  18. #include "esp.hpp"
  19. #include "soapesp.hpp"
  20. //ESP Bindings
  21. #include "SOAP/Platform/soapmessage.hpp"
  22. class esp_http_decl CSoapClient : implements ISoapClient, public CInterface
  23. {
  24. private:
  25. StringAttr m_username;
  26. StringAttr m_password;
  27. StringAttr m_realm;
  28. bool m_disableKeepAlive;
  29. Owned<ITransportClient> m_transportclient;
  30. int postRequest(const char* contenttype, const char* soapaction, IRpcMessage& rpccall,
  31. StringBuffer& responsebuf, CMimeMultiPart* resp_multipart, IRpcMessageArray *headers=NULL);
  32. public:
  33. IMPLEMENT_IINTERFACE
  34. CSoapClient(){m_disableKeepAlive=false;}
  35. CSoapClient(ITransportClient* transportclient){m_transportclient.setown(transportclient); m_disableKeepAlive=false;}
  36. virtual ~CSoapClient() {};
  37. virtual int setUsernameToken(const char* userid, const char* password, const char* realm);
  38. virtual void disableKeepAlive() { m_disableKeepAlive = true;}
  39. // Under most cases, use this one
  40. virtual int postRequest(IRpcMessage& rpccall, IRpcMessage& rpcresponse);
  41. // If you want to set a soapaction http header, use this one.
  42. virtual int postRequest(const char* soapaction, IRpcMessage& rpccall, IRpcMessage& rpcresponse);
  43. virtual int postRequest(const char* soapaction, IRpcMessage& rpccall, StringBuffer& responsebuf);
  44. virtual int postRequest(const char* soapaction, IRpcMessage& rpccall, StringBuffer& responsebuf, IRpcMessageArray *headers);
  45. // If you want a content-type that is different from "soap/application", use this one. This should not be necessary
  46. // unless the server side doesn't follow the standard.
  47. virtual int postRequest(const char* contenttype, const char* soapaction, IRpcMessage& rpccall, IRpcMessage& rpcresponse);
  48. virtual int postRequest(const char* contenttype, const char* soapaction, IRpcMessage& rpccall, StringBuffer& responsebuf);
  49. virtual int postRequest(const char* contenttype, const char* soapaction, IRpcMessage& rpccall, StringBuffer& responsebuf, IRpcMessageArray *headers);
  50. virtual int postRequest(IRpcMessage & rpccall, StringBuffer & responsebuf);
  51. virtual int postRequest(IRpcMessage & rpccall, StringBuffer & responsebuf, IRpcMessageArray *headers);
  52. virtual const char * getServiceType() {return "EspSoapClient";};
  53. };
  54. #endif