Android Question Does anyone have an actual WCF working sample?

David Martinez

Member
Licensed User
Longtime User
Does anyone have an complete WCF working sample (with web.config, etc)? I have been working on a web service and trying to get it working for a couple of days to no avail but very close. The think the request post is not properly formatted.

Here's the post:
B4X:
<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.serviceModel>
  <bindings>
  <basicHttpBinding>
  <binding name="BasicHttpBinding_DBServiceA1" sendTimeout="00:05:00" />
  </basicHttpBinding>
  </bindings>
  <client>
  <endpoint address="http://192.168.1.11/MainServiceA1.svc" binding="basicHttpBinding"
  bindingConfiguration="BasicHttpBinding_DBServiceA1" contract="DBServiceA1"
  name="BasicHttpBinding_DBServiceA1" />
  </client>
  </system.serviceModel>
</configuration>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
  <s:Header>
  <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/DBServiceA1/GetQuote</Action>
  </s:Header>
  <s:Body>
  <GetQuote xmlns="http://tempuri.org/">
  <inSymbol>$string$</inSymbol>
  </GetQuote>
  </s:Body>
</s:Envelope>

Here's the Basic4Android code:
B4X:
Dim j AsHttpJob
j.Initialize("j", Me)
Dim msg AsString = File.ReadString(File.DirAssets, "request.xml")
msg = msg.Replace("$string$", "MSFT")
Log(msg)
j.PostString("http://192.168.1.11/MainServiceA1/MainServiceA1.svc",msg)
j.GetRequest.SetContentType("text/xml; charset=utf-8")
 

David Martinez

Member
Licensed User
Longtime User
After going thru your example and fine tuning the header, I got it to work!!!

Thank you so much for your quick help Erel. It is very appreciated.
 
Upvote 0
Top