none
Request Invalid RRS feed

  • Question

  • Hi,

    I am trying to invoke GetFolder operation in the response we are getting "The request is invalid."  We are unable to find wht exactly  is invalid in the request . Below are the request and response. Can you please take a look at the request and let me know what is causing the issue.

    Request:

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header />
    <SOAP-ENV:Body>
    <GetFolder
    xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <FolderShape>
    <t:BaseShape>Default</t:BaseShape>
    </FolderShape>
    <FolderIds>
    <t:DistinguishedFolderId Id="inbox" />
    </FolderIds>
    </GetFolder>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    Response:

    <?xml version="1.0" encoding="utf-8"?>
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body>
    <s:Fault>
    <faultcode
    xmlns:a="http://schemas.microsoft.com/exchange/services/2006/types">a:ErrorInvalidRequest</faultcode>
    <faultstring xml:lang="en-US">The request is invalid.</faultstring>
    <detail>
    <e:ResponseCode
    xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">ErrorInvalidRequest</e:ResponseCode>
    <e:Message
    xmlns:e="http://schemas.microsoft.com/exchange/services/2006/errors">The request is invalid.                                   </e:Message>
    </detail>
    </s:Fault>
    </s:Body>
    </s:Envelope>

    Friday, May 10, 2019 10:31 PM

All replies

  • The problem is the way you have specified the header in Exchange so if you remove or just reformat it the request should work (and I know what you have posted is valid XML)

    eg

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Body>
    <GetFolder
    xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <FolderShape>
    <t:BaseShape>Default</t:BaseShape>
    </FolderShape>
    <FolderIds>
    <t:DistinguishedFolderId Id="inbox" />
    </FolderIds>
    </GetFolder>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    But using a header is a bad practice and will cause issues in some EWS operation so my suggestion would be you fill the header with the correct information eg

    <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <SOAP-ENV:Header>
    <t:RequestServerVersion Version="Exchange2013" />
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
    <GetFolder
    xmlns="http://schemas.microsoft.com/exchange/services/2006/messages"
    xmlns:t="http://schemas.microsoft.com/exchange/services/2006/types">
    <FolderShape>
    <t:BaseShape>Default</t:BaseShape>
    </FolderShape>
    <FolderIds>
    <t:DistinguishedFolderId Id="inbox" />
    </FolderIds>
    </GetFolder>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    Cheers
    Glen


     
    Sunday, May 12, 2019 10:13 PM