permaculture playing cards*
The moose likes Web Services and the fly likes Problem creating Accounts using DynamicEntity in MsCrm4.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Problem creating Accounts using DynamicEntity in MsCrm4.0" Watch "Problem creating Accounts using DynamicEntity in MsCrm4.0" New topic

Problem creating Accounts using DynamicEntity in MsCrm4.0

Yuva Kumar

Joined: Jul 18, 2008
Posts: 12
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?


Code 1: This works in same CRM, MSCrm 4.0

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


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

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();
StringProperty lastname = new StringProperty();
lastname.setValue("Aaberg using Dyn Entity-3");

DynamicEntity contactEntity = new DynamicEntity();

Property[] property = new Property[] {firstname, lastname};

TargetCreateDynamic targetCreate = new TargetCreateDynamic();
CreateRequest create = new CreateRequest();

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

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

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

Failed Response :

<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="" xmlns:xsi="" xmlns:xsd=""><soap:Body><soap:Fault><faultcode>soap:Client</faultcode><faultstring>Server was unable to process request.</faultstring><detail><error>
<description>An unexpected error occurred.</description>
It is sorta covered in the JavaRanch Style Guide.
subject: Problem creating Accounts using DynamicEntity in MsCrm4.0
Similar Threads
SOAP Fault for SOAP Action property
how to set an attribute like SOAPAction in the Header?
How do I catch a user define exception on the client (SOAP/JAX-RPC/WSDL)
SOAP Exception : did not recognize the value of HTTP Header SOAPAction:
xml:lang in faultstring