I have an app on the roll that requires me to upload files from it to a webservice. I am basically a noob in file transfer and in app-webservice comunications and would appreciate a direction in which to go.
The first question is how to encode the file? The webservice has to interpret the data sent so in which way do i do it? I don't own the webservice so i don't know how they pick up files, but i assume in a XML/JSON format.
The second question is how am i to send it? Having a XML object, how do i send it to, let's say, "http://www.website.com/path/to/upload". Is Async available?
If i'm missing or am wrong about a step (or 10) please correct me! Your help is much appreciated!
1: If it is a XML you will need to parse it, and create objet from it. If it's a Json, i recommend you https://github.com/johnezang/JSONKit JSONKIt, which is really awesome.
2: You 'll need get that data from webService and ASIHTTP is a really great tool to get fast web service call. The doc is really clear and comprehensible http://allseeing-i.com/ASIHTTPRequest/ is a must have.
3: You send your data either by url (get) or post.
Hope for you it's not into XML format, this is really painful, believe me
Related
I want to build a wcf web service so that the client and the server would be able to transfer files between each other. Do you know how I can achieve this? I think I should turn it into a byte array but I have no idea how to do that. The file is also quite big so I must turn on streamed response.
It sounds like you're on the right track. A quick search of the interwebz yielded this link: http://www.codeproject.com/Articles/166763/WCF-Streaming-Upload-Download-Files-Over-HTTP
Your question indicates that you want to send a file from a java client to a WCFd endpoint, but the contents of your question indicate that this should be a bidirectional capability. If this is the case, then you'll need to implement a service endpoint on your client as well. As far as that is concerned, I cannot be of much help, but there are resources out there like this SO question: In-process SOAP service server for Java
As far as practical implementation, I would think that using these two links you should be able to produce some code for your server and client.
As far as reading all bytes of a file, in C# you can use: File.ReadAllBytes It should work as in the following code:
//Read The contents of the file indicated
string fileName = "/path/to/some/file";
//store the binary in a byte array
byte[] buffer = File.ReadAllBytes(fileName);
//do something with those bytes!
Be sure to use the search function in the future:
Having a great time figuring this out, Google led me in directions not worthing taking.
I am looking to use AFNetworking to stream multiple files to a WCF service and using the query string parameters to send up ids and such.
I would post the code that I have but at the moment it's not worth it.
I think the issue is with the WCF end of things as I cannot figure out how to wire it up correctly.
If anyone can provide some solid direction on this I would greatly appreciate it!
Thanks
I just handled the iOS side of an AFNetworking/WCF issue so I can only offer some help from that perspective. The reason we had issues was because of the 65k upload limit on WCF side (http://forums.asp.net/t/1715789.aspx/1?64kb+limit+on+upload+of+file). Once our server guy upped the upload limit our code worked like a charm.
I need to parse WCF binary response. The reason is that I have no contract nor metadata I can just call wcf service with parameters using WebClient. What I'm getting now is binary response with xml inside but when I want to deserialize it with BinaryFormatter and load xml document, it gives me an error because of leading data. Is there some class which can do this for me?
Thanks.
I was also looking for something similar and I came across https://github.com/waf/WCF-Binary-Message-Inspector
It may help you out.
thank you for responses. Actually I ended up following this blog post (Fiddler plugin):
http://blog.functionalfun.net/2009/11/fiddler-plug-in-for-inspecting-wcf.html
there is also a link to source code:
http://archive.msdn.microsoft.com/wcfbinaryinspector
hope it will help
I'm pushing the bounds of what one should ask of others with this one, but I'm totally stuck, so here goes...
This is my first web service. Not only that, it's my companies first web service - nobody I work with has ever written or consumed anything like this one. I know these things are not complicated, but for a first kick at the can, this is killing me because the API is so large.
WSDL is here: https://fast.uspspostalone.com/USPSMLXMLWeb/services/UspsMailXmlMailingServices/wsdl/UspsMailXmlMailing70.wsdl
I need to get a "FullServiceNixieDetail". Should be an XML doc. The documentation provided by USPS says I need to invoke FullServiceNixieDetailQueryRequest, and I will get back a FullServiceNixieDetailQueryResponse, which contains a FullServiceNixieDetail.
I cannot for the life of me get anything that seems to work. The code I currently have is:
Imports USPSACSProcessor.UPSPMailXML
Dim c As New UspsMailXmlMailingServiceClient
Dim request As New FullServiceNixieDetailQueryRequest
Dim response As FullServiceNixieDetailQueryResponse
'Assume I populate the Request object correctly here
response = c.FullServiceNixieDetailQuery(request)
But my response object has no FullServiceNixieDetail. Just a bunch of summary properties like TotalMessageCount etc.
How do I get my FullServiceNixieDetail XML?
Did you populate your request with the proper authentications?
I suspect it is the response.Item that is the FullServiceNixieDetail, but without the usage knowledge of this particular web service, it's hard to confirm, you will need to find this out from the service host. You can also try doing a cast on the item to FullServiceNixieDetail, to verify this.
I would want to program something where you upload a file on the one side and the other person can download it the moment I start uploading. I knew such a service but can't remember the name. If you know the service I'd like to know the name if its not there anymore I'd like to program it as an opensource project.
And it is supposed to be a website
What you're describing sounds a lot like Bit Torrent.
You might be able to achieve this by uploading via a custom ISAPI filter (if you use IIS) -- all CGI implementations won't start to run your script until the request has completed, which makes sense, as you won't have been told all the values just yet, I'd suspect ISAPI may fall foul of this as well.
So, your next best bet is to write a custom HTTP server, that can handle the serving of files yet to finish uploading.
pipebytes.com I found it :)