humer2000
asked on
Consuming WCF service from Classic ASP
Need a working code snippet to call WCF service from classic ASP 3.0, Thanks
ASKER
I downloaded the sample, there is no asp code inside !!! It's a C# Winform stuff.
I need an asp sample of callinng service contract from asp code
thanks for reply
I need an asp sample of callinng service contract from asp code
thanks for reply
See if the below helps you, its how to use the object as specified above. You can change it to adTypeText to get plain text from the object:
Function DownloadDatafeed(ByVal sURL)
Dim objXMLHTTP
Dim objStream
Const adTypeBinary = 1
Const adTypeText = 2
DownloadDatafeed = ""
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
Set objStream = Server.CreateObject("ADODB.Stream")
objXMLHTTP.Open "GET", sURL, False
objXMLHTTP.SetRequestHeader "Content-type", "text/html"
'On Error Resume Next
objXMLHTTP.Send
If Err.Number <> 0 Then
DownloadDatafeed = "Error: " & Err.Description
Else
'sDatafeed = objXMLHTTP.ResponseBody
sFilename = "Datafeed_" & Replace(Date, "/", "-") & ".txt"
objStream.Open
objStream.Type = adTypeBinary
objStream.Write objXMLHTTP.ResponseBody
objStream.SaveToFile Server.MapPath(sFilename)
objStream.Close
End If
Set objStream = Nothing
Set objXMLHTTP = Nothing
On Error Goto 0
End Function
Do you need code in C# or VB.NET?
C#
=====
ServiceReference.HelloCust omerClient ws = new ServiceReference.HelloCust omerClient ();
ServiceReference.Customer cust = new ServiceReference.Customer( );
cust.Firstname = "Bill";
cust.Lastname = "Smith";
Response.Write(ws.HelloFul lName(cust );
ws.Close();
HTH
Ashok
C#
=====
ServiceReference.HelloCust
ServiceReference.Customer cust = new ServiceReference.Customer(
cust.Firstname = "Bill";
cust.Lastname = "Smith";
Response.Write(ws.HelloFul
ws.Close();
HTH
Ashok
Do you need code in C# or VB.NET?
C#
=====
ServiceReference.HelloCust omerClient ws = new ServiceReference.HelloCust omerClient ();
ServiceReference.Customer cust = new ServiceReference.Customer( );
cust.Firstname = "Bill";
cust.Lastname = "Smith";
Response.Write(ws.HelloFul lName(cust ));
ws.Close();
HTH
Ashok
C#
=====
ServiceReference.HelloCust
ServiceReference.Customer cust = new ServiceReference.Customer(
cust.Firstname = "Bill";
cust.Lastname = "Smith";
Response.Write(ws.HelloFul
ws.Close();
HTH
Ashok
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Not so clear response I found another solution
http://code.msdn.microsoft.com/CallWCFfromASP
Uses the "MSXML2.ServerXMLHTTP" object to request the data.