How to send a large image from wp7 to wcf?

I am trying to send an image to wcf to use OCR. At the moment, I managed to convert the image to byte [] and send it to the server using wcf. Unfortunately, it works for an array of size <16Kb and does not work for an array> 17Kb.

I already set the maximum size of readerQuotas and maxArrayLength in the web.config file to the server size.

Do you know how to send big data to a wcf server or possibly any library for using OCR directly on wp7?

+6
c # windows-phone-7 wcf
source share
5 answers

The final decision. You must update your web.config so that the server receives big data. And then you should use the Stream type in your WCF and the type [] byte in your WP7. The types will match, and WCF or WP7 will agree to receive and send it.

In WCF:

 public string ConvertImgToStringPiece(Stream img) { //..... } 

In WP7:

 Service1Client proxy = new Service1Client(); proxy.ConvertImgToStringPieceCompleted += new EventHandler<ConvertImgToStringPieceCompletedEventArgs>(proxy_ConvertImgToStringPieceCompleted); proxy.ConvertImgToStringPieceAsync(b); //b is my Byte[], more thant 17Kb. 
+1
source share

If all else fails, send it in 16Kb fragments, followed by the message "everything is done", which commits it (if necessary, collecting it)

+4
source share

I don't know if this works on WP7, but with WCF you can also use streams to load large amounts of data.

+1
source share

A bit of a hack, but how to send it with an HTTP message if it's not too big? or alternatively change the web service so that it accepts blob? (limitation of the current array is limited by the type of array in the W3C specification)

+1
source share

You can try using a WCF session. The main thing to remember is that sessions in WCF are different from regular sessions that we use for Internet programming. This is basically a method call that starts the session, any intermediate calls, and then the final one that ends the session. You can have a service call that starts a session, sends pieces of an image, and then calls the last one, which closes the session and returns everything you need.

http://msdn.microsoft.com/en-us/library/ms733040.aspx

0
source share

All Articles