Send data to WCF from Android using KSOAP2

强颜欢笑 提交于 2019-12-04 16:57:59

Try setting the ItemName on the CollectionDataContract attribute. For example:

[CollectionDataContract(Name = "Custom{0}List", ItemName = "CustomItem")]
public class Items : List<clsitems>
{
}

The CollectionDataContractAttribute is intended to ease interoperability when working with data from non- providers and to control the exact shape of serialized instances. To this end, the ItemName property enables you to control the names of the repeating items inside a collection. This is especially useful when the provider does not use the XML element type name as the array item name, for example, if a provider uses "String" as an element type name instead of the XSD type name "string".

Taken from here

found solution of your question .. HTTP 500 is an internal server error , so you should check the server is working with SOAPUI or some other tool for starters. Then make sure that you can reach the URL (IP number in this case) from the device and then start debugging the ksaop call.. make sure your webservice is working fine or not

You can enable tracing on the server side like this and check the resulting file including SOAP messages recorded. Then you can identify the problem. Add this to your app.config or web.config. (You may need to change some settings)

<system.diagnostics>
<sources>
  <source propagateActivity="true" name="System.ServiceModel" switchValue="All">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="xml">
        <filter type="" />
      </add>
    </listeners>
  </source>

  <source name="System.ServiceModel.MessageLogging">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="xml" />
    </listeners>
  </source>

  <source name="CardSpace">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="xml">
        <filter type="" />
      </add>
    </listeners>
  </source>
  <source name="System.IO.Log">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="xml">
        <filter type="" />
      </add>
    </listeners>
  </source>
  <source name="System.Runtime.Serialization">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="xml">
        <filter type="" />
      </add>
    </listeners>
  </source>
  <source name="System.IdentityModel">
    <listeners>
      <add type="System.Diagnostics.DefaultTraceListener" name="Default">
        <filter type="" />
      </add>
      <add name="xml">
        <filter type="" />
      </add>
    </listeners>
  </source>
</sources>
<sharedListeners>
  <add initializeData="Traces.svclog" type="System.Diagnostics.XmlWriterTraceListener"
    name="xml" traceOutputOptions="ProcessId, ThreadId">
    <filter type="" />
  </add>
</sharedListeners>
</system.diagnostics>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!