Update request

This C# example changes the name of the company whose ID is 66.

Copy
private static void UpdateACompany()
{
  String idString = "66";
  String newName = "newName";
  //can update a number of companies
  ewarebase[] companyList = new ewarebase[1];
  company aCompany = new company();
  aCompany.companyid = Convert.ToInt16(idString);
  aCompany.companyidSpecified = true;
  aCompany.name = newName;
  companyList[0] = aCompany;
  updateresult aresult = binding.update("company", companyList);
  if (aresult.updatesuccess == true)
  { }
  else
  { }
}

This is the XML request that Web Services process.

Copy
<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
  <soap:Header>
    <SessionHeader xmlns="http://tempuri.org/type">
      <sessionId>12663708753831</sessionId>
    </SessionHeader>
  </soap:Header>
  <soap:Body>
    <update xmlns="http://tempuri.org/type">
      <entityname>company</entityname>
      <records xsi:type="company">
        <people xsi:nil="true" />
        <address xsi:nil="true" />
        <email xsi:nil="true" />
        <phone xsi:nil="true" />
        <companyid>933</companyid>
        <name>Design Wrong Inc</name>
      </records>
    </update>
  </soap:Body>
</soap:Envelope>