Web Service calling application

R

Ryan McConnell

I intend having a program which can load the details of a remote web
service and call it and process the relevant retured value.
I'm not sure how to go about that.

One method i have been using to some success, was to call a web service
based on the local machine, as a http request for a specific method in
the web service.
eg.
' Setup the WebRequest instance
'eg(http://localhost/service1.asmx/service
req = WebRequest.Create(startaddress)

' Use POST since we' re sending data (/service)
req.Method = "POST"

'Call the service and finally close out connection
Dim sw As New StreamWriter(req.GetRequestStream())
sw.Close()
'get incoming response
rsp = req.GetResponse()

' Wrap the response stream with a text-based reader
Dim sr As New StreamReader(rsp.GetResponseStream())
'Read all the response to a string, which we will convet to xml
newxml = sr.ReadToEnd
newXdoc.LoadXml(newxml)




However this method above doesnt work for services on a machine other
than the local machine.

Any advice?


Thanks
ryan mcconnell
 
C

Cor

Hi Ryan,

I ask this because to make a webservice project in VB.net does in my opinion
not look what you did write, am I wrong or did you never try that. If not, I
would just start making a webservice project.

If you only have started the project you have already by deleting one ' a
Hello World application.

After that it is in my opinion only adding.

I do not know if you have already seen this, this is in my opinon a real
good walkthrough.

http://msdn.microsoft.com/library/d...atingDistributedWebApplicationWalkthrough.asp


Cor
 
G

Guest

Hi Cor

I follow the walk througths (same as the book come with Visual Studio .Net). However, run into two problems

I am able to create the web service AuthorsWebService with the connection and data adapter to a SQL server and dataset pointing to Authors table, and the window client AuthorsWinClient.

However, when I try to run the app by clicking the Load button on AuthorsWinClient, it came back with error message showing unable to login to "NT AUTHORITY\ANONYMOUS" and failed. I get arroud this by changing the following line in
web.config file:
<identify impersonate="true" />
to include the user name and password as
<identify impersonate="true" username="domain name\mylogin name" password="my password" /

Run the app again and another error message showing as
Client found response content type of "text/html; charset=utf-8, but expect "text/xml

and it failed. I try to lookup all the help and cannot found any clue what the message means and how to fix it. Can you help? And is there anyway to not specifying the userid and password in the web.config file, because I need different security level to be setup in the database by user group on my real application

I am running visual studion .Net 2003 on XP Pro. The IIS V5.1 running in another machine with XP Pro. SQL server is running on a third machine. All three machine are controlled by a domain server running active directory service

Many thanks

Luk

----- Cor wrote: ----

Hi Ryan

I ask this because to make a webservice project in VB.net does in my opinio
not look what you did write, am I wrong or did you never try that. If not,
would just start making a webservice project

If you only have started the project you have already by deleting one '
Hello World application

After that it is in my opinion only adding

I do not know if you have already seen this, this is in my opinon a rea
good walkthrough

http://msdn.microsoft.com/library/d...eatingDistributedWebApplicationWalkthrough.as


Co
 

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

Top