2012-03-29 4 views
0

Windows Phone 애플리케이션에서 json-rpc.net의 json-rpc 클라이언트를 사용합니다. 코드 :JSON-RPC 예외

var client = new AustinHarris.JsonRpc.JsonRpcClient(new Uri("http://www.raboof.com/projects/jayrock/demo.ashx")); 
var myObs = client.Invoke<string>("echo", "hello world", Scheduler.ThreadPool); 
myObs.Subscribe(
    onNext: _ => 
    { 
     Console.WriteLine(_.Result); 
    }); 
     } 

그리고 나서 데이터, JsonReaderException와 응용 프로그램 종료 얻을 원하는 :

Newtonsoft.Json.JsonReaderException 
    Message=Unexpected character encountered while parsing value: <. Line 0, position 0. 
    LineNumber=0 
    LinePosition=0 
    Path="" 
    StackTrace: 
     at Newtonsoft.Json.JsonTextReader.ParseValue() 
     at Newtonsoft.Json.JsonTextReader.ReadInternal() 
     at Newtonsoft.Json.JsonTextReader.Read() 
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.ReadForType(JsonReader reader, JsonContract contract, Boolean hasConverter, Boolean inArray) 
     at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType) 
     at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType) 
     at Newtonsoft.Json.JsonSerializer.Deserialize(JsonReader reader, Type objectType) 
     at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings) 
     at Newtonsoft.Json.JsonConvert.DeserializeObject(String value) 
     at AustinHarris.JsonRpc.JsonRpcClient.<>c__DisplayClassa`1.<>c__DisplayClassc.<>c__DisplayClasse.<Invoke>b__9(IAsyncResult riar) 
     at System.Net.Browser.ClientHttpWebRequest.<>c__DisplayClassa.<InvokeGetResponseCallback>b__8(Object state2) 
     at System.Threading.ThreadPool.WorkItem.WaitCallback_Context(Object state) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadPool.WorkItem.doWork(Object o) 
     at System.Threading.Timer.ring() 
+0

'<'문자가 첫 번째 문자로 돌아 오면 JSON-RPC 서비스입니까? REST + XML, XML-RPC 또는 SOAP처럼 보입니다. –

답변

1

json으로-RPC 클라이언트 파서 코드가 깨진 경우 응답을 수신하고, 그 첫 번째 문자에 사망 (Line 0, position 0)이 < 문자 일 경우 서비스에서 XML을 반환했다고 의심해야합니다.

올바른 서비스 끝점에 대해 확실합니까? 올바른 프로토콜?