0

I have a reference to an external asmx webservice which is emitting soap xml. How to consume using asp.net client to send and receive json objects. Limited to .net framework version 3.5. Please share code snippets.

We can't change anything from webservice side since it is external.

4

1 回答 1

0
[WebService]
[ScriptService]
public class MyWebService : WebService
{    
  [WebMethod (Description="doc here")]    
  [ScriptMethod(UseHttpGet=false, ResponseFormat=ResponseFormat.Json)]     
  public MyObjectType responseMyObject() 
  {
      Proxy pu = new Proxy(...);
      return pu.GetMyObject();
  }
}

You dont need a JSON serializer, tagging it with the ScriptService attribute gives it tie ability to serialize JSON out. You were pre serializing the JSON and then serializing it again :(

于 2012-10-11T14:30:05.590 回答