Hello,
I have installed a MS CRM 2016 on premise on an Azure VM which works fine.
I have to develop a web serices client using java. I have generated my stubs with apache axis2 and I can call create, retrieve, retrieveMultiple.
Example :
public static void retrieveById(String entity, String sid) { try { OrganizationServiceStub stub = new OrganizationServiceStub(endPoint); Retrieve r = new OrganizationServiceStub.Retrieve(); r.setEntityName(entity); OrganizationServiceStub.Guid id = new OrganizationServiceStub.Guid(); id.setGuid(sid); r.setId(id); OrganizationServiceStub.ColumnSet cs = new OrganizationServiceStub.ColumnSet(); cs.setAllColumns(true); r.setColumnSet(cs); stub = stubDecorator(stub); OrganizationServiceStub.RetrieveResponse rr = stub.retrieve(r); Entity e = rr.getRetrieveResult(); System.out.println("Uuid : " + e.getId()); System.out.println("To String : " + e.toString()); AttributeCollection attrs = e.getAttributes(); KeyValuePairOfstringanyType[] kvs = attrs.getKeyValuePairOfstringanyType(); for (KeyValuePairOfstringanyType kv : kvs) { System.out.println("\t" + kv.getKey() + " : " + kv.getValue()); } System.out.println("--------------------------"); logRequest(stub); } catch (RemoteException | IOrganizationService_Retrieve_OrganizationServiceFaultFault_FaultMessage e) { // TODO Auto-generated catch block e.printStackTrace(); } }
Now I want to call the 'execute' methode to liast all entities 'RetrieveAllEntities'. Here is what I have done:
try { stub = new OrganizationServiceStub(endPoint); Execute ex = new OrganizationServiceStub.Execute(); OrganizationRequest or = new OrganizationRequest(); or.setRequestName("RetrieveAllEntities"); ParameterCollection pc = new ParameterCollection(); KeyValuePairOfstringanyType kv = new KeyValuePairOfstringanyType(); kv.setKey("EntityFilters"); EntityFilters ef = new EntityFilters(); ef.setEntityFilters_type0(new EntityFilters_type0[]{EntityFilters_type0.Entity}); kv.setValue(ef); pc.addKeyValuePairOfstringanyType(kv); or.setParameters(pc); ex.setRequest(or); stub = stubDecorator(stub); ExecuteResponse resp = stub.execute(ex); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); }
It seems good for me but I have this error in response:
<?xml version="1.0" encoding="UTF-8"?> <s:Envelope xmlns:s="schemas.xmlsoap.org/.../envelope"> <s:Body> <s:Fault> <faultcode xmlns:a="schemas.microsoft.com/.../dispatcher">a:DeserializationFailed</faultcode> <faultstring xml:lang="en-US">The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter schemas.microsoft.com/.../Services:request. The InnerException message was 'Element value from namespace schemas.datacontract.org/.../System.Collections.Generic cannot have child contents to be deserialized as an object. Please use XmlNode[] to deserialize this pattern of XML.'. Please see InnerException for more details.</faultstring> </s:Fault> </s:Body> </s:Envelope>
Here is the generated soap request:
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="schemas.xmlsoap.org/.../envelope"> <soapenv:Header/> <soapenv:Body> <ns5:Execute xmlns:ns5="schemas.microsoft.com/.../Services"> <ns5:request> <Parameters xmlns="schemas.microsoft.com/.../Contracts"> <KeyValuePairOfstringanyType> <ns3:key xmlns:ns3="schemas.datacontract.org/.../System.Collections.Generic">EntityFilters</ns3:key> <s4:value xmlns:s4="schemas.datacontract.org/.../System.Collections.Generic">Entity</s4:value> </KeyValuePairOfstringanyType> </Parameters> <ns2:RequestName xmlns:ns2="schemas.microsoft.com/.../Contracts">RetrieveAllEntities</ns2:RequestName> </ns5:request> </ns5:Execute> </soapenv:Body> </soapenv:Envelope>
How should I configure my query to not have error ?
Best regards.
*This post is locked for comments
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156