By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,662 Members | 1,052 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,662 IT Pros & Developers. It's quick & easy.

Parameters xmldata, $filestream and $filedata are all missing error

P: n/a
Hi,

With the following code, I have created a web request to a url which I
am making a HTML POST with the html page request.htm, even though it
makes a HTML POST, the StreamReader produces a XML response error
shown after the code, with the description "Parameters xmldata,
$filestream and $filedata are all missing. One of these must not be
null."

Any suggestions in how to resolve this error?

Many thanks,

Hon

WebRequest request = WebRequest.Create("********************");
NetworkCredential networkCredential;
string username = "*****", password = "*********";

private string sendRequestToCOLT()
{
try
{
// create reader and open file.
StreamReader re = File.OpenText(@"request.htm");

// read a lines of text
string text = "", input = null;
while ((input = re.ReadLine()) != null)
{
input = input + "\n";
text = text + input;
}
byte[] byteArray = Encoding.UTF8.GetBytes(text);
networkCredential = new NetworkCredential(username,
password);
request.Credentials = networkCredential;
request.Method = "POST";
request.ContentLength = byteArray.Length;
request.ContentType = "application/x-www-form-
urlencoded";
Stream dataStream = request.GetRequestStream();
dataStream.Write(byteArray, 0, byteArray.Length);
dataStream.Close();
WebResponse response = request.GetResponse();
StreamReader reader = new
StreamReader(response.GetResponseStream());
string result = reader.ReadToEnd();
response.Close();
return result;;
}
catch (Exception e)
{
messageTextBox.Text = "EXCEPTION ERROR: " +
e.Message.ToString();
return null;
}
}

---------------------------------------------------------------------------------------------------------------------------------------------------------

<xml version="1.0"?>

<Acknowledgement>

<versionOfXmlSchema>1.0</versionOfXmlSchema>

<receiverSystem>B2BGateway</receiverSystem>

<receiverId>B2BGateway</receiverId>

<receiveTime>20070710-16:08:32</receiveTime>

<senderId>Unknown</senderId>

<senderTime>20070710-16:08:32</senderTime>

<dateMessage></dateMessage>

<message>

<messageType>B2BGateway</messageType>

<messageCode>-1</messageCode>

<messageDescription>com.wm.app.b2b.server.ServiceE xception: [ISS.
0086.9091] Parameters xmldata, $filestream and $filedata are all
missing. One of these must not be null.

at pub.xml.xmlStringToXMLNode(xml.java:523)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)

at
sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:
85)

at
sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:
58)

at
sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:
60)

at java.lang.reflect.Method.invoke(Method.java:391)

at com.wm.app.b2b.server.JavaService.baseInvoke(JavaS ervice.java:
322)

at
com.wm.app.b2b.server.invoke.InvokeManager.process (InvokeManager.java:
612)

at
com.wm.app.b2b.server.invoke.StatisticsProcessor.p rocess(StatisticsProcessor.java:
44)

at
com.wm.app.b2b.server.invoke.ServiceCompletionImpl .process(ServiceCompletionImpl.java:
235)

at
com.wm.app.b2b.server.invoke.ValidateProcessor.pro cess(ValidateProcessor.java:
49)

at com.wm.app.b2b.server.ACLManager.process(ACLManage r.java:198)

at
com.wm.app.b2b.server.invoke.DispatchProcessor.pro cess(DispatchProcessor.java:
39)

at
com.wm.app.b2b.server.AuditLogManager.process(Audi tLogManager.java:
411)

at
com.wm.app.b2b.server.invoke.InvokeManager.invoke( InvokeManager.java:
521)

at
com.wm.app.b2b.server.invoke.InvokeManager.invoke( InvokeManager.java:
369)

at
com.wm.app.b2b.server.ServiceManager.invoke(Servic eManager.java:246)

at com.wm.app.b2b.server.BaseService.invoke(BaseServi ce.java:
168)

at com.wm.lang.flow.FlowInvoke.invoke(FlowInvoke.java :324)

at com.wm.lang.flow.FlowState.invokeNode(FlowState.ja va:581)

at com.wm.lang.flow.FlowState.step(FlowState.java:438 )

at com.wm.lang.flow.FlowState.invoke(FlowState.java:4 03)

at com.wm.app.b2b.server.FlowSvcImpl.baseInvoke(FlowS vcImpl.java:
982)

at
com.wm.app.b2b.server.invoke.InvokeManager.process (InvokeManager.java:
612)

at
com.wm.app.b2b.server.invoke.StatisticsProcessor.p rocess(StatisticsProcessor.java:
44)

at
com.wm.app.b2b.server.invoke.ServiceCompletionImpl .process(ServiceCompletionImpl.java:
235)

at
com.wm.app.b2b.server.invoke.ValidateProcessor.pro cess(ValidateProcessor.java:
49)

at com.wm.app.b2b.server.ACLManager.process(ACLManage r.java:198)

at
com.wm.app.b2b.server.invoke.DispatchProcessor.pro cess(DispatchProcessor.java:
39)

at
com.wm.app.b2b.server.AuditLogManager.process(Audi tLogManager.java:
411)

at
com.wm.app.b2b.server.invoke.InvokeManager.invoke( InvokeManager.java:
521)

at
com.wm.app.b2b.server.invoke.InvokeManager.invoke( InvokeManager.java:
369)

at
com.wm.app.b2b.server.ServiceManager.invoke(Servic eManager.java:246)

at
com.wm.app.b2b.server.comm.DefaultServerRequestHan dler.handleMessage(DefaultServerRequestHandler.jav a:
129)

at
com.wm.app.b2b.server.comm.DefaultSocketRequestHan dler.handleMessage(DefaultSocketRequestHandler.jav a:
181)

at com.wm.util.comm.Connection.handleMessage(Connecti on.java:
136)

at com.wm.util.comm.Connection$PollRunner.run(Connect ion.java:
465)

at com.wm.util.pool.PooledThread.run(PooledThread.jav a:105)

at java.lang.Thread.run(Thread.java:832)

</messageDescription>

</message>

</Acknowledgement>

Jul 11 '07 #1
Share this Question
Share on Google+
11 Replies


P: n/a
OK; you read a local file "request.htm" into a string, making sure
line-breaks are \n [note - StringBuilder would have been more
efficient here...]

You then get the UTF8 binary for this string, and upload this as the
POST, with content-type " "application/x-www-form-urlencoded"

So: does "request.htm" actually contain form-encoded data? Based on
the name, I'm guessing not... HTML is not the same thing. HTML is a
markup language used to display data in a browser - very different to
a HTTP POST, which is used to form a request (note that "HTML POST"
doesn't really make sense except in the context "upload an HTML file
by POSTing over HTTP"). You can use sniffers (such as Fiddler) to see
what this POST should look like - or simply google. But it essentially
boils down to name/value pairs, not HTML.

Additionally, note that WebClient is often much easier to use for
uploads that WebRequest.

Marc
Jul 11 '07 #2

P: n/a
Hi,

"request.htm" is not a form-encoded data, what happens is that this
page contains xml data in a text field, that when you hit the submit
button, it contains a HTTP POST to a url, which in turn you receive an
XML response. But it is not the XML response that I would like.

I placed even a string like "<HTML></HTML>" replacing the variable
text in byte[] byteArray = Encoding.UTF8.GetBytes(text);, and it still
receives the same error. Essentially the url is using a web service
which only receives HTTP POSTs.
I will have a look at the sniffer fiddler to see what it is doing

Hon.

On Jul 11, 10:36 am, "Marc Gravell" <marc.grav...@gmail.comwrote:
OK; you read a local file "request.htm" into a string, making sure
line-breaks are \n [note - StringBuilder would have been more
efficient here...]

You then get the UTF8 binary for this string, and upload this as the
POST, with content-type " "application/x-www-form-urlencoded"

So: does "request.htm" actually contain form-encoded data? Based on
the name, I'm guessing not... HTML is not the same thing. HTML is a
markup language used to display data in a browser - very different to
a HTTP POST, which is used to form a request (note that "HTML POST"
doesn't really make sense except in the context "upload an HTML file
by POSTing over HTTP"). You can use sniffers (such as Fiddler) to see
what this POST should look like - or simply google. But it essentially
boils down to name/value pairs, not HTML.

Additionally, note that WebClient is often much easier to use for
uploads that WebRequest.

Marc

Jul 11 '07 #3

P: n/a
Hi,

Fiddler didn't display any useful information in the case of the
connection to the url from my code only in that a connection was
established.

Hon.

On Jul 11, 10:36 am, "Marc Gravell" <marc.grav...@gmail.comwrote:
OK; you read a local file "request.htm" into a string, making sure
line-breaks are \n [note - StringBuilder would have been more
efficient here...]

You then get the UTF8 binary for this string, and upload this as the
POST, with content-type " "application/x-www-form-urlencoded"

So: does "request.htm" actually contain form-encoded data? Based on
the name, I'm guessing not... HTML is not the same thing. HTML is a
markup language used to display data in a browser - very different to
a HTTP POST, which is used to form a request (note that "HTML POST"
doesn't really make sense except in the context "upload an HTML file
by POSTing over HTTP"). You can use sniffers (such as Fiddler) to see
what this POST should look like - or simply google. But it essentially
boils down to name/value pairs, not HTML.

Additionally, note that WebClient is often much easier to use for
uploads that WebRequest.

Marc

Jul 11 '07 #4

P: n/a
I don't think you fully understand the difference between HTML and
HTTP. I described what your code does ("works as coded"). If
"request.htm" is not form-encoded data, then don't send it as
form-encoded data! An HTTP query does not generally expect to recieve
HTML, and is not going to click any submit button. Rather, *when the
HTML is loaded in a browser*, clicking the submit button causes a
separate HTTP POST (var=value etc from the submitted form) which
returns something (xml apparently).

The only time you would generally upload raw HTML is in a
content-management system (or perhaps a forum / e-mail app with HTML
editors).

Marc
Jul 11 '07 #5

P: n/a
I'd be more interested in what fiddler outputs when you use the
web-page directly, i.e. through a browser clicking on the button. This
will then tell you immediately what you are meant to be uploading. If
the post is over SSL you will need fiddler 2 (or alternatively the
debug version of some MS dlls).

Marc
Jul 11 '07 #6

P: n/a
Hi again,

How would you make a seperate HTTP Post to the url with only the XML
data?
>From what you had said, you can only submit the data using the submit
button via a form, can you perform something like as an "automation"
in .NET?

Cheers,

Hon

On Jul 11, 11:26 am, "Marc Gravell" <marc.grav...@gmail.comwrote:
I don't think you fully understand the difference between HTML and
HTTP. I described what your code does ("works as coded"). If
"request.htm" is not form-encoded data, then don't send it as
form-encoded data! An HTTP query does not generally expect to recieve
HTML, and is not going to click any submit button. Rather, *when the
HTML is loaded in a browser*, clicking the submit button causes a
separate HTTP POST (var=value etc from the submitted form) which
returns something (xml apparently).

The only time you would generally upload raw HTML is in a
content-management system (or perhaps a forum / e-mail app with HTML
editors).

Marc

Jul 11 '07 #7

P: n/a
It seems to be a post over SSL.

The data sent represents a SSLv3-compatible ClientHello handshake.
For your convenience, the data is extracted below.

Major Version: 3
Minor Version: 1
Random: 46 94 B6 83 DC B6 B3 7E 26 7C 82 04 32 69 35 4E D0 E4 BF 03 5F
AC DD 03 1C C4 64 EF 15 77 69 8E
SessionID: B2 69 E2 99 24 84 EA E8 5C D4 4B B9 CA 81 98 14 3E 8B 84 D0
FC 9D 87 16 BA FA F3 24 A8 C0 42 7D
Ciphers:
[0004] SSL_RSA_WITH_RC4_128_MD5
[0005] SSL_RSA_WITH_RC4_128_SHA
[000A] SSL_RSA_WITH_3DES_EDE_SHA
[0009] SSL_RSA_WITH_DES_SHA
[0064] TLS_RSA_EXPORT1024_WITH_RC4_56_SHA
[0062] TLS_RSA_EXPORT1024_WITH_DES_SHA
[0003] SSL_RSA_EXPORT_WITH_RC4_40_MD5
[0006] SSL_RSA_EXPORT_WITH_RC2_40_MD5
[0013] SSL_DHE_DSS_WITH_3DES_EDE_SHA
[0012] SSL_DHE_DSS_WITH_DES_SHA
[0063] TLS_DHE_DSS_EXPORT1024_WITH_DES_SHA
On Jul 11, 11:47 am, "hong...@googlemail.com" <hong...@googlemail.com>
wrote:
Hi again,

How would you make a seperate HTTP Post to the url with only the XML
data?>From what you had said, you can only submit the data using the submit

button via a form, can you perform something like as an "automation"
in .NET?

Cheers,

Hon

On Jul 11, 11:26 am, "Marc Gravell" <marc.grav...@gmail.comwrote:
I don't think you fully understand the difference between HTML and
HTTP. I described what your code does ("works as coded"). If
"request.htm" is not form-encoded data, then don't send it as
form-encoded data! An HTTP query does not generally expect to recieve
HTML, and is not going to click any submit button. Rather, *when the
HTML is loaded in a browser*, clicking the submit button causes a
separate HTTP POST (var=value etc from the submitted form) which
returns something (xml apparently).
The only time you would generally upload raw HTML is in a
content-management system (or perhaps a forum / e-mail app with HTML
editors).
Marc- Hide quoted text -

- Show quoted text -

Jul 11 '07 #8

P: n/a
SSL chains are deliberately impenetrable. Fiddler will manage, but
only from IE - hence looking at what you get when using the browser is
probably a better starting point.

Regards creating an HTTP post of xml... how about:

string request = @"<xml/>", response;
using (WebClient client = new WebClient()) {
response = client.UploadString(url, "POST", request);
}

Marc
Jul 11 '07 #9

P: n/a
Ok, I give you the lowdown on this: -

I made used the web page on the web browser and hit the submit with
Fiddler 2 running, and it gave: -

In the request header,
Content-Type: application/x-www-form-urlencoded
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg,
application/x-shockwave-flash, application/vnd.ms-excel, application/
vnd.ms-powerpoint, application/msword, */*
Accept-Language: en-gb

Hon.

On Jul 11, 12:08 pm, "Marc Gravell" <marc.grav...@gmail.comwrote:
SSL chains are deliberately impenetrable. Fiddler will manage, but
only from IE - hence looking at what you get when using the browser is
probably a better starting point.

Regards creating an HTTP post of xml... how about:

string request = @"<xml/>", response;
using (WebClient client = new WebClient()) {
response = client.UploadString(url, "POST", request);
}

Marc

Jul 11 '07 #10

P: n/a
Gotta love Word.
However, the extract doesn't include any of the FORM stuff, so I'm not
sure anybody can diagnose anything from this.

Marc
Jul 11 '07 #11

P: n/a
No actual body? Depending on which version of Fiddler you are using
you may need to switch tabs, double-click, etc to see the body.

Marc
Jul 11 '07 #12

This discussion thread is closed

Replies have been disabled for this discussion.