I am working on Sitecore Mobile SDK in Xamarin Android. I downloaded the sample project from https://components.xamarin.com/view/sitecore.mobile.sdk. I modified my code as per my requirement changed instanceUrl and credentials and executed code it is not showing output. My Application Output shows:
[MonoDroid] UNHANDLED EXCEPTION:
[MonoDroid] Sitecore.MobileSDK.API.Exceptions.RsaHandshakeException: [Sitecore Mobile SDK] Public key not received properly ---> System.Xml.XmlException: Document Type Declaration (DTD) is prohibited in this XML. Line 4, position 10.
[MonoDroid] at Mono.Xml2.XmlTextReader.ReadDoctypeDecl () [0x00000] in <filename unknown>:0
[MonoDroid] at Mono.Xml2.XmlTextReader.ReadDeclaration () [0x00000] in <filename unknown>:0
[MonoDroid] at Mono.Xml2.XmlTextReader.ReadContent () [0x00000] in <filename unknown>:0
[MonoDroid] at Mono.Xml2.XmlTextReader.Read () [0x00000] in <filename unknown>:0
[MonoDroid] at System.Xml.XmlTextReader.Read () [0x00000] in <filename unknown>:0
[MonoDroid] at Sitecore.MobileSDK.PublicKey.PublicKeyXmlParser.Parse (System.IO.Stream xmlStream, CancellationToken cancelToken) [0x00000] in <filename unknown>:0
[MonoDroid] at Sitecore.MobileSDK.PublicKey.GetPublicKeyTasks+<>c__DisplayClass11.<ParseResponseDataAsync>b__d () [0x00000] in <filename unknown>:0
[MonoDroid] at System.Threading.Tasks.TaskActionInvoker+FuncInvoke`1[Sitecore.MobileSDK.PublicKeyX509Certificate].Invoke (System.Threading.Tasks.Task owner, System.Object state, System.Threading.Tasks.Task context) [0x00000] in <filename unknown>:0
[MonoDroid] at System.Threading.Tasks.Task.InnerInvoke () [0x00000] in <filename unknown>:0
[MonoDroid] at System.Threading.Tasks.Task.ThreadStart () [0x00000] in <filename unknown>:0
[MonoDroid] --- End of inner exception stack trace ---
[MonoDroid] at Sitecore.MobileSDK.ScApiSession+<GetPublicKeyAsync>d__0.MoveNext () [0x00000] in <filename unknown>:0
[MonoDroid] --- End of stack trace from previous location where exception was thrown ---
[MonoDroid] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x00000] in <filename unknown>:0
[MonoDroid] at System.Runtime.CompilerServices.TaskAwaiter`1[Sitecore.MobileSDK.API.Items.ScItemsResponse].GetResult () [0x00000] in <filename unknown>:0
[MonoDroid] at AndroidMobileSdkDemo.MainActivity+<OnCreate>d__2.MoveNext () [0x000d0] in c:\Users\Ashok v\Downloads\Sitecore.Mobile.SDK-1.0\samples\AndroidMobileSdkDemo\AndroidMobileSdkDemo\MainActivity.cs:44
[art] JNI RegisterNativeMethods: attempt to register 0 native methods for android.runtime.JavaProxyThrowable
Check your instance settings, WebAPI should be enabled:
You should enable it in instanceUrl\Website\App_Config\Include\Sitecore.ItemWebApi.config
Simply replace the node
with
If you want your anonymous user to have readonly access for the website. You can find more details here: https://sdn.sitecore.net/upload/sdn5/modules/sitecore%20item%20web%20api/sitecore_item_web_api_developer_guide_sc65-66-a4.pdf, 'Security' chapter.