David Martinez Member Licensed User Longtime User Jul 20, 2014 #1 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")
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")
Erel B4X founder Staff member Licensed User Longtime User Jul 21, 2014 #2 I think that you are missing the SOAPAction header. See this example: http://www.b4x.com/android/forum/th...o-your-android-application.27080/#post-156765 Upvote 0
I think that you are missing the SOAPAction header. See this example: http://www.b4x.com/android/forum/th...o-your-android-application.27080/#post-156765
David Martinez Member Licensed User Longtime User Aug 2, 2014 #3 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
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.