You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2004/06/28 07:55:55 UTC
cvs commit: ws-axis/c/tests/client/httpHeader/test8/rpc Makefile.am TestClient.cpp
roshan 2004/06/27 22:55:55
Added: c/tests/client/httpHeader/test4 Makefile.am
c/tests/client/httpHeader/test4/rpc Makefile.am
TestClient.cpp
c/tests/client/httpHeader/test5 Makefile.am
c/tests/client/httpHeader/test5/rpc Makefile.am
TestClient.cpp
c/tests/client/httpHeader/test7 Makefile.am
c/tests/client/httpHeader/test7/rpc Makefile.am
TestClient.cpp
c/tests/client/httpHeader/test8 Makefile.am
c/tests/client/httpHeader/test8/rpc Makefile.am
TestClient.cpp
Log:
test cases for set/get/remove HTTP headers
Revision Changes Path
1.1 ws-axis/c/tests/client/httpHeader/test4/Makefile.am
Index: Makefile.am
===================================================================
SUBDIRS = rpc
1.1 ws-axis/c/tests/client/httpHeader/test4/rpc/Makefile.am
Index: Makefile.am
===================================================================
bin_PROGRAMS = httpHeaderTest4RPC
SUBDIRS =
AM_CPPFLAGS = $(CPPFLAGS)
httpHeaderTest4RPC_SOURCES = TestClient.cpp ../../gen_src/rpc/InteropTestPortType.cpp ../../gen_src/rpc/SOAPStruct.cpp
httpHeaderTest4RPC_LDADD = $(LDFLAGS) -laxiscpp_client
INCLUDES = -I$(AXISCPP_HOME)/include
1.1 ws-axis/c/tests/client/httpHeader/test4/rpc/TestClient.cpp
Index: TestClient.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
*/
#include <string>
using namespace std;
#include "../../gen_src/rpc/InteropTestPortType.h"
#define ARRAYSIZE 2
int
main(int argc, char *argv[])
{
int x;
char buffer1[100];
char endpoint[256];
const char *server = "localhost";
const char *port = "80";
if (argc == 3)
{
server = argv[1];
port = argv[2];
}
printf("Usage :\n %s <server> <port>\n\n", argv[0]);
//sprintf(endpoint, "http://%s:%s/axis/base", server, port);
//endpoint for Axis CPP sample
sprintf(endpoint, "http://%s:%s/axis/base", server, port);
/*Set for HTTP transport */
InteropTestPortType ws(endpoint, APTHTTP);
//set HTTP headers
ws.setTransportProperty("Accept-Language", " da, en-gb;q=0.8, en;q=0.7");
ws.setTransportProperty("Accept-Language", " da, en-gb;q=0.8, en;q=0.7");
ws.setTransportProperty("Accept-Language", "lang2");
ws.setTransportProperty("Accept-Language", "lang2");
printf("Sending Requests to end point %s \n\n", endpoint);
printf("invoking echoString...\n");
//testing echoString
try {
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("Test trasport property accessors\n");
printf("First trasport key = %s\n", ws.getFirstTrasportPropertyKey());
printf("First trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
char *key = NULL;
int count = 1;
while (key = ws.getNextTrasportPropertyKey())
{
printf("Next trasport key = %s\n", key);
printf("Next trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
count++;
//test removal of last trasport property
if (count == 4)
ws.deleteCurrentTrasportProperty();
}
//test removing HTTP headers
ws.deleteTrasportProperty("Accept-Language", 1);
//now the request should not have these removed headers
try
{
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("HTTP Header test end\n");
return 0;
}
1.1 ws-axis/c/tests/client/httpHeader/test5/Makefile.am
Index: Makefile.am
===================================================================
SUBDIRS = rpc
1.1 ws-axis/c/tests/client/httpHeader/test5/rpc/Makefile.am
Index: Makefile.am
===================================================================
bin_PROGRAMS = httpHeaderTest5RPC
SUBDIRS =
AM_CPPFLAGS = $(CPPFLAGS)
httpHeaderTest5RPC_SOURCES = TestClient.cpp ../../gen_src/rpc/InteropTestPortType.cpp ../../gen_src/rpc/SOAPStruct.cpp
httpHeaderTest5RPC_LDADD = $(LDFLAGS) -laxiscpp_client
INCLUDES = -I$(AXISCPP_HOME)/include
1.1 ws-axis/c/tests/client/httpHeader/test5/rpc/TestClient.cpp
Index: TestClient.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
*/
#include <string>
using namespace std;
#include "../../gen_src/rpc/InteropTestPortType.h"
#define ARRAYSIZE 2
int
main(int argc, char *argv[])
{
int x;
char buffer1[100];
char endpoint[256];
const char *server = "localhost";
const char *port = "80";
if (argc == 3)
{
server = argv[1];
port = argv[2];
}
printf("Usage :\n %s <server> <port>\n\n", argv[0]);
//sprintf(endpoint, "http://%s:%s/axis/base", server, port);
//endpoint for Axis CPP sample
sprintf(endpoint, "http://%s:%s/axis/base", server, port);
/*Set for HTTP transport */
InteropTestPortType ws(endpoint, APTHTTP);
//set HTTP headers
ws.setTransportProperty("SOAPAction", "InteropBase#echoString");
printf("Sending Requests to end point %s \n\n", endpoint);
printf("invoking echoString...\n");
//testing echoString
try {
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("Test trasport property accessors\n");
printf("First trasport key = %s\n", ws.getFirstTrasportPropertyKey());
printf("First trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
char *key = NULL;
int count = 1;
while (key = ws.getNextTrasportPropertyKey())
{
printf("Next trasport key = %s\n", key);
printf("Next trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
count++;
}
//test removing HTTP headers
ws.deleteTrasportProperty("SOAPAction");
//now the request should not have these removed headers
try
{
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("HTTP Header test end\n");
return 0;
}
1.1 ws-axis/c/tests/client/httpHeader/test7/Makefile.am
Index: Makefile.am
===================================================================
SUBDIRS = rpc
1.1 ws-axis/c/tests/client/httpHeader/test7/rpc/Makefile.am
Index: Makefile.am
===================================================================
bin_PROGRAMS = httpHeaderTest7RPC
SUBDIRS =
AM_CPPFLAGS = $(CPPFLAGS)
httpHeaderTest7RPC_SOURCES = TestClient.cpp ../../gen_src/rpc/InteropTestPortType.cpp ../../gen_src/rpc/SOAPStruct.cpp
httpHeaderTest7RPC_LDADD = $(LDFLAGS) -laxiscpp_client
INCLUDES = -I$(AXISCPP_HOME)/include
1.1 ws-axis/c/tests/client/httpHeader/test7/rpc/TestClient.cpp
Index: TestClient.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
*/
#include <string>
using namespace std;
#include "../../gen_src/rpc/InteropTestPortType.h"
#define ARRAYSIZE 2
int
main(int argc, char *argv[])
{
int x;
char buffer1[100];
char endpoint[256];
const char *server = "localhost";
const char *port = "80";
if (argc == 3)
{
server = argv[1];
port = argv[2];
}
printf("Usage :\n %s <server> <port>\n\n", argv[0]);
//sprintf(endpoint, "http://%s:%s/axis/base", server, port);
//endpoint for Axis CPP sample
sprintf(endpoint, "http://%s:%s/axis/base", server, port);
/*Set for HTTP transport */
InteropTestPortType ws(endpoint, APTHTTP);
//set HTTP headers
ws.setTransportProperty("Accept-Language", NULL);
printf("Sending Requests to end point %s \n\n", endpoint);
printf("invoking echoString...\n");
//testing echoString
try {
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("Test trasport property accessors\n");
printf("First trasport key = %s\n", ws.getFirstTrasportPropertyKey());
printf("First trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
char *key = NULL;
int count = 1;
while (key = ws.getNextTrasportPropertyKey())
{
printf("Next trasport key = %s\n", key);
printf("Next trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
count++;
}
//test removing HTTP headers
ws.deleteTrasportProperty("Accept-Language");
//now the request should not have these removed headers
try
{
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("HTTP Header test end\n");
return 0;
}
1.1 ws-axis/c/tests/client/httpHeader/test8/Makefile.am
Index: Makefile.am
===================================================================
SUBDIRS = rpc
1.1 ws-axis/c/tests/client/httpHeader/test8/rpc/Makefile.am
Index: Makefile.am
===================================================================
bin_PROGRAMS = httpHeaderTest8RPC
SUBDIRS =
AM_CPPFLAGS = $(CPPFLAGS)
httpHeaderTest8RPC_SOURCES = TestClient.cpp ../../gen_src/rpc/InteropTestPortType.cpp ../../gen_src/rpc/SOAPStruct.cpp
httpHeaderTest8RPC_LDADD = $(LDFLAGS) -laxiscpp_client
INCLUDES = -I$(AXISCPP_HOME)/include
1.1 ws-axis/c/tests/client/httpHeader/test8/rpc/TestClient.cpp
Index: TestClient.cpp
===================================================================
/*
* Copyright 2003-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*
* @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
*/
#include <string>
using namespace std;
#include "../../gen_src/rpc/InteropTestPortType.h"
#define ARRAYSIZE 2
int
main(int argc, char *argv[])
{
int x;
char buffer1[100];
char endpoint[256];
const char *server = "localhost";
const char *port = "80";
if (argc == 3)
{
server = argv[1];
port = argv[2];
}
printf("Usage :\n %s <server> <port>\n\n", argv[0]);
//sprintf(endpoint, "http://%s:%s/axis/base", server, port);
//endpoint for Axis CPP sample
sprintf(endpoint, "http://%s:%s/axis/base", server, port);
/*Set for HTTP transport */
InteropTestPortType ws(endpoint, APTHTTP);
//set HTTP headers
ws.setTransportProperty(NULL, "lang2");
printf("Sending Requests to end point %s \n\n", endpoint);
printf("invoking echoString...\n");
//testing echoString
try {
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("Test trasport property accessors\n");
printf("First trasport key = %s\n", ws.getFirstTrasportPropertyKey());
printf("First trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
char *key = NULL;
int count = 1;
while (key = ws.getNextTrasportPropertyKey())
{
printf("Next trasport key = %s\n", key);
printf("Next trasport value = %s\n",
ws.getCurrentTrasportPropertyValue());
count++;
}
//test removing HTTP headers
ws.deleteTrasportProperty("Accept-Language");
//now the request should not have these removed headers
try
{
if (0 == strcmp(ws.echoString("hello world"), "hello world"))
printf("successful\n");
else
printf("failed\n");
}
catch(AxisException& e)
{
printf("%s\n", e.what());
}
catch(...)
{
printf("Unknown exception\n");
}
printf("HTTP Header test end\n");
return 0;
}