Note that there are some explanatory texts on larger screens.

plurals
  1. POMaking a WCF service Android compatible
    primarykey
    data
    text
    <p>I have a WCF service that is hosted on a remote server using IIS. I want to make this service android compatible so I can consume the service on an android client. The problem I'm having is that I'm trying to use ksoap2 to connect to the service but it's giving me a 400 error every time I try to call the method. I've used fiddler2 to try and see what the problem is and in addition to the 400 error, it's also sending back a content-length: 0 (don't know if that is the cause. Interesting fact, when I specify a content-length in the request on fiddler, it doesn't give me a 400 error but rather doesn't return a response at all) I've already tried changing the binding to a webHttpBinding instead of wsHttpBinding and adding a WebGet attribute above the method with a URITemplate, BodyStyle, etc. but no luck. Here's my code:</p> <p>Service</p> <pre><code> public class PublicService : IPublicService { public Wallpaper[] GetWallpapers() { //return _wallpaperRepository.Items.ToArray(); return new Wallpaper[]{ new Wallpaper() { Id = 10 }}; } } </code></pre> <p>Interface</p> <pre><code>[ServiceContract(Namespace = "http://XXXXXXXX.com/ServiceA")] public interface IPublicService { [OperationContract] Wallpaper[] GetWallpapers(); } </code></pre> <p>Web.Config</p> <pre><code> &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding name="android" maxReceivedMessageSize="4097152" maxBufferPoolSize="4097152"&gt; &lt;readerQuotas maxStringContentLength="4097152" maxArrayLength="4097152" maxBytesPerRead="4097152" maxNameTableCharCount="4097152" maxDepth="4097152"/&gt; &lt;/binding&gt; &lt;/wsHttpBinding&gt; &lt;/bindings&gt; &lt;services&gt; &lt;service name="Service.Concrete.PublicService" behaviorConfiguration="ServiceBehavior"&gt; &lt;endpoint address="PublicService" binding="wsHttpBinding" name="PublicService" contract="Service.Abstract.IPublicService" bindingConfiguration="android"/&gt; &lt;endpoint binding="mexHttpBinding" bindingConfiguration="" name="mex" contract="IMetadataExchange"/&gt; &lt;/service&gt; </code></pre> <p>I've been beating my head against the wall for the past several hours and going through countless googling, I'm at a complete lost on what to do next. If anyone has any idea what I'm doing wrong, any advice would be greatly appreciated.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload