473,659 Members | 2,920 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VB-Script in C#

Hi,

I would write the following code in C#.

set objHTTP = CreateObject("M sxml2.XMLHTTP")
objHTTP.open "POST", "http://url.com", False
objHTTP.setRequ estHeader "Content-Type", "text/xml; charset=utf-8"
objHTTP.setRequ estHeader "SOAPAction ", "urn:blabla#Lis tOfTitles"

objHTTP.send fullString

strReturn = objHTTP.respons eText

Can anybody help me, please?

Nov 17 '05 #1
3 3124
Hi ,

You can do it, but it's not the best option, the framework provides classes
to make a http request and get the response.

Take a look at WebRequest class.
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
<ma******@web.d e> wrote in message
news:11******** **************@ o13g2000cwo.goo glegroups.com.. .
Hi,

I would write the following code in C#.

set objHTTP = CreateObject("M sxml2.XMLHTTP")
objHTTP.open "POST", "http://url.com", False
objHTTP.setRequ estHeader "Content-Type", "text/xml; charset=utf-8"
objHTTP.setRequ estHeader "SOAPAction ", "urn:blabla#Lis tOfTitles"

objHTTP.send fullString

strReturn = objHTTP.respons eText

Can anybody help me, please?

Nov 17 '05 #2
Now, I have implemented this code in C#. It works without exceptions
but the response is empty. Is this an error of the web service?
When I execute the above code then the result isn't empty. I get a list
of titles back.

Another question: How can I implement the object ASync in
HttpWebRequest class? This is a parameter of XMLHTTP.open.

My code in C#:

HttpWebRequest requ =
(HttpWebRequest )HttpWebRequest .Create("http://url.com");
requ.Method = "POST";

requ.ContentTyp e = "text/xml; charset=utf-8";
requ.Headers.Ad d("SOAPAction ", "urn:blabla#Lis tOfTitles");

requ.ContentLen gth = fullstr.Length;
StreamWriter sw = new StreamWriter(re qu.GetRequestSt ream());

sw.Write(fullst r);
sw.Close();

HttpWebResponse resp = (HttpWebRespons e) requ.GetRespons e();
StreamReader myStreamReader = new
StreamReader(re sp.GetResponseS tream());

myStreamReader. ReadToEnd();
myStreamReader. Close();
resp.Close();

Nov 17 '05 #3
I have found the error and the call to the web servie works fine.
Instead of 'myStreamReader .ReadLine()' I had written
'myStreamReader .ReadToEnd()'. The response of web service is the right
result.
ma******@web.de schrieb:
Now, I have implemented this code in C#. It works without exceptions
but the response is empty. Is this an error of the web service?
When I execute the above code then the result isn't empty. I get a list
of titles back.

Another question: How can I implement the object ASync in
HttpWebRequest class? This is a parameter of XMLHTTP.open.

My code in C#:

HttpWebRequest requ =
(HttpWebRequest )HttpWebRequest .Create("http://url.com");
requ.Method = "POST";

requ.ContentTyp e = "text/xml; charset=utf-8";
requ.Headers.Ad d("SOAPAction ", "urn:blabla#Lis tOfTitles");

requ.ContentLen gth = fullstr.Length;
StreamWriter sw = new StreamWriter(re qu.GetRequestSt ream());

sw.Write(fullst r);
sw.Close();

HttpWebResponse resp = (HttpWebRespons e) requ.GetRespons e();
StreamReader myStreamReader = new
StreamReader(re sp.GetResponseS tream());

myStreamReader. ReadToEnd();
myStreamReader. Close();
resp.Close();


Nov 17 '05 #4

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

Similar topics

16
486
by: Terry | last post by:
Hi, I need some feedback. We are converting to .Net and we are trying to decide on whether to use VB.net or C#.net. As far as our current systems, they will probably be rewritten in ASP.Net. I have looked into both and I don't see anything that would scream out to use one or the other. So at this point, it is still a toss up. However, I want to look at the two languages from a different perspective. That is from a career point of view....
7
1801
by: Simon Peng | last post by:
-- ---------------- Simon Peng xqpeng@tsinghua.org.cn
5
2527
by: Saga | last post by:
Hi all, I just read the thread by the same name posted on Jun 15, 9:45 AM, but I am looking at it from a different point of view. I came across this question in terms of functionality. Are VB and C# (.NET) really functionally equivalent? I had read that although they are very similar, C# does extend functionality further than VB.NET; however, when I searched for pages regarding this, I could not find any.
13
5146
by: Arsalan | last post by:
Is there any advantage in C# over VB.NET ? Or the difference is only syntax ? Can anything done in C# which cannot be done in VB.NET?
72
3443
by: Robin Tucker | last post by:
I need to find some documents/research for my manager about VB.NET v C# use. I've noticed that there are many more people using C# than VB.NET, that there seem to be more job vacancies specifying C# and projects written with it. I would basically like any links you might have to articles with non-anecdotal evidence for usage patterns, if there are any. Thanks,
28
2437
by: Andy | last post by:
Any good resources regarding benefitis by using C3 over VB? /Andy
34
3145
by: Eric Wise | last post by:
Does anyone work for companies that actually implement both VB and C#? I know that you can do this in theory, I just find it hard to imagine that a company would split its programming technologies like that. Of course now with the CLR there doesn't seem to be any performance benefit to using C# over VB, and VB I think is an "easier" language to pick up. I actually wonder if the salaries between vb.net and c# will balance out a little...
182
7492
by: Jim Hubbard | last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
25
1815
by: Sharrukin Amiri | last post by:
Hello, I am using VB 6.0 for many years. Everytime I needed to build software applications, I just opened VB 6.0 and started coding. I am now looking VB.NET Express Edition and I find I can no longer do this very easily. I find that there is too much copy and paste of code in order to get an app running. I also find it slow. Is it me or I am missing something? Here is a sample of my coding which you could find at: ...
0
8428
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8335
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
8747
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8627
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7356
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
6179
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
5649
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();...
1
2752
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
2
1737
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.