My previous blog post on calling MS-CRM 2011 web services using SoapUI applies. The only thing you have to do extra (assuming your services are secured using NTLM on the server side), is enter your username, password and domain under the 'HTTP Security Settings' section (found in the Transport tab).
Thursday, December 29, 2011
Wednesday, December 28, 2011
Calling Microsoft CRM 2011 Web Services from SoapUI
I will assume you are very familiar with SoapUI and have at least a basic understanding of the MS-CRM 2011 WCF interface. I also assume you are using NTLM to authenticate
(the next part of my journey will be see if i can get WS-Security to work).
1) Import the WSDL from the CRM Server: Start a new SoapUI project and get the wsdl from:
http://your_box_name:yourport/your_crm_context_root/XRMServices/2011/Organization.svc?wsdl=wsdl0
2) I chose just a simple Retrieve operation to get back a single Contact. I changed the stub XML request from:
<!--
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:con="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soap:Header/>
<soap:Body>
<ser:Retrieve>
<!--Optional:-->
<ser:entityName>?</ser:entityName>
<!--Optional:-->
<ser:id>?</ser:id>
<!--Optional:-->
<ser:columnSet>
<!--Optional:-->
<con:AllColumns>?</con:AllColumns>
<!--Optional:-->
<con:Columns>
<!--Zero or more repetitions:-->
<arr:string>?</arr:string>
</con:Columns>
</ser:columnSet>
</ser:Retrieve>
</soap:Body>
</soap:Envelope>
-->
To:
<!--
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://schemas.microsoft.com/xrm/2011/Contracts/Services" xmlns:con="http://schemas.microsoft.com/xrm/2011/Contracts" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
<soap:Body>
<ser:Retrieve>
<ser:entityName>contact</ser:entityName>
<ser:id>c3d945f0-9824-e111-b825-005056a30027</ser:id>
<ser:columnSet>
<con:AllColumns>false</con:AllColumns>
<con:Columns>
<arr:string>fullname</arr:string>
</con:Columns>
</ser:columnSet>
</ser:Retrieve>
</soap:Body>
</soap:Envelope>
-->
You will notice i had to change the soap envelope from the default generated: "http://www.w3.org/2003/05/soap-envelope" to "http://schemas.xmlsoap.org/soap/envelope/"
3) Enter the following HTTP request headers into SoapUI:
SOAPAction http://schemas.microsoft.com/xrm/2011/Contracts/Services/IOrganizationService/Retrieve
Accept application/xml, text/xml, */*
Content-Type text/xml; charset=utf-8
4) Set your endpoint to: http://your_box_name_and_port/your_crm_context_root/XRMServices/2011/Organization.svc/web
You should get some data back.
If you get a "bad request", check your SOAP Message.
If you get a "The server cannot service the request because the media type is unsupported.", check your Content-Type.
(the next part of my journey will be see if i can get WS-Security to work).
1) Import the WSDL from the CRM Server: Start a new SoapUI project and get the wsdl from:
http://
2) I chose just a simple Retrieve operation to get back a single Contact. I changed the stub XML request from:
<soap:Header/>
<soap:Body>
<ser:Retrieve>
<!--Optional:-->
<ser:entityName>?</ser:entityName>
<!--Optional:-->
<ser:id>?</ser:id>
<!--Optional:-->
<ser:columnSet>
<!--Optional:-->
<con:AllColumns>?</con:AllColumns>
<!--Optional:-->
<con:Columns>
<!--Zero or more repetitions:-->
<arr:string>?</arr:string>
</con:Columns>
</ser:columnSet>
</ser:Retrieve>
</soap:Body>
</soap:Envelope>
-->
To:
<soap:Body>
<ser:Retrieve>
<ser:entityName>contact</ser:entityName>
<ser:id>c3d945f0-9824-e111-b825-005056a30027</ser:id>
<ser:columnSet>
<con:AllColumns>false</con:AllColumns>
<con:Columns>
<arr:string>fullname</arr:string>
</con:Columns>
</ser:columnSet>
</ser:Retrieve>
</soap:Body>
</soap:Envelope>
-->
You will notice i had to change the soap envelope from the default generated: "http://www.w3.org/2003/05/soap-envelope" to "http://schemas.xmlsoap.org/soap/envelope/"
Accept application/xml, text/xml, */*
Content-Type text/xml; charset=utf-8
You should get some data back.
If you get a "bad request", check your SOAP Message.
If you get a "The server cannot service the request because the media type is unsupported.", check your Content-Type.
Subscribe to:
Comments (Atom)