Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

Sending a Retrieve request via SOAP

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

I am currently doing some preliminary testing using SOAPUI and have hit the first stumbling block with retrieving data from the system, I have generated my CipherValues and KeyIdentifier but am unsure of how to implement these in a security header for the retrieve message.

I am struggling to find any information regarding SOAP connections to Dynamics CRM Online, so I have extracted what I assume to be the security header from the SDK example project and have attempted the below message structure with no success.

Does anyoune have any examples with the security header? or know where i can find some more infomation on testing with SOAP

Endpoint URL: https://[SITE ADDRESS].api.crm.dynamics.com/XRMServices/2011/Organization.svc/web

<soap:Envelope xmlns:soap="www.w3.org/.../soap-envelope" xmlns:ser="schemas.microsoft.com/.../Services" xmlns:con="schemas.microsoft.com/.../Contracts" xmlns:arr="schemas.microsoft.com/.../Arrays">
   <soap:Header>
<EncryptedData     xmlns="www.w3.org/.../xmlenc"     Id="Assertion0"     Type="www.w3.org/.../xmlenc">
	<EncryptionMethod         Algorithm="www.w3.org/.../xmlenc"/>
	<ds:KeyInfo         xmlns:ds="www.w3.org/.../xmldsig">
		<EncryptedKey>
			<EncryptionMethod                 Algorithm="www.w3.org/.../xmlenc"/>
			<ds:KeyInfo Id="keyinfo">
				<wsse:SecurityTokenReference       xmlns:wsse="docs.oasis-open.org/.../oasis-200401-wss-wssecurity-secext-1.0.xsd">
					<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">[IDENTIFIER]</wsse:KeyIdentifier>
				</wsse:SecurityTokenReference>
			</ds:KeyInfo>
			<CipherData>
				<CipherValue>[FIRST VALUE]</CipherValue>
			</CipherData>
		</EncryptedKey>
	</ds:KeyInfo>
	<CipherData>
		<CipherValue>[SECOND VALUE]</CipherValue>
	</CipherData>
</EncryptedData>
	</soap:Header>
   <soap:Body>
      <ser:Retrieve>
         <!--Optional:-->
         <ser:entityName>contact</ser:entityName>
         <!--Optional:-->
         <ser:id>5CDAA018-1803-E611-811F-C4346BAC0910</ser:id>
         <!--Optional:-->
         <ser:columnSet>
            <!--Optional:-->
            <con:AllColumns>false</con:AllColumns>
            <!--Optional:-->
            <con:Columns>
               <!--Zero or more repetitions:-->
               <arr:string>fullname</arr:string>
            </con:Columns>
         </ser:columnSet>
      </ser:Retrieve>
   </soap:Body>
</soap:Envelope>

- Additional SOAP Header Paramaters -

Content-Type: text/xml; charset=utf-8

SOAPAction: schemas.microsoft.com/.../Retrieve

*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sending a Retrieve request via SOAP

    Hi Scott,

    Thanks for your assistance it looks i should be utalizing the new the new webAPI using OAuth as i will be accessing Dynamics from an external system and will need to use the SOAP endpoint.

  • ScottDurow Profile Picture
    ScottDurow 19 on at
    RE: Sending a Retrieve request via SOAP

    How did you get on? Do you need any more help?

  • Verified answer
    ScottDurow Profile Picture
    ScottDurow 19 on at
    RE: Sending a Retrieve request via SOAP

    Of course if you are using C# - you should use the OrganizationServiceProxy class in the SDK assemblies - www.microsoft.com/.../details.aspx

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 19 on at
    RE: Sending a Retrieve request via SOAP

    Hi,

    If you are accessing Dynamics crm from an external system then you are probably better of using the new WebAPI.

    https://msdn.microsoft.com/en-us/library/mt593051.aspx

    If you really need to use the SOAP endpoint then you should use OAuth - see https://msdn.microsoft.com/en-us/library/mt593051.aspx

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: Sending a Retrieve request via SOAP

    Hi Scott,

    I appreciate the Quick response, I am probably using the wrong endpoint when downloading the Organization.wsdl the endpoint is

    https://[SITE ADDRESS].api.crm.dynamics.com/XRMServices/2011/Organization.svc

    Would I then requite a security header when Sending a Retrieve request via SOAP

    I am trying to break down the individual steps from the SDK sample project and see if I can replicate the process using SOAPUI,

    e.g.

    Security token request (I have successfully retrieved the values for the security header)

    retrieve contact / account / opportunity requests

    update opportunity request

    delete opportunity  request

    Thanks for your assistance

    Ryan

  • Suggested answer
    ScottDurow Profile Picture
    ScottDurow 19 on at
    RE: Sending a Retrieve request via SOAP

    Hi,

    When using the Organization.svc/web endpoint, you don't need the security header because it's handled by cookies that are created by the user authentication when they log on.

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans