Click here to Skip to main content
15,899,313 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 8:37
sitebuilderLuc Pattyn5-May-10 8:37 
GeneralRe: Filesize Conversion Pin
riced5-May-10 9:54
riced5-May-10 9:54 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 10:33
sitebuilderLuc Pattyn5-May-10 10:33 
GeneralRe: Filesize Conversion Pin
riced5-May-10 10:49
riced5-May-10 10:49 
GeneralRe: Filesize Conversion Pin
Luc Pattyn5-May-10 12:20
sitebuilderLuc Pattyn5-May-10 12:20 
GeneralRe: Filesize Conversion Pin
riced5-May-10 22:09
riced5-May-10 22:09 
GeneralRe: Filesize Conversion Pin
Dayekh5-May-10 12:06
Dayekh5-May-10 12:06 
QuestionWeb Service Problems Pin
RobThompson5-May-10 0:25
RobThompson5-May-10 0:25 
Hi,

I'm new to the forums so apologies if I've posted this to the wrong section. Also pretty new to vb so if some of my terminology is off then please let me know.

I'm trying to develop an asp page that will take user submitted data and post it to a web service. The web service is hosted (and developed by) a third party.

I've created a reference to the web service in my project, and written the code to send the required data to the web service, but every time I send data I get a response back from the web service to say it is duplicate data and won't be processed. Having done what debugging my limited knowledge allows, it looks as though both the public property and private field for each class of the web service is being sent, one after the other, which is causing the duplicate data message.

I'm guessing I haven't correctly defined/coded something so can someone suggest where I may be going wrong please. Below is the code I'm using but let me know you need anything else.

Thanks
Rob.

Protected Sub button1_click() Handles Button1.Click

    Dim strResult As String
    Dim strResultErrorCode As String
    Dim strResultErrorId As String
    Dim strResultErrorMessage As String
    Dim strResultMessage As String

    Dim WebService As VWTestdrive.TestdriveService = New VWTestdrive.TestdriveService()

    Dim Request As New VWTestdrive.Request
    Dim Result As New VWTestdrive.Result

    Dim Customer As New VWTestdrive.Customer
    Dim Address As New VWTestdrive.Address
    Dim Phones() As VWTestdrive.Phone = New VWTestdrive.Phone() _
        {New VWTestdrive.Phone, New VWTestdrive.Phone, New VWTestdrive.Phone, New VWTestdrive.Phone}
    Dim HomePhone As New VWTestdrive.Phone
    Dim MobilePhone As New VWTestdrive.Phone
    Dim WorkPhone As New VWTestdrive.Phone
    Dim FaxPhone As New VWTestdrive.Phone
    Dim UnkPhone As New VWTestdrive.Phone

    Dim NextPurchase As New VWTestdrive.NextPurchase
    Dim Fleet As New VWTestdrive.Fleet
    Dim DataProtection As New VWTestdrive.DataProtection

    Dim Channels() As VWTestdrive.ContactChannel = New VWTestdrive.ContactChannel() _
        {New VWTestdrive.ContactChannel, New VWTestdrive.ContactChannel, New VWTestdrive.ContactChannel, New VWTestdrive.ContactChannel}
    Dim ChMail As New VWTestdrive.ContactChannel
    Dim ChEmail As New VWTestdrive.ContactChannel
    Dim ChSMS As New VWTestdrive.ContactChannel
    Dim ChPhone As New VWTestdrive.ContactChannel

    Dim CurrentVehicle As New VWTestdrive.CurrentVehicle
    Dim FutureVehicle As New VWTestdrive.FutureVehicle
    Dim Loyalty As New VWTestdrive.BrandLoyalty
    Dim VehicleRequests() As VWTestdrive.VehicleRequest = New VWTestdrive.VehicleRequest() _
        {New VWTestdrive.VehicleRequest, New VWTestdrive.VehicleRequest, New VWTestdrive.VehicleRequest, New VWTestdrive.VehicleRequest}

    Dim Campaign As New VWTestdrive.Campaign

    ' get credentials
    Dim Credentials As New NetworkCredential
    Credentials = ReturnCredentials(3)
    WebService.Credentials = Credentials

    'Try
    ' set customer data
    Customer.title = "Mr"
    Customer.firstName = "Duplicate"
    Customer.lastName = "Test"

    Customer.email = "test.test@test.com"

    ' need to test that db field is populated before adding to request object
    'HomePhone.type = VWTestdrive.PhoneType.Home
    'HomePhone.Value = ""
    MobilePhone.type = VWTestdrive.PhoneType.Mobile
    MobilePhone.Value = "07123456789"
    WorkPhone.type = VWTestdrive.PhoneType.Work
    WorkPhone.Value = "01234567890"
    'FaxPhone.type = VWTestdrive.PhoneType.Fax
    'FaxPhone.Value = ""
    'UnkPhone.type = VWTestdrive.PhoneType.Unspecified
    'UnkPhone.Value = ""

    ' need to add a loop here dependent on the number of numbers populated
    Phones(0).type = MobilePhone.type
    Phones(0).Value = MobilePhone.Value
    'Phones(0).preferred =
    'Phones(0).preferredSpecified =
    Phones(1).type = WorkPhone.type
    Phones(1).Value = WorkPhone.Value
    'Phones(1).preferred =
    'Phones(1).preferredSpecified =
    'Phones(2).type = HomePhone.type
    'Phones(2).Value = HomePhone.Value
    'Phones(2).preferred =
    'Phones(2).preferredSpecified =
    'Phones(3).type = FaxPhone.type
    'Phones(3).Value = FaxPhone.Value
    'Phones(3).preferred =
    'Phones(3).preferredSpecified =
    'Phones(3).type = UnkPhone.type
    'Phones(3).Value = UnkPhone.Value
    'Phones(3).preferred =
    'Phones(3).preferredSpecified =

    ' set address data
    Address.pafValidated = True
    Address.pafValidatedSpecified = True

    Address.type = VWTestdrive.AddressType.Residential
    Address.typeSpecified = True

    Address.houseNumber = "1"
    Address.houseName = ""
    Address.line1 = "Test Avenue"
    Address.line2 = ""
    Address.line3 = ""
    Address.line4 = "LONDON" ' map to town
    Address.line5 = "" ' map to county
    Address.postcode = "AA1 1AA"

    Customer.address = Address
    Customer.phones = Phones

    ' need to test that db field is populated before adding to request object
    ChMail.option = True
    ChMail.type = VWTestdrive.ChannelType.Whitemail
    ChEmail.option = True
    ChEmail.type = VWTestdrive.ChannelType.Email
    ChSMS.option = True
    ChSMS.type = VWTestdrive.ChannelType.SMS
    ChPhone.option = True
    ChPhone.type = VWTestdrive.ChannelType.Phone

    ' need to add a loop here dependent on the number of fields populated
    Channels(0).option = ChMail.option
    Channels(0).type = ChMail.type
    Channels(1).option = ChEmail.option
    Channels(1).type = ChEmail.type
    Channels(2).option = ChSMS.option
    Channels(2).type = ChSMS.type
    Channels(3).option = ChPhone.option
    Channels(3).type = ChPhone.type

    ' next purchase
    NextPurchase.date = "2009-08-25"
    NextPurchase.dateSpecified = True
    'NextPurchase.timeframeId =

    Fleet.responsibility = False
    Fleet.responsibilitySpecified = True
    'Fleet.size = "0"

    DataProtection.group = True
    DataProtection.thirdParty = True

    ' need to get modelcode from lookup
    CurrentVehicle.modelCode = "1J1" ' Golf
    CurrentVehicle.registration = "AA11 AAA"

    ' add future vehicle here

    Loyalty.previousOwner = True
    Loyalty.previousOwnerSpecified = True


    ' need to add loop for populating all possible brochures
    ' will also need to split brochure array into separate elements
    For i As Integer = 0 To 3
        Dim Vehicle As New VWTestdrive.VehicleRequest

        If i = 0 Then
            Vehicle.derivativeCode = "VW0302"
            Vehicle.type = VWTestdrive.VehicleRequestType.B
        ElseIf i = 1 Then
            Vehicle.derivativeCode = "VW0303"
            Vehicle.type = VWTestdrive.VehicleRequestType.B
        ElseIf i = 2 Then
            Vehicle.derivativeCode = "VW0302"
            Vehicle.type = VWTestdrive.VehicleRequestType.T
        ElseIf i = 3 Then
            Vehicle.derivativeCode = "VW0303"
            Vehicle.type = VWTestdrive.VehicleRequestType.B
        End If

        VehicleRequests(i).derivativeCode = Vehicle.derivativeCode
        VehicleRequests(i).type = Vehicle.type
    Next

    ' campaign
    Campaign.code = "UKVW-CE-VWINTERNET02"
    Campaign.source = "60"
    'Campaign.freePrizeDraws = ""

    ' set request data
    ' defaults

    ' customer
    Request.customer = Customer

    ' info
    Request.nextPurchase = NextPurchase
    Request.fleet = Fleet
    Request.dataProtection = DataProtection

    ' contact channels
    Request.futureContactChannels = Channels

    Request.currentVehicle = CurrentVehicle
    Request.brandLoyalty = Loyalty

    Request.vehicleRequests = VehicleRequests

    ' campaign
    Request.campaign = Campaign


    ' evaluate response codes
    Result.success = WebService.CallTestDrive(request:=Request).success
    strResult = Result.success.ToString
    UserMsgBox(strResult)

    Result.errors = WebService.CallTestDrive(Request).errors
    strResultErrorCode = Result.errors(0).errorCode.id.ToString
    strResultErrorId = Result.errors(0).id.ToString
    strResultErrorMessage = Result.errors(0).errorMessage.ToString
    strResultMessage = "Id: " & strResultErrorId & vbCrLf & _
                       "Code: " & strResultErrorCode & vbCrLf & _
                       "Message: " & strResultErrorMessage & vbCrLf
    UserMsgBox(strResultMessage)
    'Catch ex As Exception

    'End Try

End Sub

AnswerRe: Web Service Problems Pin
Wayne Gaylard5-May-10 2:21
professionalWayne Gaylard5-May-10 2:21 
AnswerRe: Web Service Problems Pin
Dave Kreskowiak5-May-10 4:16
mveDave Kreskowiak5-May-10 4:16 
QuestionConvert into Char Pin
Anubhava Dimri4-May-10 19:11
Anubhava Dimri4-May-10 19:11 
AnswerRe: Convert into Char Pin
Richard MacCutchan4-May-10 21:39
mveRichard MacCutchan4-May-10 21:39 
GeneralRe: Convert into Char Pin
Anubhava Dimri4-May-10 21:57
Anubhava Dimri4-May-10 21:57 
GeneralRe: Convert into Char Pin
Richard MacCutchan4-May-10 22:09
mveRichard MacCutchan4-May-10 22:09 
GeneralRe: Convert into Char Pin
Anubhava Dimri4-May-10 22:22
Anubhava Dimri4-May-10 22:22 
GeneralRe: Convert into Char Pin
The Man from U.N.C.L.E.4-May-10 22:38
The Man from U.N.C.L.E.4-May-10 22:38 
GeneralRe: Convert into Char Pin
Richard MacCutchan5-May-10 0:44
mveRichard MacCutchan5-May-10 0:44 
GeneralRe: Convert into Char Pin
supercat96-May-10 7:02
supercat96-May-10 7:02 
GeneralRe: Convert into Char Pin
Anubhava Dimri6-May-10 18:34
Anubhava Dimri6-May-10 18:34 
AnswerRe: Convert into Char [modified] Pin
Estys4-May-10 23:22
Estys4-May-10 23:22 
QuestionMessage Removed Pin
4-May-10 13:11
gmhanna4-May-10 13:11 
AnswerRe: SQL Update "Update requires a valid update command" Pin
Johan Hakkesteegt4-May-10 23:43
Johan Hakkesteegt4-May-10 23:43 
QuestionLooping through a repeater Pin
Dayekh4-May-10 6:18
Dayekh4-May-10 6:18 
Question3D app what choosing ? DirectX ? XNA ? SlimDX ? Pin
norrisMiou4-May-10 2:01
norrisMiou4-May-10 2:01 
AnswerRe: 3D app what choosing ? DirectX ? XNA ? SlimDX ? Pin
Dave Kreskowiak4-May-10 3:54
mveDave Kreskowiak4-May-10 3:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.