Partial Class AddService
Inherits System.Web.UI.Page
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
AddService()
End Sub
Public Sub AddService()
' Add a new service to the existing publisher account. You must have a web reference added to
' the URL "https://sandbox.google.com/api/adsense/v2/AccountService?wsdl" and name the
' webreference as "AdSenseAccounts"
Dim accountService As New AdSenseAccounts.AccountServiceService()
' Set the headers before you call the service method.
' Set the developer account email
accountService.developer_emailValue = New AdSenseAccounts.developer_email()
accountService.developer_emailValue.Text = New String() {"developer7@google.com"}
' Set the develoepr account password
accountService.developer_passwordValue = New AdSenseAccounts.developer_password()
accountService.developer_passwordValue.Text = New String() {"devpass"}
' Set the client Id.
accountService.client_idValue = New AdSenseAccounts.client_id()
accountService.client_idValue.Text = New String() {txtClientId.Text}
Dim syndication As String = ddlAdType.SelectedValue
Try
accountService.addSyndicationService(syndication)
Response.Write("Service added successfully.")
Catch ex As System.Web.Services.Protocols.SoapException
Response.Write("<font color=red><B>" & ex.Message & "</B></font>")
End Try
End Sub
End Class