473,396 Members | 1,892 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Web Service SOAP Question

i have created a web service with one method which returns a code. i
am currently trying to access the return value of this method through
a page which has not got the proxy.dll referenced. i.e. as if this
request is from an external company. at the moment my method is
returning the whole SOAP return message as a string. 2 questions
please:

1. how do i just get the value of the node CLIENTCODE. this is the
return parameter of my web service method so this is all i am
interested in, not the whole SOAP message.

2. my code below does not use the SoapExtension class. is my code
below wrong? is there a better way to send and receive data using
SOAP?

here is my method:

XmlDocument doc = new XmlDocument();
doc.Load(xmlfile);
HttpWebRequest req = (HttpWebRequest)
WebRequest.Create(@"http://localhost/test/webservicebridge/bridgeservice.asmx");
if (proxy != null)
req.Proxy = new WebProxy(proxy, true);
req.Headers.Add("SOAPAction",
@"http://localhost/webservices/GetClientCode");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
string s = (r.ReadToEnd());

Nov 18 '05 #1
2 2293
You're going to a lot of unnecessary trouble here. The .Net platform has
built-in functionality for consuming Web Services. Basically, a Web Service
is a remote method call. A .Net method returns an object, whether that
object is a string, an integer, a class, or any other data type. In other
words, a Web Service returns an object in the same way that any other method
returns an object. The only difference is that the return value of a Web
Method is serialized. You de-serialize it back into an object. However, the
..Net framework has built-in functionality for doing this transparently. The
following is an MSDN article which demonstrates consuming a DataSet from a
Web Service. Note, however, that the return type isn't important. The
methodology is the same:

http://msdn.microsoft.com/library/de...webservice.asp

If you have Visual Studio.Net, creating your proxy is rather simple to do as
well. It is done by adding a Web Reference to your References. Visual
Studio.Net will build the proxy for you.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.

"Wee Bubba" <ma***********@yahoo-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
i have created a web service with one method which returns a code. i
am currently trying to access the return value of this method through
a page which has not got the proxy.dll referenced. i.e. as if this
request is from an external company. at the moment my method is
returning the whole SOAP return message as a string. 2 questions
please:

1. how do i just get the value of the node CLIENTCODE. this is the
return parameter of my web service method so this is all i am
interested in, not the whole SOAP message.

2. my code below does not use the SoapExtension class. is my code
below wrong? is there a better way to send and receive data using
SOAP?

here is my method:

XmlDocument doc = new XmlDocument();
doc.Load(xmlfile);
HttpWebRequest req = (HttpWebRequest)
WebRequest.Create(@"http://localhost/test/webservicebridge/bridgeservice.asm
x"); if (proxy != null)
req.Proxy = new WebProxy(proxy, true);
req.Headers.Add("SOAPAction",
@"http://localhost/webservices/GetClientCode");
req.ContentType = "text/xml;charset=\"utf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestStream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse();
stm = resp.GetResponseStream();
StreamReader r = new StreamReader(stm);
string s = (r.ReadToEnd());

Nov 18 '05 #2
"Wee Bubba" <ma***********@yahoo-dot-com.no-spam.invalid> wrote in message
news:41**********@Usenet.com...
here is my method:


Aren't you using Visual Studio? If you are, there's really no need for you
to do any of this, as it's all taken care of for you...
Nov 18 '05 #3

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

Similar topics

1
by: Liza | last post by:
Hello, can you guys help me out here....? this is part of my masters degree and hence is very important to me..... my supervisor doesn't seem to be too interested in helping me and infact is...
9
by: Marty McDonald | last post by:
If I invoke a web service, and it throws an exception, I can see the exception if the client app is a .Net app. However, if the client app is not a .Net app, I only receive the HTTP 500 error. I...
2
by: Paul Hale | last post by:
I have a vb.net web service and client that are both working fine. If someone wanted to consume our web service using .NET, no problem. Im a little confused on how non .NET clients would use the...
3
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
by: David Laub | last post by:
I've also posted this issue to a Sun/java formum, but since it appears to be an integration issue, this may be the better place to posr: I have written a dot net/c# Web Services doesn't fully...
1
by: William | last post by:
I have a few questions. First, I have a java webservice, which was developed using the Java Webserices Developer Pack 1.3. Here is the wsdl for the service. (Note: That this service is not exposed...
1
by: BeckyB00 | last post by:
Slightly different situation from the question of the 11/18/05 but the same error. (I'm just learning about web services so this is based on a 'quick tutorial') I'm running a web service using...
5
by: ayaz.usman | last post by:
Hi, I've built a web services proxy server, in C# using wsdl.exe, by importing wsdl. Howeever, when I go to : http://localhost/sample.asmx?wsdl, they wsdl there does not match the wsdl I fed...
10
by: Mike Schilling | last post by:
I've created a simple .NET 1.1 web service using VS.NET 2003: it has one method that takes a string parameter. It iterates through the input string, turning each character into hex and appending...
3
by: Enda Manni | last post by:
Hi, I have a gSoap Web Service written using C++, it uses SOAP username and password authentication. I also have a C# form client consuming the web service, all this was working fine until...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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...
0
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
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...
0
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...
0
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...

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.