Performance Question and .... Please assist

M

Matthew Holton

Hello everyone,

I have a couple of questions. Please jump in and provide
your comments and views.

First, does the webservice not behave as a normal
webpage? Here is my reasoning:

I have a webservice with a method that increments
a session variable.

<WebMethod(EnableSession:=True)>Public Function
Increment() as Long
Dim iRet as long
iRet = clng(Session("MyNumber"))
iRet = iRet + 1
Session("MyNumber") = iRet
Return iRet
End Function

I have two clients

VB.Net Application that has a web reference to
this webservice.

Sub Button_Click(Object, Args)
Dim iAnswer as Long
Dim i as Long
Dim WS as MyWebservice.ServiceName
WS= New MyWebservice.ServiceName()
WS.Url
= "http://localhost/myservice/ServiceName.asmx"

For i = 1 to 100
iAnswer = ws.Increment()
debug.write("The answer was:" &
iAnswer.tostring())
'This always returns 1
Next i
End Sub

VB 6.0 Application using XML

Function Test() as Long
Dim iAnswer as Long
On Error GoTo Test_Error

Dim objXMLHeader As XMLDocument
Dim objHTTP As MSXML2.XMLHTTP
Dim strEnvelope As String

Set objXMLHeader = New XMLDocument
Set objHTTP = New MSXML2.XMLHTTP
strEnvelope = "<?xml version='1.0' encoding='utf-
8'?>"
strEnvelope = strEnvelope & "<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/'>"
strEnvelope = strEnvelope & " <soap:Body>"
strEnvelope = strEnvelope & " <Increment
xmlns='http://cname.mydomain.com/'>"
strEnvelope = strEnvelope & " </ Increment >"
strEnvelope = strEnvelope & " </soap:Body>"
strEnvelope = strEnvelope & "</soap:Envelope>"


objHTTP.Open "POST", "http://localhost/myservice/s
ervicename.asmx", False
Call objHTTP.setRequestHeader("Content-
Type", "text/xml")

objHTTP.setRequestHeader "SOAPAction", "http://loc
alhost/myservice/servicename.asmx/Increment"
objHTTP.send strEnvelope


'Do While Not objHTTP.readyState = 4
'Sleep 1
'Loop

Dim x As MSXML2.DOMDocument
Set x = New DOMDocument

If x.loadXML(objHTTP.responseText) Then
iAnswer = x.selectSingleNode
("soap:Envelope/soap:Body/IncrementResponse").nodeTypedVal
ue
End If
Test = iAnswer
'Always returns the next number
Exit Function

Test_Error:
End Function

Sub Button_Click()
debug.print test 'Always the next number
End Sub


I would have expected that the vb.net application would
have behave as expected and that the xml solution would
have been a new session as each time a connection was
created. I now expect that I have to tell the webservice
that I am done with it from the vb 6.0 application so
that it could call session.abandon. There goes a
security model. Am I missing something?

The second question is "Should I create a DCOM Component
or Webservice?". I have a need to create a component
that is accessable from vb 6.0 applications, vb.net
applications, and asp.net websites. The component is
required to cache information while instantiated to
reduce redundant calls to the database. Security is
managed internally with this component. All consumers of
this component will be on the LAN but I do not want to
have to manage dll's on each machine or the .Net security
configuration. If the answer is DCOM, where can I get
more information on building them in .Net?


Thanks in advance
 
M

Matthew Holton

It seems that remoting is a better approach to take for
robustness reasons, but it is less interoperable than a
webservice. Or is it?

Is it possible to access a service using SOAP and XML?
Does remoting not support interaction from VB 6.0 or C++
6.0.

Is it possible to create a managed code wrapper for a
remoted service for access via older platforms?


I guess I am in a pickle and need to consider not
using .Net webservices, but rather, traditional asp and
xml. At least then I know rules to the game (SOAP 1.1)
and I dont have to develop around sockets. Sheesh.

Input is greatly appreciated


Matthew Holton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top