473,606 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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(xmlfil e);
HttpWebRequest req = (HttpWebRequest )
WebRequest.Crea te(@"http://localhost/test/webservicebridg e/bridgeservice.a smx");
if (proxy != null)
req.Proxy = new WebProxy(proxy, true);
req.Headers.Add ("SOAPAction ",
@"http://localhost/webservices/GetClientCode") ;
req.ContentType = "text/xml;charset=\"u tf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestS tream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse ();
stm = resp.GetRespons eStream();
StreamReader r = new StreamReader(st m);
string s = (r.ReadToEnd()) ;

Nov 18 '05 #1
2 2306
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(xmlfil e);
HttpWebRequest req = (HttpWebRequest )
WebRequest.Crea te(@"http://localhost/test/webservicebridg e/bridgeservice.a sm
x"); if (proxy != null)
req.Proxy = new WebProxy(proxy, true);
req.Headers.Add ("SOAPAction ",
@"http://localhost/webservices/GetClientCode") ;
req.ContentType = "text/xml;charset=\"u tf-8\"";
req.Accept = "text/xml";
req.Method = "POST";
Stream stm = req.GetRequestS tream();
doc.Save(stm);
stm.Close();
WebResponse resp = req.GetResponse ();
stm = resp.GetRespons eStream();
StreamReader r = new StreamReader(st m);
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
1961
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 on holiday as we speak. ok here's my question.....
9
4189
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 believe this is due mostly to the fact that the non-.Net apps are using POST instead of SOAP. If the non-.Net apps were using SOAP, they too would in fact "see" the exception. Is this true? Thanks!
2
15433
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 web service though. Question 1: Does Java etc have some kind of SOAP tool kit developers could use to access our web service? Question 2: .NET conveniently shows what the serialized xml looks like and what the web service expects (Please see...
3
5055
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 data. my client code creates an XML document class, fills the data using standard xml dom...
7
7098
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 work with J2ME client a) c# web service works with c# WIndows Client (local & remote web service) b) c# web service works with J2ME client - when the Web Service is local c) c# web service fails with J2ME client - when the Web Service is remote ...
1
3306
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 publicly.) <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.xxx.com/im/webservices/"
1
3660
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 Axis and want to consume it with a .NET client. So I've created the web proxy using wsdl.exe and I can call the service and it responds but the client returns null. If I run a Java client then it gets the response fine and dandy. The web service...
5
12707
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 into wsdl.exe. Why is this? Is there something I can do to make the input and output wsdl match?
10
3109
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 it to an output string, and returns the result. I now send this service SOAP messages containing non-ASCII characters in the field that becomes the input string. Each SOAP message has an XML header that correctly describes the format of the...
3
16309
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 I added the authentication on the server, now I can not get the client to authenticate. Can someone tell me how to add authentication info to the SOAP message posted from the C# SOAP client.
0
7978
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8461
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8126
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
6796
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5987
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5470
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3948
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2454
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1313
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.