2
Answers

C# and XML : URGENT

DAVID

DAVID

16y
1.9k
1

 

The following is a sample HTTP POST request and response

POST /Suppliers/WebServices/InsertLeads.asmx/InsertLead HTTP/1.1
Host: apps.abcsite.com
Content-Type: application/x-www-form-urlencoded
Content-Length: length

 

SupplierID=string&SupplierPassword=string&FirstName=string&LastName=string&EmailAddress=string&CoAppFirstName=string&CoAppLastName=string&Address=string&City=string&State=string&PostalCode=string&HomePhone=string&WorkPhone=string&WorkPhoneExt=string&CurrentEmployer=string&YearsThere=string&Income=string&BestCallTime=string&OriginalLeadDate=string&ExternalLeadID=string&IPAddress=string&ExtraFields=string


I want the below code to return me in HTML format instead of XML.

 

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<returnMessage xmlns="http://www.abcsite.com/">
  <ErrorName>string</ErrorName>
  <ErrorDescription>string</ErrorDescription>
  <LeadID>string</LeadID>
  <ClientAvailable>boolean</ClientAvailable>
</returnMessage>

 

 

 

 

Here is one Instruction but I am asked to use this for C# , which I do not know :

 

This example assumes you have basic knowledge of how to use Visual Studio and the .NET Framework.  In this example, the web reference to the ABCSite web service has already been added under a single folder called ABCSite.  You would typically use this implementation when posting real time leads to our system via a form on one of your websites.  This example is written in C#.


ABCSite.InsertLeads dpRealTimeWS = new ABCSite.InsertLeads();


ABCSite.returnMessage dpReturnWS = new ABCSite.returnMessage();


dpReturnWS = dpRealTimeWS.InsertLead(

Request.Form["txtSupplierID"],Request.Form["txtSupplierPassword"], Request.Form["txtFirstName"], Request.Form["txtLastName"],

Request.Form["txtCoAppFirstName"], Request.Form["txtCoAppLastName"],

Request.Form["txtCity"], Request.Form["txtState"], Request.Form["txtPostalCode"], Request.Form["txtHomePhone"], Request.Form["txtWorkPhone"], Request.Form["txtWorkPhoneExt"], Request.Form["txtBestCallTime"], Request.Form["txtEmailAddress"], Request.Form["txtOriginalLeadDate"],Request.Form["txtExternalLeadID"], Request.Form["txtIPAddress"], Request.Form["txtExtraFields"]);


lblWSResponse.Text = dpReturnWS.ErrorName + "  " + dpReturnWS.ErrorDescription;

 

 

Answers (2)