Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Webservice, XML, fixed-len file 1

Status
Not open for further replies.

timothy

Programmer
Mar 20, 2000
39
0
0
US
I've never done a webservice before. Just looking for tutorials or sites that have information that can help with the task below...

I need to build a web service that can receive a plain fixed len text file and return a response in an XML file.
My customers should be able to build a web page that calls my webservice-method and sending a text file to it.

Anyone know of any tutorials or sites I can go to for help with this?

Thanks for your help
 
Thanks the tutorials were a big help. I just did a web service that passes a string around and one that passes a dataset back. But what I really want is escaping me. I need to receive a text file from the consumer. What type am I receiving in my method parameters for the text file? I tried a Filestream didn't seem to like that.

As far as the return value going back to the consumer I would expect that I could send back an XmlDocument.

Thanks for your thoughts.
 
You'll be receiving a string. It'll be up to you to write it to a file on your side.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Wow, that's the only way to receive a file? Ok, so I am going to make a method the receives a string, parse it and send the results back in a DataSet that way the consumer will get an XML file they can parse.

I guess I will have to tell the consumer to read the text file into a string var then send it to me. So the process would be something like...

Most likely the consumer will pass 100 records at 5 ascii chars in each row.

From web page:
1.) consumer will post file to local server
2.) parse file to string var
3.) pass to my web method
4.) parse the string in the method (do some db work)
5.) return the XML doc to the consumer

I'm going to give this a shot.
Thanks for you help!






 
Also, if this is a binary file, you'll want to encode it in base-64 format prior to transmission. Once you receive it, it'll be a string that looks like:
mQGiBDse2HIRBADW28xzXHbF62QDDMbEnyaxJIQFHADPC0CWvVwT6GWIfzBIhhuBmeMlW1Iih3Qpjy3clDNzS3p30acFHz3ErqUevRttpbaH5Bs5qinFQSUB58QQwCX2gRNMpaWU4GI67tcAZWnIz2Bl9RKb8bBs74QQDheOp0gnoVxvyDJN3MoZXQCg/yxy
You then run it through the Convert.FromBase64String method, which will produce a byte array. You can then write the byte array to disk. Using this technique you can transfer any type of file, as it's all "just bytes" that get encoded in a manner to prevent problems during transmission.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top