473,549 Members | 2,583 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.asm x/Range?minLength =25&maxLength=3 5"))

Function GetHTML(strURL)
Dim objXMLHTTP, strReturn
Set objXMLHTTP = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")
objXMLHTTP.Open "GET", strURL, False
objXMLHTTP.Send
strReturn = objXMLHTTP.resp onseText
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?strUser Name=help&strPa ssword=please&p lainText=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 5246
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*********@gm ail.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.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=3 5"))
|
| Function GetHTML(strURL)
| Dim objXMLHTTP, strReturn
| Set objXMLHTTP = Server.CreateOb ject("MSXML2.Se rverXMLHTTP")
| objXMLHTTP.Open "GET", strURL, False
| objXMLHTTP.Send
| strReturn = objXMLHTTP.resp onseText
| 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?strUser Name=help&strPa ssword=please&p lainText=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("M SXML2.ServerXML HTTP")
xmlhttp.open "GET",strUrl,fa lse
xmlhttp.send
GetIt = xmlhttp.respons eText
Set xmlhttp=nothing
end function

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

str = _
"<?xml version=""1.0"" ><soap:Envelo pe
xmlns:xsi=""htt p://www.w3.org/2001/XMLSchema-instance""
xmlns:xsd=""htt p://www.w3.org/2001/XMLSchema""
xmlns:soap=""ht tp://schemas.xmlsoap .org/soap/envelope/"">" & _
"<soap:Head er>" & _
"<AuthHeade r xmlns=""http://tempuri.org/TripleDES/TripleDES"">" & _
"<strUserName>m y_uid</strUserName>" & _
"<strPassword>n one_of_your_bee zwax</strPassword>" & _
"</AuthHeader>" & _
"</soap:Header>" & _
"<soap:Body >" & _
"<Encrypt xmlns=""http://tempuri.org/TripleDES/TripleDES"">" & _
"<plainText>tex t</plainText>" & _
"</Encrypt>" & _
"</soap:Body>" & _
"</soap:Envelope>"

set x=Server.create Object("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&strPasswor d=pass&plainTex t=text"

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_b eezwax&plainTex t=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
26153
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 web service from a ASP 3.0 as a client I have webservice on a IIS platform w/ the SOAP 3.0 kit installed and can talk to it via a VB 6 client.
4
6717
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 service: <WebService(Namespace:="http://tempuri.org/")> _ Public Class TextData Inherits System.Web.Services.WebService
0
2234
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. Any help would really be appreciated. Thx
3
5049
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). I changed the data type for the structure that contains the XML data from the default "String" to "xml.xmldocument" to enable easy filling of the...
7
3075
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 works fine. So I deploy the webservice on a remote machine (Linux box) and I get an error when calling the service. BUT: I can retrieve the WSDL and...
1
4023
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 provided with a set of Dll that implement the proxy needed to consume this web service. I'm now wrapping these dlls in a .Net webservice that can be...
1
2088
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 would appreciate any comments, particularly from somone who has done this before. Create a .net WS to expose the Com Objects >From searching the...
0
1739
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 server , which is IIS6.0. On first calling the WebService the asp page either hangs or returns Active Server Pages error 'ASP 0113' Script timed out...
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 http://developer.capeclear.com/files/GlobalWeather.wsdl as my Web reference which looks good so far. But my code has some what will assurably be obvious...
0
7527
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7459
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7967
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7485
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7819
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
5097
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3505
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3488
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1064
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.