# ServiceClient.h

Go to the documentation of this file.

    00001 /*
    00002  * Copyright 2005-2009 WSO2, Inc. http://wso2.com
    00003  *
    00004  * Licensed under the Apache License, Version 2.0 (the "License");
    00005  * you may not use this file except in compliance with the License.
    00006  * You may obtain a copy of the License at
    00007  *
    00008  * http://www.apache.org/licenses/LICENSE-2.0
    00009  *
    00010  * Unless required by applicable law or agreed to in writing, software
    00011  * distributed under the License is distributed on an "AS IS" BASIS,
    00012  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    00013  * See the License for the specific language governing permissions and
    00014  * limitations under the License.
    00015  */
    00016
    00017 #ifndef SERVICECLIENT_H
    00018 #define SERVICECLIENT_H
    00019
    00020 #include <WSFDefines.h>
    00021 #include <string>
    00022 #include <axis2_conf_ctx.h>
    00023 #include <axis2_conf.h>
    00024 #include <axis2_svc_client.h>
    00025 #include <axis2_svc.h>
    00026 #include <axis2_const.h>
    00027 #include <axis2_http_transport.h>
    00028 #include <platforms/axutil_platform_auto_sense.h>
    00029 #include <WSFault.h>
    00030 #include <ICallback.h>
    00031 #include <Options.h>
    00032 #include <OMElement.h>
    00033 #include <OMNamespace.h>
    00034 #include <NeethiPolicy.h>
    00035 #include <MessageContext.h>
    00036
    00045 namespace wso2wsf
    00046 {
    00074     class ServiceClient
    00075     {
    00076
    00077         friend class Stub;
    00078
    00079     private:
    00084         axis2_svc_client_t * _wsf_service_client;
    00085
    00090         OMElement * _last_soap_fault;
    00091
    00096         OMElement * _last_response_soap_envelope_element;
    00097
    00102         axiom_soap_envelope_t * _last_response_soap_envelope;
    00103
    00108         Options * _options;
    00109
    00114     NeethiPolicy * _policy;
    00115
    00120     std::string _endpoint_address;
    00121
    00126         std::string _repo_home;
    00127
    00132     const axis2_conf_ctx_t * _conf_ctx;
    00133
    00139         bool isValid;
    00144     bool WSF_CALL initializeClient();
    00148         MessageContext* WSF_CALL getMessageContext(axis2_wsdl_msg_labels_t message_lebel);
    00149
    00153         void resetAxiomPayloadNamespace(OMElement *payload);
    00154
    00155     protected:
    00156
    00157
    00158     public:
    00166     WSF_EXTERN WSF_CALL ServiceClient(std::string endpoint_address);
    00167
    00173     WSF_EXTERN WSF_CALL ServiceClient(std::string repo_home, std::string endpoint_address);
    00174
    00180     WSF_EXTERN WSF_CALL ServiceClient(const axis2_conf_ctx_t * conf_ctx, std::string endpoint_address);
    00181
    00185     WSF_EXTERN virtual WSF_CALL ~ServiceClient();
    00192         WSF_EXTERN bool WSF_CALL isValidClient();
    00193
    00199         WSF_EXTERN bool WSF_CALL setOptions(Options * options);
    00200
    00206     WSF_EXTERN OMElement * WSF_CALL getLastSOAPFault ();
    00207
    00213     WSF_EXTERN Options * WSF_CALL getOptions();
    00214
    00224     WSF_EXTERN bool WSF_CALL engageModule(std::string module_name);
    00225
    00233     WSF_EXTERN bool WSF_CALL disengageModule(std::string module_name);
    00234
    00243     WSF_EXTERN bool WSF_CALL addHeader(OMElement * header);
    00244
    00250     WSF_EXTERN void WSF_CALL removeAllHeaders();
    00251
    00257     WSF_EXTERN bool WSF_CALL setPolicy(NeethiPolicy * policy);
    00258
    00269     WSF_EXTERN bool WSF_CALL send(OMElement * payload, std::string action) throw (WSFault);
    00270
    00283     WSF_EXTERN bool WSF_CALL send(OMElement * payload, std::string operation, std::string action) throw (WSFault);
    00284
    00298     WSF_EXTERN bool WSF_CALL send(OMElement * payload, bool robust, std::string operation, std::string action) throw (WSFault);
    00299
    00311     WSF_EXTERN bool WSF_CALL send(OMElement * payload, bool robust, std::string action) throw (WSFault);
    00312
    00323     WSF_EXTERN OMElement * WSF_CALL request(OMElement * payload, std::string action) throw (WSFault);
    00324
    00339     WSF_EXTERN OMElement * WSF_CALL request(OMElement * payload, ICallback * callback, std::string operation, std::string action) throw (WSFault);
    00340
    00353     WSF_EXTERN OMElement * WSF_CALL request(OMElement * payload, ICallback * callback, std::string action) throw (WSFault);
    00354
    00367     WSF_EXTERN OMElement * WSF_CALL request(OMElement * payload, std::string operation, std::string action) throw (WSFault);
    00368
    00374     WSF_EXTERN OMElement * WSF_CALL getLastResponseSoapEnvelope();
    00375
    00381     WSF_EXTERN std::string WSF_CALL getLastResponseSoapEnvelopeString();
    00382
    00386         WSF_EXTERN axis2_svc_client_t* WSF_CALL getAxis2SvcClient();
    00390         WSF_EXTERN axis2_conf_ctx_t* WSF_CALL getAxis2ConfCtx(std::string repositoryPath);
    00391
    00398         WSF_EXTERN bool WSF_CALL setProxy(std::string proxyHost, std::string proxyPort);
    00399
    00407         WSF_EXTERN bool WSF_CALL setProxyWithAuth(std::string proxyHost,
    00408                 std::string proxyPort, std::string username, std::string password);
    00409
    00414         WSF_EXTERN bool WSF_CALL getHttpAuthRequired();
    00415
    00421         WSF_EXTERN bool WSF_CALL getProxyAuthRequired();
    00422
    00427         WSF_EXTERN MessageContext* WSF_CALL getInMessageContext();
    00428
    00436         WSF_EXTERN MessageContext* WSF_CALL     getOutMessageContext();
    00437
    00438     WSF_EXTERN bool WSF_CALL close();
    00439
    00440     };
    00442 }
    00443 #endif // SERVICECLIENT_H