473,513 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling a .NET web service from classic ASP w/o soap tookit

Hi everyone! I'm hoping that someone can help me out. I have a
webservice written in vb.net. This service uses the SoapHeader to
secure the webservice to users that give a username and password. I am
trying to call this webservice via classic asp. This works as long as
the service is not authenticated. Here is the asp code:

response.write(GetHTML("http://www5dev.nau.edu/asd/webservices/randomchars/randomchars.asmx/Range?minLength=25&maxLength=35"))

Function GetHTML(strURL)
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
objXMLHTTP.Open "GET", strURL, False
objXMLHTTP.Send
strReturn = objXMLHTTP.responseText
Set objXMLHTTP = Nothing
GetHTML = strReturn
End Function

This call works great unless I try to call the service that requires
header information, I'm not sure how best to attach the header
information. I have tried passing the two variables (strUserName,
strPassword) in the querystring to the service:

response.write(GetHTML("http://www5dev.nau.edu/asd/webservices/tripledes/tripledes.asmx/Encrypt?strUserName=help&strPassword=please&plainT ext=test"))

This does not error, but it does not recognize the header information.

These services work great when being called via .net, the service is
fine (hopefully).

Any help would be greatly appreciated.

Ryan

Nov 19 '05 #1
3 5240
you are not using soap at all. you are using the html form interface the
asp.net webservices support (which is usually doabled for remote calls). to
pass a soap header you will need to pass a soap body. you can do this with
xmlhttp, but you will need to learn enough of the soap protocal to build the
right body, and pass the correct header.

-- bruce (sqlwork.com)
<ry*********@gmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
| Hi everyone! I'm hoping that someone can help me out. I have a
| webservice written in vb.net. This service uses the SoapHeader to
| secure the webservice to users that give a username and password. I am
| trying to call this webservice via classic asp. This works as long as
| the service is not authenticated. Here is the asp code:
|
|
response.write(GetHTML("http://www5dev.nau.edu/asd/webservices/randomchars/r
andomchars.asmx/Range?minLength=25&maxLength=35"))
|
| Function GetHTML(strURL)
| Dim objXMLHTTP, strReturn
| Set objXMLHTTP = Server.CreateObject("MSXML2.ServerXMLHTTP")
| objXMLHTTP.Open "GET", strURL, False
| objXMLHTTP.Send
| strReturn = objXMLHTTP.responseText
| Set objXMLHTTP = Nothing
| GetHTML = strReturn
| End Function
|
| This call works great unless I try to call the service that requires
| header information, I'm not sure how best to attach the header
| information. I have tried passing the two variables (strUserName,
| strPassword) in the querystring to the service:
|
|
response.write(GetHTML("http://www5dev.nau.edu/asd/webservices/tripledes/tri
pledes.asmx/Encrypt?strUserName=help&strPassword=please&plainT ext=test"))
|
| This does not error, but it does not recognize the header information.
|
| These services work great when being called via .net, the service is
| fine (hopefully).
|
| Any help would be greatly appreciated.
|
| Ryan
|
Nov 19 '05 #2
Thank you for the response Bruce! I am familiar enough with soap. It
is that I don't understand the interaction between the asp and
webservice. Here is my attempt using the xmlhttp object. I'm hoping
that you or someone else can give me further assistance.

This is the basic function:

function GetIt(strUrl)
Dim xmlhttp
Set xmlhttp=Server.CreateObject("MSXML2.ServerXMLHTTP" )
xmlhttp.open "GET",strUrl,false
xmlhttp.send
GetIt = xmlhttp.responseText
Set xmlhttp=nothing
end function

I then tried to send the username and password using this:

str = _
"<?xml version=""1.0""><soap:Envelope
xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""http://www.w3.org/2001/XMLSchema""
xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" & _
"<soap:Header>" & _
"<AuthHeader xmlns=""http://tempuri.org/TripleDES/TripleDES"">" & _
"<strUserName>my_uid</strUserName>" & _
"<strPassword>none_of_your_beezwax</strPassword>" & _
"</AuthHeader>" & _
"</soap:Header>" & _
"<soap:Body>" & _
"<Encrypt xmlns=""http://tempuri.org/TripleDES/TripleDES"">" & _
"<plainText>text</plainText>" & _
"</Encrypt>" & _
"</soap:Body>" & _
"</soap:Envelope>"

set x=Server.createObject("MSXML2.DOMDocument")
x.async=false
x.load str

(I got the xml from when I test the webservice, this seems to be the
format it would like)

and modifying this line:
xmlhttp.send

to be:
xmlhttp.send x

This did not work, it did not recognize the nodes in the xml (Missing
parameter: plainText).

I've also tried changing the line:

xmlhttp.send

to be:
xmlhttp.send xmlhttp.send
"strUserName=my_uid&strPassword=pass&plainText=tex t"

and get the same Missing parameter: plainText error

When I try to send the three arguments using the querystring, I get no
error, but it is not authenticating either . . .

At this point, I'm hoping that I am correct in my assumption that if
the web service call works correctly in asp.net, that the problem is
not with the webservice. I feel like I am floundering around . . .
Thanks again.

More help would be greatly appreciated.

Ryan

Nov 19 '05 #3
Oops, where I put:

xmlhttp.send xmlhttp.send

That should read:

xmlhttp.send
"strUserNamemy_uid&strPassword=none_of_your_beezwa x&plainText=text"
Thanks!
Ryan

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
26148
by: Keith E. | last post by:
Does any one know of resources or can you offer direction on how to use classic ASP as a web service client. I have found all kinds of stuff for the ASP.NET But, I need to be able tap into a...
4
6716
by: Julian Hershel | last post by:
Hi. I have a very simple web service that I am trying to call from a classic ASP page. The web service project and the ASP page are both on my development machine. That's the code of my web...
0
2233
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. ...
3
5047
by: Jerome Cohen | last post by:
AI am trying to call a third-party web service. this service expects an XML fragment that contains the request plus other parameter. adding the web reference created the syntax below(reference.vb)....
7
3072
by: Jorgen Haukland, Norway | last post by:
Hi, I have created a Java webservice which runs in IBM WebSphere appserver. I take the WSDL-file and create a VS.NET WinForm application and calls the service running on my PC and everything...
1
4015
by: jens Jensen | last post by:
Hello , i'm calling a webservice generated with oracle webservice java tools. I'm not able to add a web reference to a .net client the usual way with visual studio 2005. I was therefore...
1
2086
by: AnRonMor | last post by:
Currently I use the MS Soap Toolkit to expose some 20 or so com objects for use by classic asp pages, this has to be replaced as support is ending. I have found two proposed solutions below and...
0
1738
by: =?Utf-8?B?QWRhbUM=?= | last post by:
Hi, I'm wondering if you can help. We have a classic asp application that creates and posts some XML using the SOAP format to a .NET WebService. The WebService and the asp are on the same IIS...
2
203
by: Brock | last post by:
I have a classic textbook example of consuming a Web service. I'm using Visual Web Developer Express 2008 v9. I have a textbox, a listbox, and a button on my .aspx form. I'm trying to use the...
0
7265
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7539
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4751
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3240
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3228
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1605
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
807
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
461
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.