[prev in list] [next in list] [prev in thread] [next in thread]
List: wsf-c-commits
Subject: [Wsf-c-commits] svn commit r31605 - in
From: shankar () wso2 ! com
Date: 2009-02-26 11:09:15
Message-ID: E1Lce79-0001TG-Mt () wso2 ! org
[Download RAW message or body]
Author: shankar
Date: Thu Feb 26 03:09:15 2009
New Revision: 31605
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=31605
Log:
modifying clients..
Modified:
trunk/wsf/cpp/examples/clients/echo/echo_blocking.cpp
trunk/wsf/cpp/examples/clients/echo/echo_blocking_addr.cpp
trunk/wsf/cpp/examples/clients/echo/echo_blocking_dual.cpp
trunk/wsf/cpp/examples/clients/echo/echo_blocking_soap11.cpp
trunk/wsf/cpp/examples/clients/echo/echo_non_blocking.cpp
trunk/wsf/cpp/examples/clients/echo/echo_non_blocking_dual.cpp
trunk/wsf/cpp/examples/clients/echo/echo_rest.cpp
trunk/wsf/cpp/examples/clients/echo/echo_security.cpp
trunk/wsf/cpp/examples/clients/flickr/flickr.cpp
trunk/wsf/cpp/examples/clients/google/google.cpp
trunk/wsf/cpp/examples/clients/math/math.cpp
trunk/wsf/cpp/examples/clients/mtom/mtom.cpp
trunk/wsf/cpp/examples/clients/notify/notify.cpp
trunk/wsf/cpp/examples/clients/yahoo/yahoo.cpp
Modified: trunk/wsf/cpp/examples/clients/echo/echo_blocking.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_blocking.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_blocking.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_blocking.cpp Thu Feb 26 03:09:15 2009
@@ -25,36 +25,33 @@
int main()
{
- WSSOAPClient * sc = new \
WSSOAPClient("http://localhost:9090/axis2/services/echo");
- //sc->initializeClient("echo_blocking.log", AXIS2_LOG_LEVEL_TRACE);
+ WSSOAPClient sc("http://localhost:9090/axis2/services/echo");
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+ try
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ OMElement * response = sc.request(payload, "");
+ if (response)
{
- response = sc->request(payload, "");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Response: " << response << endl;
}
- catch (AxisFault & e)
+ }
+ catch (AxisFault & e)
+ {
+ if (sc.getLastSOAPFault())
+ {
+ cout << endl << "Response: " << sc.getLastSOAPFault() << endl;
+ }
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Response: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Response: " << e << endl;
- }
+ cout << endl << "Response: " << e << endl;
}
- delete payload;
}
- delete sc;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_blocking_addr.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_blocking_addr.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_blocking_addr.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_blocking_addr.cpp Thu Feb 26 03:09:15 \
2009 @@ -26,44 +26,34 @@
int main()
{
WSSOAPClient * sc = new \
WSSOAPClient("http://localhost:9090/axis2/services/echo");
- try
- {
- //sc->initializeClient("echo_blocking_addr.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
sc->engageModule(AXIS2_MODULE_ADDRESSING);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+ try
+ {
+ OMElement * response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/echoString"); + if (response)
+ {
+ cout << endl << "Response: " << response << endl;
+ }
+ }
+ catch (AxisFault & e)
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ if (sc->getLastSOAPFault())
{
- response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/echoString");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
+ delete payload;
delete sc;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_blocking_dual.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_blocking_dual.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_blocking_dual.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_blocking_dual.cpp Thu Feb 26 03:09:15 \
2009 @@ -25,11 +25,8 @@
int main(int argc, char *argv[])
{
- string end_point, reply_to;
- WSSOAPClient * sc;
-
- end_point = "http://localhost:9090/axis2/services/echo";
- reply_to = "http://localhost:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__";
+ string end_point = "http://localhost:9090/axis2/services/echo";
+ string reply_to = \
"http://localhost:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__";
if (argc > 1)
{
@@ -48,48 +45,36 @@
if (argc > 2)
reply_to = argv[2];
- sc = new WSSOAPClient(end_point);
- try
- {
- //sc->initializeClient("echo_blocking_dual.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
- Options * op = sc->getOptions();
+ WSSOAPClient sc(end_point);
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+ Options * op = sc.getOptions();
op->setUseSeparateListener(true);
op->setReplyTo(reply_to);
- sc->setOptions(op);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+ try
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ OMElement * response = sc.request(payload, \
"http://ws.apache.org/axis2/c/samples/echoString"); + if (response)
+ {
+ cout << endl << "Response: " << response << endl;
+ }
+ }
+ catch (AxisFault & e)
+ {
+ if (sc.getLastSOAPFault())
{
- response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/echoString");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Fault: " << sc.getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
- delete sc;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_blocking_soap11.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_blocking_soap11.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_blocking_soap11.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_blocking_soap11.cpp Thu Feb 26 03:09:15 \
2009 @@ -25,47 +25,35 @@
int main()
{
- WSSOAPClient * sc = new \
WSSOAPClient("http://localhost:9090/axis2/services/echo");
- try
- {
- //sc->initializeClient("echo_blocking_soap11.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- Options * op = sc->getOptions();
+ WSSOAPClient sc("http://localhost:9090/axis2/services/echo");
+ Options * op = sc.getOptions();
op->setSoapVersion(AXIOM_SOAP11);
- sc->setOptions(op);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+ try
+ {
+ OMElement * response = sc.request(payload, \
"http://ws.apache.org/axis2/c/samples/echo/soap_action"); + if (response)
+ {
+ cout << endl << "Response: " << response << endl;
+ }
+ }
+ catch (AxisFault & e)
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ if (sc.getLastSOAPFault())
{
- response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/echo/soap_action");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Fault: " << sc.getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
- delete sc;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_non_blocking.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_non_blocking.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_non_blocking.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_non_blocking.cpp Thu Feb 26 03:09:15 \
2009 @@ -27,39 +27,34 @@
class EchoCallback: public ICallback
{
public:
- void WSF_CALL onComplete(OMElement* message);
+ bool isComplete;
- void WSF_CALL onFault(OMElement* message);
-
- WSF_CALL ~EchoCallback();
-};
-
-bool isComplete = false;
-EchoCallback * callback = NULL;
+ WSF_CALL EchoCallback()
+ {
+ isComplete = false;
+ }
-EchoCallback::~EchoCallback()
-{}
+ void WSF_CALL onComplete(OMElement* message)
+ {
+ cout << endl << "Response: " << message->toString() << endl;
+ isComplete = true;
+ }
-void EchoCallback::onComplete(OMElement* message)
-{
- cout << endl << "Response: " << message->toString() << endl;
- isComplete = true;
-}
+ void WSF_CALL onFault(OMElement* message)
+ {
+ cout << endl << "Fault: " << message->toString() << endl;
+ isComplete = true;
+ }
-void EchoCallback::onFault(OMElement* message)
-{
- cout << endl << "Fault: " << message->toString() << endl;
- isComplete = true;
-}
+ WSF_CALL ~EchoCallback()
+ {
+ }
+};
int main(int argc, char *argv[])
{
- string end_point;
- int timeout;
- WSSOAPClient * sc;
-
- end_point = "http://localhost:9090/axis2/services/echo";
- timeout = 10000;
+ string end_point = "http://localhost:9090/axis2/services/echo";;
+ int timeout = 10000;;
if (argc > 1)
{
@@ -78,50 +73,31 @@
if (argc > 2)
end_point = argv[2];
- sc = new WSSOAPClient(end_point);
- try
- {
- //sc->initializeClient("echo_non_blocking.log", AXIS2_LOG_LEVEL_TRACE);
- }
+ WSSOAPClient sc(end_point);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+ EchoCallback callback;
+ try
+ {
+ sc.request(payload, &callback, "");
+ }
catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
+ {
+ cout << "Error: " << e << endl;
}
+
+ int count = 0;
+ while((count < timeout) && (!callback.isComplete))
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- EchoCallback * callback = new EchoCallback();
- if (callback)
- {
- try
- {
- sc->request(payload, callback, "");
- }
- catch (AxisFault & e)
- {
- cout << "Error: " << e << endl;
- }
- int count = 0;
- while (count < timeout)
- {
- if (isComplete)
- {
- break;
- }
- WSF_USLEEP(100);
- count++;
- }
- cout << endl << endl << "Time: " << count << endl;
- if (count == timeout)
- {
- return 0;
- }
- }
- delete payload;
+ WSF_USLEEP(100);
+ count++;
}
- delete sc;
+
+ cout << endl << endl << "Time: " << count << endl;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_non_blocking_dual.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_non_blocking_dual.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_non_blocking_dual.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_non_blocking_dual.cpp Thu Feb 26 \
03:09:15 2009 @@ -27,82 +27,62 @@
class EchoCallback: public ICallback
{
public:
- void WSF_CALL onComplete(OMElement* message);
+ bool isComplete;
- void WSF_CALL onFault(OMElement* message);
-
- WSF_CALL ~EchoCallback();
-};
-
-bool isComplete = false;
-EchoCallback * callback = NULL;
+ WSF_CALL EchoCallback()
+ {
+ isComplete = false;
+ }
-EchoCallback::~EchoCallback()
-{}
+ void WSF_CALL onComplete(OMElement* message)
+ {
+ cout << endl << "Response: " << message->toString() << endl;
+ isComplete = true;
+ }
-void EchoCallback::onComplete(OMElement* message)
-{
- cout << endl << "Response: " << message->toString() << endl;
- isComplete = true;
-}
+ void WSF_CALL onFault(OMElement* message)
+ {
+ cout << endl << "Fault: " << message->toString() << endl;
+ isComplete = true;
+ }
-void EchoCallback::onFault(OMElement* message)
-{
- cout << endl << "Fault: " << message->toString() << endl;
- isComplete = true;
-}
+ WSF_CALL ~EchoCallback()
+ {
+ }
+};
int main()
{
WSSOAPClient * sc = new \
WSSOAPClient("http://localhost:9090/axis2/services/echo");
- try
- {
- //sc->initializeClient("echo_non_blocking_dual.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
sc->engageModule(AXIS2_MODULE_ADDRESSING);
Options * op = sc->getOptions();
op->setUseSeparateListener(true);
op->setReplyTo("http://localhost:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__");
sc->setOptions(op);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+ EchoCallback callback;
+ try
+ {
+ sc->request(payload, &callback, \
"http://ws.apache.org/axis2/c/samples/echoString"); + }
+ catch (AxisFault & e)
+ {
+ cout << "Error: " << e << endl;
+ }
+
+ int count = 0, timeout = 10000;
+ while((count < timeout) && (!callback.isComplete))
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- EchoCallback * callback = new EchoCallback();
- if (callback)
- {
- try
- {
- sc->request(payload, callback, \
"http://ws.apache.org/axis2/c/samples/echoString");
- }
- catch (AxisFault & e)
- {
- cout << "Error: " << e << endl;
- }
- int count = 0, timeout = 10000;
- while (count < timeout)
- {
- if (isComplete)
- {
- break;
- }
- WSF_USLEEP(100);
- count++;
- }
- cout << endl << endl << "Time: " << count << endl;
- if (count == timeout)
- {
- return 0;
- }
- }
- delete payload;
+ WSF_USLEEP(100);
+ count++;
}
+ cout << endl << endl << "Time: " << count << endl;
+ delete payload;
delete sc;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_rest.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_rest.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_rest.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_rest.cpp Thu Feb 26 03:09:15 2009
@@ -25,40 +25,29 @@
int main()
{
- WSRESTClient * sc = new \
WSRESTClient("http://localhost:9090/axis2/services/echo/echoString");
- try
- {
- //sc->initializeClient("echo_rest.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- Options * op = sc->getOptions();
+ WSRESTClient sc("http://localhost:9090/axis2/services/echo/echoString");
+ Options * op = sc.getOptions();
op->setHTTPMethod(AXIS2_HTTP_GET);
- sc->setOptions(op);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/echo", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoString", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello World!");
+ cout << endl << "Request: " << payload << endl;
+
+
+ try
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/echo", "ns1");
- OMElement * payload = new OMElement(NULL,"echoString", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello World!");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
- {
- response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/echo/soap_action");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
- }
- catch (AxisFault & e)
+ OMElement * response = sc.request(payload, \
"http://ws.apache.org/axis2/c/samples/echo/soap_action"); + if (response)
{
- cout << endl << "Error: " << e << endl;
+ cout << endl << "Response: " << response << endl;
}
- delete payload;
}
- delete sc;
+ catch (AxisFault & e)
+ {
+ cout << endl << "Error: " << e << endl;
+ }
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/echo/echo_security.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/echo/echo_security.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/echo/echo_security.cpp (original)
+++ trunk/wsf/cpp/examples/clients/echo/echo_security.cpp Thu Feb 26 03:09:15 2009
@@ -25,12 +25,9 @@
int main(int argc, char *argv[])
{
- string end_point, client_repo, policy_file;
- WSSOAPClient * sc;
-
- end_point = "http://localhost:9090/axis2/services/sec_echo";
- client_repo = "client_repo/";
- policy_file = "policy.xml";
+ string end_point = "http://localhost:9090/axis2/services/sec_echo";
+ string client_repo = "client_repo/";
+ string policy_file = "policy.xml";
if (argc > 1)
{
@@ -53,46 +50,36 @@
if (argc > 3)
policy_file = argv[3];
- sc = new WSSOAPClient(client_repo, end_point);
- try
- {
- //sc->initializeClient("echo_security.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
+ WSSOAPClient sc(client_repo, end_point);
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+ sc.setPolicy(new NeethiPolicy(client_repo + policy_file));
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/rampart/c/samples", \
"ns1"); + OMElement * payload = new OMElement(NULL,"echoIn", ns);
+ OMElement * child = new OMElement(payload,"text", NULL);
+ child->setText("Hello");
+ cout << endl << "Request: " << payload << endl;
+
+ try
+ {
+ OMElement* response = sc.request(payload, \
"http://example.com/ws/2004/09/policy/Test/EchoRequest"); + if (response)
+ {
+ cout << endl << "ResponseEnvelope: " << \
sc.getLastResponseSoapEnvelopeString() << endl; + cout << endl << \
"Response: " << response << endl; + }
}
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
- sc->setPolicy(new NeethiPolicy(client_repo + policy_file));
+ catch (AxisFault & e)
{
- OMNamespace * ns = new OMNamespace("http://ws.apache.org/rampart/c/samples", \
"ns1");
- OMElement * payload = new OMElement(NULL,"echoIn", ns);
- OMElement * child = new OMElement(payload,"text", NULL);
- child->setText("Hello");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ if (sc.getLastSOAPFault())
{
- response = sc->request(payload, \
"http://example.com/ws/2004/09/policy/Test/EchoRequest");
- if (response)
- {
- cout << endl << "Response: " << \
sc->getLastResponseSoapEnvelopeString() << endl;
- }
+ cout << endl << "Fault: " << sc.getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
- delete sc;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/flickr/flickr.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/flickr/flickr.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/flickr/flickr.cpp (original)
+++ trunk/wsf/cpp/examples/clients/flickr/flickr.cpp Thu Feb 26 03:09:15 2009
@@ -25,47 +25,37 @@
int main()
{
WSSOAPClient * sc = new WSSOAPClient("http://api.flickr.com/services/soap/");
- try
- {
- //sc->initializeClient("flickr_client.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
+
+ OMNamespace * ns = new OMNamespace("urn:flickr", "x");
+ OMElement * payload = new OMElement(NULL,"FlickrRequest", ns);
+ OMElement * child1 = new OMElement(payload,"method", NULL);
+ child1->setText("flickr.photos.search");
+ OMElement * child2 = new OMElement(payload,"api_key", NULL);
+ child2->setText("00000000000000000000000000000000");
+ OMElement * child3 = new OMElement(payload,"tags", NULL);
+ child3->setText("home");
+ cout << endl << "Request: " << payload << endl;
+
+ try
+ {
+ OMElement * response = sc->request(payload, "");
+ if (response)
+ {
+ cout << endl << "Response: " << response << endl;
+ }
}
+ catch (AxisFault & e)
{
- OMNamespace * ns = new OMNamespace("urn:flickr", "x");
- OMElement * payload = new OMElement(NULL,"FlickrRequest", ns);
- OMElement * child1 = new OMElement(payload,"method", NULL);
- child1->setText("flickr.photos.search");
- OMElement * child2 = new OMElement(payload,"api_key", NULL);
- child2->setText("00000000000000000000000000000000");
- OMElement * child3 = new OMElement(payload,"tags", NULL);
- child3->setText("home");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ if (sc->getLastSOAPFault())
{
- response = sc->request(payload, "");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
+ delete payload;
delete sc;
}
Modified: trunk/wsf/cpp/examples/clients/google/google.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/google/google.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/google/google.cpp (original)
+++ trunk/wsf/cpp/examples/clients/google/google.cpp Thu Feb 26 03:09:15 2009
@@ -25,61 +25,50 @@
int main()
{
- WSSOAPClient * sc = new WSSOAPClient("http://api.google.com/search/beta2");
- try
- {
- //sc->initializeClient("google_client.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
- Options * op = sc->getOptions();
+ WSSOAPClient sc("http://api.google.com/search/beta2");
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+
+ Options * op = sc.getOptions();
op->setSoapVersion(AXIOM_SOAP11);
- sc->setOptions(op);
+
+ OMNamespace * ns0 = new OMNamespace(AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI, \
"soapenv"); + OMNamespace * ns1 = new OMNamespace("urn:GoogleSearch", "ns1");
+ OMNamespace * ns2 = new OMNamespace("http://www.w3.org/1999/XMLSchema-instance", \
"xsi"); + OMNamespace * ns3 = new OMNamespace("http://www.w3.org/1999/XMLSchema", \
"xsd"); + OMAttribute * at1 = new OMAttribute("encodingStyle", \
"http://schemas.xmlsoap.org/soap/encoding/", ns0); + OMElement * payload = new \
OMElement(NULL,"doSpellingSuggestion", ns1); + payload->addAttribute(at1);
+ payload->setNamespace(ns2, false);
+ payload->setNamespace(ns3, false);
+ OMElement * child1 = new OMElement(payload,"key", NULL);
+ OMAttribute * at2 = new OMAttribute("type", "xsd:string", ns2);
+ child1->addAttribute(at2);
+ child1->setText("00000000000000000000000000000000");
+ OMElement * child2 = new OMElement(payload,"phrase", NULL);
+ OMAttribute * at3 = new OMAttribute("type", "xsd:string", ns2);
+ child2->addAttribute(at2);
+ child2->setText("salvasion");
+ cout << endl << "Request: " << payload << endl;
+
+ try
+ {
+ OMElement * response = sc.request(payload, "");
+ if (response)
+ {
+ cout << endl << "Response: " << response << endl;
+ }
+ }
+ catch (AxisFault & e)
{
- OMNamespace * ns0 = new \
OMNamespace(AXIOM_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI, "soapenv");
- OMNamespace * ns1 = new OMNamespace("urn:GoogleSearch", "ns1");
- OMNamespace * ns2 = new \
OMNamespace("http://www.w3.org/1999/XMLSchema-instance", "xsi");
- OMNamespace * ns3 = new OMNamespace("http://www.w3.org/1999/XMLSchema", \
"xsd");
- OMAttribute * at1 = new OMAttribute("encodingStyle", \
"http://schemas.xmlsoap.org/soap/encoding/", ns0);
- OMElement * payload = new OMElement(NULL,"doSpellingSuggestion", ns1);
- payload->addAttribute(at1);
- payload->setNamespace(ns2, false);
- payload->setNamespace(ns3, false);
- OMElement * child1 = new OMElement(payload,"key", NULL);
- OMAttribute * at2 = new OMAttribute("type", "xsd:string", ns2);
- child1->addAttribute(at2);
- child1->setText("00000000000000000000000000000000");
- OMElement * child2 = new OMElement(payload,"phrase", NULL);
- OMAttribute * at3 = new OMAttribute("type", "xsd:string", ns2);
- child2->addAttribute(at2);
- child2->setText("salvasion");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ if (sc.getLastSOAPFault())
{
- response = sc->request(payload, "");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Fault: " << sc.getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
- delete sc;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/math/math.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/math/math.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/math/math.cpp (original)
+++ trunk/wsf/cpp/examples/clients/math/math.cpp Thu Feb 26 03:09:15 2009
@@ -25,13 +25,10 @@
int main(int argc, char *argv[])
{
- string operation, param1, param2, end_point;
- WSSOAPClient * sc;
-
- operation = "add";
- param1 = "40";
- param2 = "8";
- end_point = "http://localhost:9090/axis2/services/math";
+ string operation = "add";
+ string param1 = "40";
+ string param2 = "8";
+ string end_point = "http://localhost:9090/axis2/services/math";
if (argc > 1)
{
@@ -56,47 +53,36 @@
if (argc > 4)
end_point = argv[4];
- sc = new WSSOAPClient(end_point);
- try
- {
- //sc->initializeClient("math_blocking.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
+ WSSOAPClient sc(end_point);
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+
+ OMNamespace * ns = new OMNamespace("http://ws.apache.org/axis2/services/math", \
"ns1"); + OMElement * payload = new OMElement(NULL,operation, ns);
+ OMElement * child1 = new OMElement(payload,"param1", NULL);
+ child1->setText(param1);
+ OMElement * child2 = new OMElement(payload,"param2", NULL);
+ child2->setText(param2);
+ cout << endl << "Request: " << payload << endl;
+
+ try
+ {
+ OMElement * response = sc.request(payload, \
"http://ws.apache.org/axis2/c/samples/mathSample"); + if (response)
+ {
+ cout << endl << "Response: " << response << endl;
+ }
}
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
+ catch (AxisFault & e)
{
- OMNamespace * ns = new \
OMNamespace("http://ws.apache.org/axis2/services/math", "ns1");
- OMElement * payload = new OMElement(NULL,operation, ns);
- OMElement * child1 = new OMElement(payload,"param1", NULL);
- child1->setText(param1);
- OMElement * child2 = new OMElement(payload,"param2", NULL);
- child2->setText(param2);
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ if (sc.getLastSOAPFault())
{
- response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/mathSample");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Fault: " << sc.getLastSOAPFault() << endl;
}
- catch (AxisFault & e)
+ else
{
- if (sc->getLastSOAPFault())
- {
- cout << endl << "Fault: " << sc->getLastSOAPFault() << endl;
- }
- else
- {
- cout << endl << "Error: " << e << endl;
- }
+ cout << endl << "Error: " << e << endl;
}
- delete payload;
}
- delete sc;
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/mtom/mtom.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/mtom/mtom.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/mtom/mtom.cpp (original)
+++ trunk/wsf/cpp/examples/clients/mtom/mtom.cpp Thu Feb 26 03:09:15 2009
@@ -27,11 +27,8 @@
int main(int argc, char *argv[])
{
- string end_point, file_name;
- WSSOAPClient * sc;
-
- end_point = "http://localhost:9090/axis2/services/mtom";
- file_name = "resources/axis2.jpg";
+ string end_point = "http://localhost:9090/axis2/services/mtom";
+ string file_name = "resources/axis2.jpg";
if (argc > 1)
{
@@ -50,46 +47,35 @@
if (argc > 2)
file_name = argv[2];
- sc = new WSSOAPClient(end_point);
- try
- {
- //sc->initializeClient("mtom.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
- Options * op = sc->getOptions();
+ WSSOAPClient sc(end_point);
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+
+ Options * op = sc.getOptions();
op->setSoapVersion(AXIOM_SOAP11);
op->setEnableMTOM(true);
- sc->setOptions(op);
+
+ OMNamespace * ns1 = new OMNamespace("http://ws.apache.org/axis2/c/samples/mtom", \
"ns1"); + OMElement * payload = new OMElement(NULL,"mtomSample", ns1);
+ OMElement * child1 = new OMElement(payload,"fileName", ns1);
+ child1->setText("test.jpg");
+ OMElement * child2 = new OMElement(payload,"image", ns1);
+ OMDataHandler * data_handler = new OMDataHandler(file_name, "image/jpeg");
+ OMText * child3 = new OMText(child2, data_handler);
+ child3->optimize(true);
+ cout << endl << "Request: " << payload << endl;
+
+ try
{
- OMNamespace * ns1 = new \
OMNamespace("http://ws.apache.org/axis2/c/samples/mtom", "ns1");
- OMElement * payload = new OMElement(NULL,"mtomSample", ns1);
- OMElement * child1 = new OMElement(payload,"fileName", ns1);
- child1->setText("test.jpg");
- OMElement * child2 = new OMElement(payload,"image", ns1);
- OMDataHandler * data_handler = new OMDataHandler(file_name, "image/jpeg");
- OMText * child3 = new OMText(child2, data_handler);
- child3->optimize(true);
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
+ OMElement * response = sc.request(payload, \
"http://ws.apache.org/axis2/c/samples/mtomSample"); + if (response)
{
- response = sc->request(payload, \
"http://ws.apache.org/axis2/c/samples/mtomSample");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
+ cout << endl << "Response: " << response << endl;
}
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- }
- delete payload;
}
- delete sc;
+ catch (AxisFault & e)
+ {
+ cout << endl << "Error: " << e << endl;
+ }
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/notify/notify.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/notify/notify.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/notify/notify.cpp (original)
+++ trunk/wsf/cpp/examples/clients/notify/notify.cpp Thu Feb 26 03:09:15 2009
@@ -25,33 +25,30 @@
int main()
{
- WSSOAPClient * sc = new \
WSSOAPClient("http://localhost:9090/axis2/services/notify");
- try
- {
- //sc->initializeClient("notify.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
+ WSSOAPClient sc("http://localhost:9090/axis2/services/notify");
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+
OMNamespace * ns = new OMNamespace("http://example.org/notify", "m");
OMElement * payload = new OMElement(NULL,"notify", ns);
payload->setText("notify5");
cout << endl << "Request: " << payload << endl;
- bool status = false;
+
try
{
- status = sc->send(payload, "http://example.org/action/notify");
+ bool status = sc.send(payload, "http://example.org/action/notify");
+ if (status)
+ {
+ cout << endl << "notify client invoke SUCCESSFUL!" << endl;
+ }
+ else
+ {
+ cout << endl << "notify client invoke FAILED!" << endl;
+ }
}
catch (AxisFault & e)
{
cout << endl << "Error: " << e << endl;
}
- if (status)
- {
- cout << endl << "notify client invoke SUCCESSFUL!" << endl;
- }
- delete sc;
+
+ delete payload;
}
Modified: trunk/wsf/cpp/examples/clients/yahoo/yahoo.cpp
URL: http://wso2.org/svn/browse/wso2/trunk/wsf/cpp/examples/clients/yahoo/yahoo.cpp?rev=31605&r1=31604&r2=31605&view=diff
==============================================================================
--- trunk/wsf/cpp/examples/clients/yahoo/yahoo.cpp (original)
+++ trunk/wsf/cpp/examples/clients/yahoo/yahoo.cpp Thu Feb 26 03:09:15 2009
@@ -25,42 +25,33 @@
int main()
{
- WSRESTClient * sc = new \
WSRESTClient("http://search.yahooapis.com/WebSearchService/V1/webSearch");
- try
- {
- //sc->initializeClient("yahoo_rest_search.log", AXIS2_LOG_LEVEL_TRACE);
- }
- catch (AxisFault & e)
- {
- cout << endl << "Error: " << e << endl;
- return 0;
- }
- sc->engageModule(AXIS2_MODULE_ADDRESSING);
- Options * op = sc->getOptions();
+ Process::initialize("yahoo_rest_search.log", AXIS2_LOG_LEVEL_TRACE);
+ WSRESTClient sc("http://search.yahooapis.com/WebSearchService/V1/webSearch");
+
+ sc.engageModule(AXIS2_MODULE_ADDRESSING);
+ Options * op = sc.getOptions();
op->setHTTPMethod(AXIS2_HTTP_GET);
- sc->setOptions(op);
+
+ OMElement * payload = new OMElement(NULL,"yahoo_rest_search", NULL);
+ OMElement * child1 = new OMElement(payload,"appid", NULL);
+ child1->setText("YahooDemo");
+ OMElement * child2 = new OMElement(payload,"query", NULL);
+ child2->setText("finance");
+
+ cout << endl << "Request: " << payload << endl;
+
+ try
{
- OMElement * payload = new OMElement(NULL,"yahoo_rest_search", NULL);
- OMElement * child1 = new OMElement(payload,"appid", NULL);
- child1->setText("YahooDemo");
- OMElement * child2 = new OMElement(payload,"query", NULL);
- child2->setText("finance");
- cout << endl << "Request: " << payload << endl;
- OMElement * response;
- try
- {
- response = sc->request(payload, "");
- if (response)
- {
- cout << endl << "Response: " << response << endl;
- }
- }
- catch (AxisFault & e)
+ OMElement * response = sc.request(payload, "");
+ if (response)
{
- cout << endl << "Error: " << e << endl;
+ cout << endl << "Response: " << response << endl;
}
- delete payload;
}
- delete sc;
+ catch (AxisFault & e)
+ {
+ cout << endl << "Error: " << e << endl;
+ }
+ delete payload;
}
_______________________________________________
Wsf-c-commits mailing list
Wsf-c-commits@wso2.org
https://wso2.org/cgi-bin/mailman/listinfo/wsf-c-commits
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic