J
jason
Newbie question.
I wrote a very simple .net web service and consumed it with remote
..aspx after compiling the output of the wsdl produced .vb to .dll
file. It works as expected.
Question - Can I access that webservice from dos with standalone exe
file (no dll on the client). The run of the exe would then display the
returning string. If so, how?
=======================
The Service:
<%@ WebService Language="vb" Class="nws1.cws1" %>
Imports System
Imports System.Web
Imports System.Web.Services
Imports System.Data
Imports System.Text.RegularExpressions
Namespace nws1
Public Class xxx1
Inherits WebService
<WebMethod()> Public Function yyy1 As String
dim x as string
x = "Hello Web Service"
Return x
End Function
End Class
End Namespace
====================
The client .aspx :
<%@ Page language="vb"%>
<%@ Import Namespace="nnn1" %>
<HTML>
<BODY>
<script language="vb" runat="server">
Public Sub Page_Load(sender As [Object], e As EventArgs)
Dim mystring As string
mystring = new nnn1.xxx1().yyy1()
response.write(mystring)
End Sub
</script>
</BODY>
</HTML>
=====================
My wild (no vb sense) attempt at writing the vb code (a modification
of the wsdl output file which is intended for the DLL):
Option Explicit On
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="xxx1Soap",
[Namespace]:="http://tempuri.org/")> _
Public Class xxx1
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/fws1",
RequestNamespace:="http://tempuri.org/",
ResponseNamespace:="http://tempuri.org/",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_
shared Sub Main
dim xx as new xxx1()
xx.Url = "http://111.222.333.444/yy1.asmx"
Dim results() As Object = xx.Invoke("yyy1", New Object(-1)
{})
dim x as string
x = CType(results(0),String)
System.Console.WriteLine(x)
End sub
Public Function Beginyyy1(ByVal callback As
System.AsyncCallback, ByVal asyncState As Object) As
System.IAsyncResult
Return me.BeginInvoke("yyy1", New Object(-1) {}, callback,
asyncState)
End Function
Public Function Endyyy1(ByVal asyncResult As
System.IAsyncResult) As String
Dim results() As Object = me.EndInvoke(asyncResult)
Return CType(results(0),String)
End Function
End Class
====
The above compiles cleanly, but produces runtime errors. Please
disregard exact code and messages as some items are being masked for
security reasons.
Unhandled Exception: System.ArgumentException: yyy1 Web Service method
name is n
ot valid.
at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRe
quest request, String methodName, Object[] parameters)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodN
ame, Object[] parameters)
at xxx1.Main()
====
Another option is to keep the working client dll and write a console
VB code to use it. That's fine too, but don't know how either.
Any help or information is greatly appreciated.
My goal is to be able to test info from a web service in a remote DOS
stript. I presume I should be able to do this right?
I wrote a very simple .net web service and consumed it with remote
..aspx after compiling the output of the wsdl produced .vb to .dll
file. It works as expected.
Question - Can I access that webservice from dos with standalone exe
file (no dll on the client). The run of the exe would then display the
returning string. If so, how?
=======================
The Service:
<%@ WebService Language="vb" Class="nws1.cws1" %>
Imports System
Imports System.Web
Imports System.Web.Services
Imports System.Data
Imports System.Text.RegularExpressions
Namespace nws1
Public Class xxx1
Inherits WebService
<WebMethod()> Public Function yyy1 As String
dim x as string
x = "Hello Web Service"
Return x
End Function
End Class
End Namespace
====================
The client .aspx :
<%@ Page language="vb"%>
<%@ Import Namespace="nnn1" %>
<HTML>
<BODY>
<script language="vb" runat="server">
Public Sub Page_Load(sender As [Object], e As EventArgs)
Dim mystring As string
mystring = new nnn1.xxx1().yyy1()
response.write(mystring)
End Sub
</script>
</BODY>
</HTML>
=====================
My wild (no vb sense) attempt at writing the vb code (a modification
of the wsdl output file which is intended for the DLL):
Option Explicit On
Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization
<System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Web.Services.WebServiceBindingAttribute(Name:="xxx1Soap",
[Namespace]:="http://tempuri.org/")> _
Public Class xxx1
Inherits System.Web.Services.Protocols.SoapHttpClientProtocol
<System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/fws1",
RequestNamespace:="http://tempuri.org/",
ResponseNamespace:="http://tempuri.org/",
Use:=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)>
_
shared Sub Main
dim xx as new xxx1()
xx.Url = "http://111.222.333.444/yy1.asmx"
Dim results() As Object = xx.Invoke("yyy1", New Object(-1)
{})
dim x as string
x = CType(results(0),String)
System.Console.WriteLine(x)
End sub
Public Function Beginyyy1(ByVal callback As
System.AsyncCallback, ByVal asyncState As Object) As
System.IAsyncResult
Return me.BeginInvoke("yyy1", New Object(-1) {}, callback,
asyncState)
End Function
Public Function Endyyy1(ByVal asyncResult As
System.IAsyncResult) As String
Dim results() As Object = me.EndInvoke(asyncResult)
Return CType(results(0),String)
End Function
End Class
====
The above compiles cleanly, but produces runtime errors. Please
disregard exact code and messages as some items are being masked for
security reasons.
Unhandled Exception: System.ArgumentException: yyy1 Web Service method
name is n
ot valid.
at System.Web.Services.Protocols.SoapHttpClientProtocol.BeforeSerialize(WebRe
quest request, String methodName, Object[] parameters)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String
methodN
ame, Object[] parameters)
at xxx1.Main()
====
Another option is to keep the working client dll and write a console
VB code to use it. That's fine too, but don't know how either.
Any help or information is greatly appreciated.
My goal is to be able to test info from a web service in a remote DOS
stript. I presume I should be able to do this right?