Skip to content

Instantly share code, notes, and snippets.

@JohanObrink
Created February 21, 2013 13:39
Show Gist options
  • Save JohanObrink/5004788 to your computer and use it in GitHub Desktop.
Save JohanObrink/5004788 to your computer and use it in GitHub Desktop.
using System;
using Toyota.Api.KobraLeads.KobraWS;
namespace Toyota.Api.KobraLeads.Services
{
public class KobraLeadsService
{
public void GenerateLead(int recieverId, RecieverType recieverType, DateTime expiryDate, LeadType leadType = LeadType.TestDrive, string carType = CarType.PASSENGER_CAR, Priority priority = Priority.Hot)
{
var credentials = new KLSCredentials { userName = "username", password = "password" };
var client = new wsLeadsSoapClient();
var lead = new LeadsLead
{
// Required fields
// Retailer id OR zip code
ReceiverID = recieverId,
// Receivertype tells the system how to interpret
// the receiverID.
// 0 – As postalcode
// 1 – As LKFCode
// 2 – As DealerID
ReceiverType = (int)recieverType,
// Priority values
// 0 – No priority
// 1 – Hot (0-6 months)
// 2 – Medium (6-12 months)
// 3 – Cold (12 months +)
LeadsPriority = (int)recieverType,
// LEAD type values
// 0 – Unknown type
// 1 – Test Drive
// 2 – Interested
// 3 – Offer
// 4 – Brochure
// 5 - Other
LeadsType = (int)leadType,
// Lead expires
ExpireDate = expiryDate,
// Brand values
// TO – Toyota
// LQ - Lexus
Brand = "TO",
// KindOfCar values
// PB – Passenger car
// TR – Transport vehicle
// LB – Truck
KindOfCar = carType
};
client.createLeads(credentials, new[] { lead }, 1);
}
}
}
@JohanObrink
Copy link
Author

System.ServiceModel.FaultException: Ett autentieringsproblem uppstod.Kontrollera att användarnamn och lösenord är korrekt ifyllda i soapheadern som skickades med i anropet och att användaren som angavs har tillräcklig behörighet för att använda webservicen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment