我正在尝试使用Salesforce SOAP API更新Salesforce对象。 Salesforce Update调用无法更新对象并抛出以下异常:
org.apache.axis2.AxisFault: Unable to find a deserializer for the type common.api.soap.wsdl.QueryResult Error Id: 322073137-21025 (-848058548)
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:531)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:375)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at com.sforce.soap.enterprise.SforceServiceStub.update(SforceServiceStub.java:11289)
at com.dps.api.salesforce.crud.SalesforceCRUDImpl.updateAccount(SalesforceCRUDImpl.java:139)
at com.dps.api.crm.service.CRMServiceImpl.addEditPersonalInfoObject(CRMServiceImpl.java:109)
at com.dps.api.controller.ConfiguationController.updatePersonalInfo(ConfiguationController.java:145)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:690)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:945)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:874)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:757)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50)
at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:154)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:155)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:368)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:671)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:930)
at java.lang.Thread.run(Thread.java:619)
我花了几个小时在互联网上搜索,但没有解决这个问题! 知道如何通过吗?
答案 0 :(得分:1)
迟到总比没有好,对吧?我今天花了几个小时来解决这个不合规定的错误,直到最终找到原因。
我在尝试更新商机记录列表时收到此消息。原来这是因为我正在更新我从查询中获得的同一个对象,并且该对象中的一个(或多个)查询字段不可写。我认为它是“recordtype.name”或“amount”。我最终做的是为了更新目的创建一个新的Opportunity对象实例。
1)查询商机记录,包括相关列表和某些不可写字段。
2)不要更新从步骤1中的查询中获得的对象,而是创建新的新机会列表以进行更新,并仅填充要更新的字段。
ArrayList<Opportunity> queryOpps = apiCaller.executeQuery(queryString);
ArrayList<Opportunity> updateOpps = new ArrayList<Opportunity>();
for (Opportunity queryOpp : queryOpps) {
// some condition for update
if (queryOpp.getAmount() < queryOpp.getProjected_Revenue__c()) {
// now, instead of adding the queryOpp to the update list,
// create a new Opportunity object.
Opportunity updateOpp = new Opportunity();
updateOpp.setId(queryOpp.getId());
updateOpp.setStageName("Needs Review");
updateOpps.add(updateOpp);
}
}
apiCaller.update(updateOpps);
答案 1 :(得分:1)
当您使用具有子对象的子SOQL的单个SOQL语句获取父对象和子对象记录,然后您尝试在父记录上执行更新时,由于父记录中存在子记录列表,我们会收到此错误。简单的解决方法是在父对象内将子记录列表(查询结果)设置为null,然后在父对象上执行update。