Win a copy of Spring Boot in Practice this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

Problem creating Accounts using DynamicEntity in MsCrm4.0

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to create an Account using DynamicEntity in MsCrm4.0. Following is the code snippet. I would like to mention the following:


1. The same code(ref Code 2 below) creates an Account successfully when used in MsCrm3.0

2. I am able to create Account in MsCrm4.0, if I dont use DynamicEntity(ref Code 1 below).

3. The MsCrm4.0, the IIS security - IWA and Basic authentication is enabled.

Could someone pl suggest what am I doing wrong w.r.t MsCrm 4.0? I dont see any issue with security, as I am able to create record if I use Code 1 below. Maybe I am wrong?



Regards

Code 1: This works in same CRM, MSCrm 4.0
-------
try{

Account account=new Account();
account.setName("ac crm3-2");

account.setAddress1_city("cityy1");

String id = binding.create(account);
System.out.println("Account id = "+id);
}catch(Exception e){
e.printStackTrace();
}


Code 2 : This DOESNT work in same CRM, MSCrm 4.0
------
try {


// Set the properties of the contact using property objects.
StringProperty firstname = new StringProperty();
firstname.setName("firstname");
firstname.setValue("Jesper");
StringProperty lastname = new StringProperty();
lastname.setName("lastname");
lastname.setValue("Aaberg using Dyn Entity-3");



DynamicEntity contactEntity = new DynamicEntity();
contactEntity.setName("Contact");

Property[] property = new Property[] {firstname, lastname};
contactEntity.setProperties(property);

TargetCreateDynamic targetCreate = new TargetCreateDynamic();
targetCreate.setEntity(contactEntity);
CreateRequest create = new CreateRequest();
create.setTarget(targetCreate);



// Execute the request.
CreateResponse created = (CreateResponse)binding.execute(create);

System.out.println("\nContact Created : "+created.getId());


} catch (RemoteException e) {
e.getLocalizedMessage();
e.getMessage();
System.out.println("Create result RemoteException "+e);
e.printStackTrace();
}


Failed Response :

<?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"><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server was unable to process request.</faultstring><detail><error>
<code>0x80040216</code>
<description>An unexpected error occurred.</description>
<type>Platform</type>
</error></detail></soap:Fault></soap:Body></soap:Envelope>
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic