vineeth1 Absent Member.
Absent Member.
2729 views

Test a web service

Jump to solution

Can we test Soap web services in silk test(workbench) or should we use silk performer for that ?

Thanks

Tags (1)
0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Test a web service

Jump to solution

Hi!

To test SOAP services with the Silk Test Workbench you have multiple options:

Best regards,
Ralph

Tags (1)
0 Likes
3 Replies
Highlighted
Micro Focus Expert
Micro Focus Expert

RE: Test a web service

Jump to solution

Hi!

To test SOAP services with the Silk Test Workbench you have multiple options:

Best regards,
Ralph

Tags (1)
0 Likes
vineeth1 Absent Member.
Absent Member.

RE: Test a web service

Jump to solution

Thanks Ralph, Do you sample program or additional documentation for this.

Thanks in advance

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Test a web service

Jump to solution

Sure! Here’s how to do it using the tooling in Visual Studio, and then importing the generated client into the Silk Test Workbench:

Let’s use the demo web service from http://demo.borland.com as an example. The definition of this service is located at http://demo.borland.com/BorlandSampleService/BorlandSampleService.asmx and the WSDL is located at http://demo.borland.com/BorlandSampleService/BorlandSampleService.asmx?WSDL.

  1. Create a new Class Library project in Visual Studio. Whether you use C# or VB.NET doesn’t matter for our purpose.
  2. Click Add > Service Referencein the context menu to add a reference to the web service:

  3. Click Advanced in the Add Service Reference dialog and then click Add Web Reference in the Service Reference Settings dialog.
  4. In the Add Web Reference dialog, specify the location of the WSDL of the service:

    Note: The Web reference name that you specify here will later be used to call the service methods, so make sure that you remember this name.

    You should now see the service reference in the Web References section of the Solution Explorer:

  5. Click Build > Build Solution to compile the entire solution in Visual Studio and you are ready to import the resulting assembly into the Silk Test Workbench.
  6. In the Workbench, create a new .NET Script.
  7. Add an assembly reference to the DLL in the bin\Debug or bin\Release folder of the Visual Studio project. Also add a reference to the System.Web.Servicesassembly.

  8. Call your SOAP web service from the .NET script in the Workbench. For example, use the following code to call the “GetNowAsDate” service method:
    Imports SOAPClient.BorlandSampleService
    
    Public Module Main
    Dim _desktop As Desktop = Agent.Desktop
    
    Public Sub Main()
      Dim svc As New Service1()
    
      Dim result As DateTime
      result = svc.GetNowAsDate()
    
      Workbench.ResultComment(result)
    End Sub

    If you run that script, you will see how the Workbench calls the SOAP service and logs the service result into the run result:

  9. From here, you have the following options:
    • Turn the .NET script into a keyword and call it from keyword-driven tests. For additional information, see Recording a Keyword-Driven Test in Silk Test Workbench.
    • Call the .NET script directly from visual tests.
    • Integrate the .NET script with your other .NET scripts by adding .NET script references.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.