Monday, March 14, 2011

How to invoke method for web services

From the previous post, this is to show you how easy you can invoke method from web services. The code below is very short just 3 lines. There are only few steps, 1st create object using Object class, then call the Activator class for creating instance of service.

//Invoke Method
Object obj = Activator.CreateInstance(service);
Object response = t.Invoke(obj, param1);

return response;

Please try to code this and if you have any questions please comment here and I would be very happy to answer your questions.

Dynamic Invocation in Wsdl Reader Class

This is one of important code in the AutoWS program, DynamicInvocation. I use this one than hybernating. You can see sample of the class and function below.

WsdlReader class:
DynamicInvocation

StringWriter stringWriter = new StringWriter(System.Globalization.CultureInfo.CurrentCulture);
Microsoft.CSharp.CSharpCodeProvider prov = new Microsoft.CSharp.CSharpCodeProvider();
prov.GenerateCodeFromNamespace(nameSpace, stringWriter, new CodeGeneratorOptions());

// Compile the assembly with the appropriate references
string[] assemblyReferences = new string[2] { "System.Web.Services.dll", "System.Xml.dll" };
CompilerParameters param = new CompilerParameters(assemblyReferences);
param.GenerateExecutable = false;
param.GenerateInMemory = true;
param.TreatWarningsAsErrors = false;
param.WarningLevel = 4;

CompilerResults results = new CompilerResults(new TempFileCollection());
results = prov.CompileAssemblyFromDom(param, codeCompileUnit);
Assembly assembly = results.CompiledAssembly;
service = assembly.GetType(sdName);

methodInfo = service.GetMethods();

next chapter I will write sample how to use this class in the AutoWS program.

Sunday, June 13, 2010

Connect to Web Services, Read WSDL for Service Method and Perform a Simple Testing

Connect to Web Services, Read WSDL for Service Method and Perform a Simple Testing:

Please follow step below:

1. Please start the AutoWS program.

2. at WSDL address. Please input WSDL address for example
http://www.aswinanand.com/sendsms.php?wsdl

3. Click button [Get WSDL] then the AutoWS will connect to the WSDL address and list out Web Services Method to the left windows.

4. You can select each Web Services Methods by click at them and then Parameters of each Web Service methods will be shown in the Parameters windows below.

5. You can select method to test by clicking at [Select Method] button.
This sample we will select sendSMSToMany method.














6. Click at button [Create Test Data] for creating test case. You also can input number of run e.g. 1,2, or you require. but for DBTest please leave it 0 first. We will use this option for Database testing which we will discuss later.

7. input value of each parameters on the right window.














8. Then you are ready for a simple Test click [Run Test] button in the middle to start your Test Cases.

9. The response will show on the response column and the Test and Evaluation Report will show on the window below.



Thursday, June 10, 2010

SOAP (Simple Object Access Protocal)


SOAP is a protocal for Web services that has a XML Structure according to the W3C standard.

AutoWS Web Services Testing Software Free Download











I am very pleased to share you my project the AutoWS: AutoWS Web Services Testing Software Free Download.

You can use this tool to test the Web Services and Datbase Updating by single test, script test by exel and pre-prepare data in excel format.
This tool also has ability to generate auto test script e.g. random number, duplicate and so on.
This tool has ability to load excel data for test script and run by just one click until finish all test cases.
Please try to download the AutoWS , install and testing. If you have any questions about using this software, please feel free to ask questions to me.
Please download AutoWS instaler from here (10MB) : http://www.eplenty.com/SharedDownload/AutoWS_Installer.zip
(including Software Manual)

AutoWS Features:
1. Convert WSDL and Translate and List out functions or web services for testing
2. Auto Web Services Testing and Manual Web Services Testing
3. Single Testing and/or Load Test Script from Excel File.
4. Test Script Generator - for Random, Range, Ladder or Duplication Test Value
5. Up to 9 Databases for Testing for Web services updates.
6. Save and store result in Excel File.
7. for more details please see in the AutoWS manual and you can apply testing for your own design.








Main Menu and Testing Windows

(1) Main Menu consists of File, Test, DBConnection and Help
Test - use for calling Web service Test or DBTest functions
DBConnect – use for creating connection with testing Databases

(2) Testing and Result Windows consist :
WSTest – use for Web Services Test
DBTest – use for Database Testing
DBView – use for display data in the databases and support for basic data filtering
Message – use for display messages from the AutoWS program to User

Web Services Software Testing Blog Introduction

I wrote this topic for sharing the software testing tools that I developed for my master degree project. I study in major Computer Science , NIDA institue, Thailand. I plan to share my study and the software program tools as well.

The web services software testing software developed with C# and I plan to share you all the source code and design.

Pichai S.
10-Jun-10