Open neemo26 opened 10 years ago
' NOTE: If you change the interface name "IService" here, you must also update the reference to "IService" in Web.config. <ServiceContract()> _ Public Interface IService
<OperationContract()> _
Function GetData(ByVal value As Integer) As String
<OperationContract()> _
Function GetDataUsingDataContract(ByVal composite As CompositeType) As CompositeType
' TODO: Add your service operations here
End Interface
' Use a data contract as illustrated in the sample below to add composite types to service operations. <DataContract()> _ Public Class CompositeType
Private boolValueField As Boolean
Private stringValueField As String
<DataMember()> _
Public Property BoolValue() As Boolean
Get
Return Me.boolValueField
End Get
Set(ByVal value As Boolean)
Me.boolValueField = value
End Set
End Property
<DataMember()> _
Public Property StringValue() As String
Get
Return Me.stringValueField
End Get
Set(ByVal value As String)
Me.stringValueField = value
End Set
End Property
End Class
Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols Imports System.ComponentModel
Public Interface Interface1
End Interface
@Test @Rollback(false) public void testTotal() throws Exception { long total = authService.total(); assertEquals(TOTAL, total); }
@Test
@Rollback(false)
public void testList() throws Exception {
L.debug("id={}", id);
List<AuthorizedUser> users = authService.users(AuthService.LATEST, (int) id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
users = authService.users(AuthService.BLOCKED, (int) id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
users = authService.users(AuthService.ALL, (int) id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
}
Imports System.Web Imports System.Web.Services Imports System.Web.Services.Protocols
' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. ' <System.Web.Script.Services.ScriptService()> <WebService(Namespace:="http://tempuri.org/")> <WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile11)> <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Public Class WebService Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function HelloWorld() As String
Return "Hello World"
End Function
End Class
@Test
@Rollback(false)
public void testList2() throws Exception {
L.debug("id={}", id);
List
users = authService.users(AuthService.BLOCKED, (int) id, true, id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
users = authService.users(AuthService.BLOCKED, (int) id, false, id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
users = authService.users(AuthService.ALL, (int) id, true, id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
users = authService.users(AuthService.ALL, (int) id, false, id);
for (AuthorizedUser u : users) {
L.debug("uid: {}, name: {}", u.getId(), u.getAuthorizedName());
}
}
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8" ?>
' NOTE: If you change the class name "Service" here, you must also update the reference to "Service" in Web.config and in the associated .svc file. Public Class Service Implements IService
End Class