473,387 Members | 1,569 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,387 software developers and data experts.

WebClient generates exception: header must be modified using ...

The following code generates the exception shown below when I call
UploadData. I'm trying to call a WCF service using basicHTTP with a manually
generated Soap message. Am I on the right track with this code? Thanks!!

Code:

Dim recvDoc As New Xml.XmlDocument
recvDoc.LoadXml("<s:Envelope... Soap XML goes here")

Dim wc As New System.Net.WebClient()
With wc
Dim str() As Byte =
System.Text.Encoding.UTF8.GetBytes(recvDoc.OuterXm l)

.Encoding = System.Text.Encoding.UTF8
.Headers.Add(Net.HttpRequestHeader.ContentType, "text/xml")
.Headers.Add(Net.HttpRequestHeader.ContentLength,
str.GetLength(0).ToString)
.Headers.Add(Net.HttpRequestHeader.Accept, "*/*")
.Headers.Add(Net.HttpRequestHeader.KeepAlive, "1")

Dim respStr As String =
System.Text.Encoding.UTF8.GetString(wc.UploadData( "http://localhost/DevWcf/WcfSimpleTest/WcfSimpleTest.svc", str))

Dim respDoc As New Xml.XmlDocument
respDoc.LoadXml(respStr)
End With

Exception:
"This header must be modified using the appropriate property. Parameter
name: name"
Jun 22 '07 #1
0 3605

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

Similar topics

1
by: James Write | last post by:
Hi, I am using the webclient.downloadfile() method to download a file from a remote web server to the local harddrive. public CopyFile(string sSrcPath, string sDestPath) { WebClient oClient...
3
by: Manuel | last post by:
I have an asp page ("test.asp") that presents the data it receives from a post.When I try the following code, test.asp doesn't return the values (supposedly) posted to it. If I make a web page with...
8
by: DEWright_CA | last post by:
Why does WebClient.DownloadFile loose my completed path? Ok, I have a function in my app then when my button is clicked it checks to see if the files come from a local drive or a http address....
1
by: A.M-SG | last post by:
Hi, I have an aspx page at the web server that provides PDF documents for smart client applications. Here is the code in aspx page that defines content type: Response.ContentType =...
0
by: Jarod_24 | last post by:
I have some problems with using Net.WebClient This function of mine recieves an array with Urls, and Filenames, and is supposed to download all the files (binary files) that is listed in the...
6
by: Dave Starman | last post by:
Hello, I am trying to download web data into my current application. Failing many attempts I tried to run the sample from the MS Help files with no luck. If I create a new solution and put the...
0
by: Rlake | last post by:
I am having trouble with my ADSL router, so am writing a simple app to 'click' the Reset button on its HTML configuration page for me whenever the connection drops out. I am trying to send a...
4
by: Lehel Kovach | last post by:
I'm having a problem with the WebClient object. When I post data to certain sites, it will receive a command from the webserver (object moved) and continue to the next link by downloading that. ...
8
by: MaxMax | last post by:
Is it possible to tell to the WebClient to use an "automatic" encoding when doing DownloadString? The encoding of the connection is written in the header, so the WebClient should be able to sense...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...

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.