UpdateLine Req > Cannot insert or update pattern.

Version 1
    This document was generated from CDN thread

    Created by: Salim Guerid on 04-10-2013 11:57:29 PM
    Hi All,
    Simple updateline query but sounds like it is impossible to select the line using either pattern/partition or uuid. The blow code always returns the error: "Cannot insert or update pattern. A DN exists with the same pattern and partition."

     1ReqPhoneLine = new UpdateLineReq();
     2//ReqPhoneLine.Items = new object[] { myPattern, new XFkType() { Value = myPatrition } };
     3//ReqPhoneLine.ItemsElementName = new ItemsChoiceType14[] { ItemsChoiceType14.pattern, ItemsChoiceType14.routePartitionName };
     5ReqPhoneLine.Items = new object[] { myuuid };
     6ReqPhoneLine.ItemsElementName = new ItemsChoiceType14[1] { ItemsChoiceType14.uuid };
     8ReqPhoneLine.callForwardBusy = new XCallForwardBusy() {  callingSearchSpaceName = new XFkType() { Value = "NewCss" } };
    Any idea?

    Subject: RE: UpdateLine Req > Cannot insert or update pattern.
    Replied by: David Staudt on 09-10-2013 03:56:42 PM
    It's difficult to discern what .NET may or may not be doing with the actual XML sent to AXL.  If you can get hold of the actual XML request/response that may be helpful (and may give a clue as to what weirdness .NET is doing...).  Here is a working example of the XML:
     1<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns="http://www.cisco.com/AXL/API/8.5">
     2   <soapenv:Header/>
     3   <soapenv:Body>
     4      <ns:updateLine sequence="1">
     5         <uuid>{0D2A8EB6-85D7-27B3-BD1F-053082678C40}</uuid>
     6         <shareLineAppearanceCssName>testCSS</shareLineAppearanceCssName>
     7      </ns:updateLine>
     8   </soapenv:Body>
    11<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    12   <soapenv:Body>
    13      <ns:updateLineResponse xmlns:ns="http://www.cisco.com/AXL/API/8.5">
    14         <return>{0D2A8EB6-85D7-27B3-BD1F-053082678C40}</return>
    15      </ns:updateLineResponse>
    16   </soapenv:Body>

    Subject: RE: UpdateLine Req > Cannot insert or update pattern.
    Replied by: Salim Guerid on 11-10-2013 07:26:25 AM
    Hi David,

    Here is the request. I miss the sequence= 1 coudl this be the issue?

     1<?xml version="1.0" encoding="utf-8"?>
     2<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">
     3  <soap:Body>
     4    <updateLine xmlns="http://www.cisco.com/AXL/API/8.5">
     5      <uuid xmlns="">321327af-d0df-ada7-5e20-b0cc930b1719</uuid>
     6      <newRoutePartitionName xsi:nil="true" xmlns="" />
     7      <aarNeighborhoodName xsi:nil="true" xmlns="" />
     8      <aarDestinationMask xsi:nil="true" xmlns="" />
     9      <callForwardBusy xmlns="">
    10        <callingSearchSpaceName>Internal-CH3</callingSearchSpaceName>
    11        <destination xsi:nil="true" />
    12      </callForwardBusy>
    13      <networkHoldMohAudioSourceId xsi:nil="true" xmlns="" />
    14      <userHoldMohAudioSourceId xsi:nil="true" xmlns="" />
    15      <shareLineAppearanceCssName xsi:nil="true" xmlns="" />
    16      <voiceMailProfileName xsi:nil="true" xmlns="" />
    17      <hrDuration xsi:nil="true" xmlns="" />
    18      <hrInterval xsi:nil="true" xmlns="" />
    19      <defaultActivatedDeviceName xsi:nil="true" xmlns="" />
    20      <parkMonForwardNoRetrieveDn xsi:nil="true" xmlns="" />
    21      <parkMonForwardNoRetrieveIntDn xsi:nil="true" xmlns="" />
    22      <parkMonForwardNoRetrieveCssName xsi:nil="true" xmlns="" />
    23      <parkMonForwardNoRetrieveIntCssName xsi:nil="true" xmlns="" />
    24      <parkMonReversionTimer xsi:nil="true" xmlns="" />
    25    </updateLine>
    26  </soap:Body>

    Subject: RE: UpdateLine Req > Cannot insert or update pattern.
    Replied by: David Staudt on 11-10-2013 04:13:33 PM
    At least an initial problem is the presence of the nil 'newRoutePartitionName'.  A constraint of the line table is that the pair pattern+partition (DN and routePartition in AXL terms) must be unique - no two lines can have identical DN+partition.  
    With the <newRoutePartitionName> element present in your request, AXL attempts to change the line's partition to nil/null (empty).  This could be what you want - e.g. if the line previously had an actual partition assigned and you wanted to clear the partition (reflecting 'None') - or the presence of the field may be unwanted (due to .NET behaviour of including nil elements that are foreign key types), but when AXL attempts to set the DN+partition to "DN+<None>", this fails, since that combination already exists (either because it already exists in another record, or because the DN+partition combo belongs to this record already.)
    I think the presence of many/most of the other nil elements in your request may also cause you problems, as they will attempt to 'null out' their respective fields in UCM.