I am trying to save a dataset into the CRM2011 by using the SOAP API.
Hopefully someone can explain how to save connected data, like gender.
Under is the update xml for a minmum of data. Gender is set in optionsets as 1->male, 2->female. I then need the xmlns and type for this data.
A normal UPDATE set look like this:
UPDATE:
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
<s:Body>
<Execute xmlns="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
<request i:type="a:UpdateRequest" xmlns:a="http://schemas.microsoft.com/xrm/2011/Contracts">
<a:Parameters xmlns:b="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<a:KeyValuePairOfstringanyType>
<b:key>Target</b:key>
<b:value i:type="a:Entity">
<a:Attributes>
<a:KeyValuePairOfstringanyType>
<b:key>accountid</b:key>
<b:value i:type="c:guid" xmlns:c="http://schemas.microsoft.com/2003/10/Serialization/">5e7cd540-3098-e011-91cf-1cc1de6dbadb</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>name</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">Test D2</b:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<b:key>accountnumber</b:key>
<b:value i:type="c:string" xmlns:c="http://www.w3.org/2001/XMLSchema">777</b:value>
</a:KeyValuePairOfstringanyType>
</a:Attributes>
<a:EntityState i:nil="true" />
<a:FormattedValues />
<a:Id>5e7cd540-3098-e011-91cf-1cc1de6dbadb</a:Id>
<a:LogicalName>account</a:LogicalName>
<a:RelatedEntities />
</b:value>
</a:KeyValuePairOfstringanyType>
</a:Parameters>
<a:RequestId i:nil="true" />
<a:RequestName>Update</a:RequestName>
</request>
</Execute>
</s:Body>
</s:Envelope>
Found the answer to my own question:
<a:KeyValuePairOfstringanyType>
<c:key>EntityMoniker</c:key>
<c:value i:type="a:EntityReference">
<a:Id>' + id + '</a:Id>
<a:LogicalName>' + logicalName + '</a:LogicalName>
<a:Name i:nil="true" />
</c:value>
</a:KeyValuePairOfstringanyType>
<a:KeyValuePairOfstringanyType>
<c:key>State</c:key>
<c:value i:type="a:OptionSetValue">
<a:Value>0</a:Value>
</c:value>
</a:KeyValuePairOfstringanyType>