none
MS-WSDS Pull message - Invalid Enumeration Context specified in the request RRS feed

  • Question

  • Hi 

    I am always getting an "Invalid Enumeration Context specified in the request" error after sending a Pull request to an active directory web services instance.

    I have set up a Biztalk orchestration which first sends an Enumerate request, this request gets an EnumerateResponse back containing an EnumerationContext + expiration time. The EnumerationContext is then included in the Pull request. I have done some debugging using the Microsoft Service Trace Viewer and the Pull message seems to follow the MS-WSDS spec ( from October 16, 2015)

    any help will be greatly appreciated

    rafael

    Tuesday, July 5, 2016 12:34 PM

Answers

  • The orchestration as initially designed won't work. Before sending the Enumerate message Biztalk opens a WCF channel with the ADWS and upon receiving the EnumerateResponse message, this channel is closed. As a consequence , the just created EnumerationContext is disposed by the ADWS service. Clearly using this (previously disposed) EnumerationContext in the subsequent Pull message gives back the "Invalid enumeration context" fault. 

    The solution is to code a WCF client (.net assembly) which will first open a WCF channel then make the Enumerate/Pull calls and finally close the channel. This client will be called from an expression shape.

    Hope this helps someone

    Rafael 

    • Marked as answer by RReyes537 Tuesday, September 20, 2016 1:19 PM
    Tuesday, September 20, 2016 1:19 PM

All replies

  • Hi Rafael,

    According to the error message above, it's invalid Enumeration Context in pull request, it's recommended to check the parameters in pull request.

    Could you provide other information about this issue? perhaps it will be helpful to give more precise troubleshooting.

    Regards,

    Angie 


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Wednesday, July 6, 2016 2:57 AM
    Moderator
  • Hi Angie 

    thank you for replying to my question. these are the messages I am sending

    1. starting with Enumerate to establish the EnumerationContext

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Enumerate</a:Action>
    <instance xmlns="http://schemas.microsoft.com/2008/1/ActiveDirectory">ldap:389</instance>
    <a:MessageID>urn:uuid:9eb5e8ef-7d9d-4fee-b3ed-44c78e89953c</a:MessageID>
    <a:ReplyTo>
    <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">net.tcp://DC:9389/ActiveDirectoryWebServices/Windows/Enumeration</a:To>
    </s:Header>
    <s:Body>
    <wsen:Enumerate xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:adlq="http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/LdapQuery" xmlns:addata="http://schemas.microsoft.com/2008/1/ActiveDirectory/Data" xmlns:ad="http://schemas.microsoft.com/2008/1/ActiveDirectory" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsen:Expires>PT10M</wsen:Expires>
    <ad:Selection Dialect="http://schemas.microsoft.com/2008/1/ActiveDirectory/Dialect/XPath-Level-1">
    <ad:SelectionProperty>addata:objectGUID</ad:SelectionProperty>
    <ad:SelectionProperty>addata:sAMAccountName</ad:SelectionProperty>
    <ad:SelectionProperty>addata:mail</ad:SelectionProperty>
    <ad:SelectionProperty>addata:employeeID</ad:SelectionProperty>
    </ad:Selection>
    </wsen:Enumerate>
    </s:Body>
    </s:Envelope>

    2. I am getting a response back with the EnumerationContext

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/enumeration/EnumerateResponse</a:Action>
    <a:RelatesTo>urn:uuid:9eb5e8ef-7d9d-4fee-b3ed-44c78e89953c</a:RelatesTo>
    <a:To s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/anonymous</a:To>
    </s:Header>
    <s:Body>
    <wsen:EnumerateResponse xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <wsen:Expires>2016-07-06T06:31:42.1735591Z</wsen:Expires>
    <wsen:EnumerationContext>d6d822bd-3420-4135-8720-03283ad0c100</wsen:EnumerationContext>
    </wsen:EnumerateResponse>
    </s:Body>
    </s:Envelope>

    3. then I send the Pull request which includes the EnumerationContext just received

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/enumeration/Pull</a:Action>
    <a:MessageID>urn:uuid:3f142a20-22b2-4462-897f-23730570c7e2</a:MessageID>
    <a:ReplyTo>
    <a:Address>http://www.w3.org/2005/08/addressing/anonymous</a:Address>
    </a:ReplyTo>
    <a:To s:mustUnderstand="1">net.tcp://DC:9389/ActiveDirectoryWebServices/Windows/Enumeration</a:To>
    </s:Header>
    <s:Body>
    <wsen:Pull xmlns:wsen="http://schemas.xmlsoap.org/ws/2004/09/enumeration">
    <wsen:EnumerationContext>d6d822bd-3420-4135-8720-03283ad0c100</wsen:EnumerationContext>
    <wsen:MaxTime>PT10M</wsen:MaxTime>
    <wsen:MaxElements>2</wsen:MaxElements>
    </wsen:Pull>
    </s:Body>
    </s:Envelope>

    4. Then I receive a fault message back

    <s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
    <s:Header>
    <a:Action s:mustUnderstand="1">http://schemas.xmlsoap.org/ws/2004/09/enumeration/fault</a:Action>
    <a:RelatesTo>urn:uuid:3f142a20-22b2-4462-897f-23730570c7e2</a:RelatesTo>
    <a:To s:mustUnderstand="1">http://www.w3.org/2005/08/addressing/anonymous</a:To>
    </s:Header>
    <s:Body>
    <s:Fault>
    <s:Code>
    <s:Value>s:Sender</s:Value>
    <s:Subcode>
    <s:Value xmlns:a="http://schemas.xmlsoap.org/ws/2004/09/enumeration">a:InvalidEnumerationContext</s:Value>
    </s:Subcode>
    </s:Code>
    <s:Reason>
    <s:Text xml:lang="en-US">Invalid Enumeration Context specified in the request.</s:Text>
    </s:Reason>
    <s:Detail>
    <FaultDetail xmlns="http://schemas.microsoft.com/2008/1/ActiveDirectory" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <Error>Unknown or expired enumeration context.</Error>
    <ShortError>NoSuchEnumCtxGuidExists</ShortError>
    </FaultDetail>
    </s:Detail>
    </s:Fault>
    </s:Body>
    </s:Envelope>

    this exchange of messages is done inside an orchestration. the different elements (port types, messages types...) used in the orchestration were created by the Biztalk WCF Service Consuming Wizard.

    Thank you for your help

    Rafael

    Wednesday, July 6, 2016 6:43 AM
  • Hi Rafael,

    An enumeration context can become invalid for any reason including:

    1) Enumeration completed (i.e. an EndOfSequence has been returned in a Pull response)

    2) Enumeration released

    3) Enumeration expired

    4) Enumeration ended (i.e. ended via an EnumerationEnd message from data source

    5) Enumeration context replaced in the response to another Pull request

    In addition, the data source MAY invalidate an enumeration context at any time, as necessary.

    When processing a Pull, Renew, GetStatus or Release operation, a data source MUST generate an wsen:InvalidEnumerationContext fault if it determines that the enumeration context supplied by the consumer in the request is invalid.

    Note that the data source might not be able to determine that an enumeration context is invalid, especially if all of the state associated with the enumeration is kept in the enumeration context and refreshed on every PullResponse or RenewResponse.

    Refer: https://www.w3.org/2002/ws/ra/snapshots/20091117/wsenum-diff.html


    Rachit Sikroria (Microsoft Azure MVP)

    Friday, July 8, 2016 1:39 PM
    Moderator
  • Hi Rachit

    The only response to the Pull message I am getting back is the "Invalid enumeration context..." fault. Please have a look at my orchestration, perhaps I am doing something wrong. 

    In the message assignment shape contained in the ConstructPullMessage shape, I am simply extracting the EnumerationContext received in the EnumerateResponse

    xmlPullMsgBody.LoadXml("<wsen:Pull xmlns:wsen=\"http://schemas.xmlsoap.org/ws/2004/09/enumeration\" >" +                           
                              "<wsen:EnumerationContext>" + 
                                 (System.String)xpath(msgEnumerateOutput.EnumerateResult, "string(//*[local-name()='EnumerateResponse' and namespace-uri()='http://schemas.xmlsoap.org/ws/2004/09/enumeration']/*[local-name()='EnumerationContext' and namespace-uri()='http://schemas.xmlsoap.org/ws/2004/09/enumeration']/text())") + 
                              "</wsen:EnumerationContext>" + 
                           "</wsen:Pull>");
    msgPullInput.@request=xmlPullMsgBody;

    Here is the orchestration

    thank you for your help

    Rafael

    Tuesday, July 12, 2016 6:18 AM
  • anyone?
    Monday, August 8, 2016 1:39 PM
  • Anyone have another idea for Rafael?

    Thanks!


    Ed Price, Azure Development Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Wednesday, August 10, 2016 6:40 PM
    Owner
  • I think this problem is not BizTalk related, but Active Directory. You can get this error it your AD query is based on an attribute that is not indexed or when you are pulling to much data. 

    Regards, Sjoukje. Blog | LinkedIn | Twitter

    Tuesday, September 6, 2016 2:14 PM
    Answerer
  • Microsoft is looking at this issue. You're right saying that in some cases pulling too much data or data which is  not indexed could trigger the invalid enumeration context fault. However even if I try to pull one attribute of one object of the AD I get the fault back. I'll post the solution once I get it.

    Regards

    Rafael

    Thursday, September 15, 2016 6:03 AM
  • The orchestration as initially designed won't work. Before sending the Enumerate message Biztalk opens a WCF channel with the ADWS and upon receiving the EnumerateResponse message, this channel is closed. As a consequence , the just created EnumerationContext is disposed by the ADWS service. Clearly using this (previously disposed) EnumerationContext in the subsequent Pull message gives back the "Invalid enumeration context" fault. 

    The solution is to code a WCF client (.net assembly) which will first open a WCF channel then make the Enumerate/Pull calls and finally close the channel. This client will be called from an expression shape.

    Hope this helps someone

    Rafael 

    • Marked as answer by RReyes537 Tuesday, September 20, 2016 1:19 PM
    Tuesday, September 20, 2016 1:19 PM