Tech Support > Microsoft Windows > Windows CRM > SOAP requests, Current User alert, Web Services, CRM 4.0
SOAP requests, Current User alert, Web Services, CRM 4.0
Posted by Jeremiah J. Isaacson on May 19th, 2008


Using CRM 4.0....

I have a question you may be able to help me with *hopefully* I've tested
and searched all over with no luck.

I am trying to perform a SOAP request in order to display/alert the current
system user. As you will notice if you use my "universal" CRM 4.0 source
code, it is returning false and with no data contained in my request. Can you
help?





Warm regards,







var data= GetInformationFromAnEntity();

if(data != null)
{

alert("This thing has data");
}


function GetInformationFromAnEntity()
{
var xml = "" +
"<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
"<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\"
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">" +
GenerateAuthenticationHeader() +
" <soap:Body>" +
" <RetrieveMultiple
xmlns=\"http://schemas.microsoft.com/crm/2007/WebServices\">" +
" <query xmlns:q1=\"http://schemas.microsoft.com/crm/2006/Query\"
xsi:type=\"q1:QueryExpression\">" +
" <q1:EntityName>systemuser</q1:EntityName>" +
" <q1:ColumnSet xsi:type=\"q1:ColumnSet\">" +
" <q1:Attributes>" +
" <q1:Attribute>systemuserid</q1:Attribute>" +
" <q1:Attribute>fullname</q1:Attribute>" +
" </q1:Attributes>" +
" </q1:ColumnSet>" +
" <q1istinct>false</q1istinct>" +
" <q1:Criteria>" +
" <q1:FilterOperator>And</q1:FilterOperator>" +
" <q1:Conditions>" +
" <q1:Condition>" +
" <q1:AttributeName>systemuserid</q1:AttributeName>" +
" <q1:Operator>EqualUserId</q1:Operator>" +
" </q1:Condition>" +
" </q1:Conditions>" +
" </q1:Criteria>" +
" </query>" +
" </query>" +
" </RetrieveMultiple>" +
" </soap:Body>" +
"</soap:Envelope>" +
"";

var xmlHttpRequest = new ActiveXObject("Msxml2.XMLHTTP");

xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx", false);
xmlHttpRequest.setRequestHeader("SOAPAction","
http://schemas.microsoft.com/crm/2007/WebServices/RetrieveMultiple");
xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
xmlHttpRequest.setRequestHeader("Content-Length", xml.length);
xmlHttpRequest.send(xml);

var resultXml = xmlHttpRequest.responseXML;
return resultXml;

}

Posted by Darren Liu on May 19th, 2008


xmlHttpRequest.Open("POST", "/mscrmservices/2007/CrmService.asmx",
false);

Try to Change the URL from 2007 to 2006.

xmlHttpRequest.Open("POST", "/mscrmservices/2006/CrmService.asmx",
false);

you can try to use a small JavaScript Web Service tool from Michael
Hoehne, www.stunnware.com to help you with the JS Web Service.

Hope this helps!

Darren Liu, Microsoft CRM MVP
Crowe
http://www.crowecrm.com

On May 19, 3:24*pm, Jeremiah J. Isaacson
<JeremiahJIsaac...@discussions.microsoft.com> wrote: