web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

InvalidSecurity: An error occurred when verifying security for the message.

(2) ShareShare
ReportReport
Posted on by

Hi,

I am new to MS Dynamics CRM  and working on premises version,

Login is successful using PHP script but While creating a lead I am getting following error. I have tried to correct the time as per account but still getting the same same error.  

Please let me know, In what cases this error comes and how to fix this issue

ERROR:

<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://www.w3.org/2005/08/addressing/soap/fault</a:Action><a:RelatesTo>urn:uuid:8bc5002c-658b-44ff-b79d-dd432b6f9675</a:RelatesTo></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">a:InvalidSecurity</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">An error occurred when verifying security for the message.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope>

Thanks

*This post is locked for comments

I have the same question (0)
  • Saroj Das Profile Picture
    3,355 on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Hi Amit, please check whether the client time and your server time is same. Server do not allow to access if ime difference is there. And if it is not the case then check your region. i.e.

    crmna:dynamics.com - North America

    crmemea:dynamics.com - Europe, the Middle East and Africa

    crmapac:dynamics.com - Asia Pacific

    regards,

    Saroj

  • Community Member Profile Picture
    on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Thanks Saroj for your reply.

    I already tried and confused with the time Zone.

    I am getting the same error even after matching the time zone in my php script.

    1. My Account time Zone is US/Eastern and same I set  in my server with region crmna:dynamics.com

    2. After login we get the time in UTC in response.  I set the region crmemea:dynamics.com and time zone in UTC.

    In both cases, Login in account is successful but while creating the lead I am getting the error.

    Please Help where I am wrong.

  • Saroj Das Profile Picture
    3,355 on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Hi Amit, it seems like it might be authentication issue. Please follow the link.

    blogs.msdn.com/.../connecting-to-crm-online-2011-web-services-using-soap-requests-only.aspx

    hth

    regards,

    Saroj

  • Community Member Profile Picture
    on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    but I am not getting the authentication error otherwise it throw the error "LiveID not authenticated". It is during creating OR fetching records

  • Saroj Das Profile Picture
    3,355 on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Hi Amit, have you added your live Id in web.config. Please look into this. This might help.

    crmbook.powerobjects.com/.../types-of-authentication

    Thanks,

    Saroj

  • Community Member Profile Picture
    on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Yes, I added the ID and password which is domain specific.

    Dynamic CRM is installed "on-premise".

    Do you have any idea about PHP library for integration?

  • Saroj Das Profile Picture
    3,355 on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Hi Amit, i dont know PHP. But from the error it seems like it is related to security. Are you using SOAP end point and which version means 2007 or 2011. Please let me know.

    regards,

    Saroj

  • Community Member Profile Picture
    on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    It is 2011 and working with Dynamics 2011 online but it has issue with "On premise" version

  • Saroj Das Profile Picture
    3,355 on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Hi Amit, can you please provide your SOAP envelope code so that i can refer.

    Saroj

  • Community Member Profile Picture
    on at
    RE: InvalidSecurity: An error occurred when verifying security for the message.

    Can you please check the issue in following codes..

    Request:

    <s:Envelope xmlns:s="www.w3.org/.../soap-envelope&quot;

    xmlns:a="www.w3.org/.../addressing&quot;

    xmlns:u="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-utility-1.0.xsd&quot;>

     <s:Header>

    <a:Action s:mustUnderstand="1">

    schemas.microsoft.com/.../Create&lt;/a:Action>

    <a:MessageID>

    urn:uuid:7c2a16f2-9574-4446-a325-33e1cf7e3a16</a:MessageID>

    <a:ReplyTo>

     <a:Address>

     www.w3.org/.../anonymous&lt;/a:Address>

    </a:ReplyTo>

    <VsDebuggerCausalityData xmlns="schemas.microsoft.com/.../servicemodelsink&quot;>

    uIDPozJEz+P/wJdOhoN2XNauvYcAAAAAK0Y6fOjvMEqbgs9ivCmFPaZlxcAnCJ1GiX+Rpi09nSYACQAA</VsDebuggerCausalityData>

    <a:To s:mustUnderstand="1">

    xxx.xxxxxxxxxxxxxx.com/.../Organization.svc;/a:To>

    <o:Security s:mustUnderstand="1"

    xmlns:o="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;>

     <u:Timestamp u:Id="_0">

    <u:Created>2014-11-26T06:23:19.00Z</u:Created>

    <u:Expires>2014-11-27T06:23:19.00Z</u:Expires>

     </u:Timestamp>

     <EncryptedData Id="Assertion0"

     Type="www.w3.org/.../xmlenc;

     xmlns="www.w3.org/.../xmlenc;>

    <EncryptionMethod Algorithm="www.w3.org/.../xmlenc;>

    </EncryptionMethod>

    <ds:KeyInfo xmlns:ds="www.w3.org/.../xmldsig;>

     <EncryptedKey>

    <EncryptionMethod Algorithm="www.w3.org/.../xmlenc;>

    </EncryptionMethod>

    <ds:KeyInfo Id="keyinfo">

     <wsse:SecurityTokenReference xmlns:wsse="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;>

    <wsse:KeyIdentifier EncodingType="docs.oasis-open.org/.../oasis-200401-wss-soap-message-security-1.0;

    ValueType="docs.oasis-open.org/.../oasis-200401-wss-x509-token-profile-1.0;>

    VrPTiMUGicDu5XJqdzD6SLXa8fY=</wsse:KeyIdentifier>

     </wsse:SecurityTokenReference>

    </ds:KeyInfo>

    <CipherData>

     <CipherValue>xxxxxxx xxxxxxxx xxxxxxxxx xxxxxxxxx</CipherValue>

    </CipherData>

     </EncryptedKey>

    </ds:KeyInfo>

    <CipherData>

     <CipherValue>xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxx</CipherValue>

    </CipherData>

     </EncryptedData>

    </o:Security>

     </s:Header><s:Body>

                       <Create xmlns="schemas.microsoft.com/.../Services&quot;>

                       <entity xmlns:b="schemas.microsoft.com/.../Contracts&quot; xmlns:i="www.w3.org/.../XMLSchema-instance&quot;>

                           <b:Attributes xmlns:c="schemas.datacontract.org/.../System.Collections.Generic&quot;><b:KeyValuePairOfstringanyType><c:key>subject</c:key><c:value i:type="d:string" xmlns:d="www.w3.org/.../XMLSchema&quot;>xxxxx xx xxxxx</c:value></b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType><c:key>firstname</c:key><c:value i:type="d:string" xmlns:d="www.w3.org/.../XMLSchema&quot;>xxxx</c:value></b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType><c:key>emailaddress1</c:key><c:value i:type="d:string" xmlns:d="www.w3.org/.../XMLSchema&quot;>xxxx@xxxxx.com/c:value></b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType><c:key>leadsourcecode</c:key><c:value xmlns:b="schemas.microsoft.com/.../Contracts&quot; i:type="b:OptionSetValue"><b:Value>8</b:Value></c:value></b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType><c:key>donotsendmm</c:key><c:value i:type="d:boolean" xmlns:d="www.w3.org/.../XMLSchema&quot;>1</c:value></b:KeyValuePairOfstringanyType><b:KeyValuePairOfstringanyType><c:key>description</c:key><c:value i:type="d:string" xmlns:d="www.w3.org/.../XMLSchema&quot;>xxxx xxxxx</c:value></b:KeyValuePairOfstringanyType></b:Attributes>

                           <b:EntityState i:nil="true"/>

                           <b:FormattedValues xmlns:c="schemas.datacontract.org/.../System.Collections.Generic&quot;/>

                           <b:Id>00000000-0000-0000-0000-000000000000</b:Id>

                           <b:LogicalName>lead</b:LogicalName>

                           <b:RelatedEntities xmlns:c="schemas.datacontract.org/.../System.Collections.Generic&quot;/>

                       </entity>

                       </Create>

                   </s:Body>

               </s:Envelope>

    <p>

    </p>Response = <s:Envelope xmlns:s="www.w3.org/.../soap-envelope&quot; xmlns:a="www.w3.org/.../addressing&quot;><s:Header><a:Action s:mustUnderstand="1">www.w3.org/.../fault&lt;/a:Action><a:RelatesTo>urn:uuid:7c2a16f2-9574-4446-a325-33e1cf7e3a16</a:RelatesTo></s:Header><s:Body><s:Fault><s:Code><s:Value>s:Sender</s:Value><s:Subcode><s:Value xmlns:a="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd&quot;>a:InvalidSecurity</s:Value></s:Subcode></s:Code><s:Reason><s:Text xml:lang="en-US">An error occurred when verifying security for the message.</s:Text></s:Reason></s:Fault></s:Body></s:Envelope><s:Text xml:lang="en-US">An error occurred when verifying security for the message.</s:Text>

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
HR-09070029-0 Profile Picture

HR-09070029-0 2

#1
UllrSki Profile Picture

UllrSki 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans