function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Erik ForsbergErik Forsberg 

update API problem

I'm getting a weird error doing a partner API update call. This is what I send and receive.

SOAP message sent:

http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
   
      XXXXXXXXXX
   
 
 
   
     
        00T30000001Tlr5EAC
        escription>Pamtest modified on this device again.escription>
        In Progress
        00130000001LyMAAA0
        2004-01-19T00:00:00.000Z
     
   
 

SOAP response rcvd:

http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 
 
   soapenv:Server.userException
   org.xml.sax.SAXException: Could not find deserializer for field: WhatId of type {urn:enterprise.soap.sforce.com}ID
  
 
 

If I leave out the WhatId field in the update message, the update is successful.

Any idea ?

 

Erik ForsbergErik Forsberg

Hmm, how can I get the XML tags to show here ??????

 

Erik ForsbergErik Forsberg

OK, I replaced the XML tags with () so we can see what I wanted to send.

SOAP message sent:
(?xml version="1.0" encoding="UTF-8"?)
(soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
                  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance")
  (soapenv:Header)
    (ns1:SessionHeader xmlns:ns1="SoapService")
      (ns2:sessionId xmlns:ns2="urn:partner.soap.sforce.com")XXXXXXXXXX(/ns2:sessionId)
    (/ns1:SessionHeader)
  (/soapenv:Header)
  (soapenv:Body)
    (update xmlns="urn:partner.soap.sforce.com")
      (sObjects xsi:type="ns3:task" xmlns:ns3="urn:sobject.partner.soap.sforce.com")
        (ns3:Id)00T30000001Tlr5EAC(/ns3:Id)
        (ns3escription)Pamtest modified on this device again.(/ns3escription)
        (ns3:Status)In Progress(/ns3:Status)
        (ns3:WhatId)00130000001LyMAAA0(/ns3:WhatId)
        (ns3:ActivityDate)2004-01-19T00:00:00.000Z(/ns3:ActivityDate)
      (/sObjects)
    (/update)
  (/soapenv:Body)
(/soapenv:Envelope)

SOAP response rcvd:
(?xml version="1.0" encoding="UTF-8"?)
(soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance")
 (soapenv:Body)
  (soapenv:Fault)
   (faultcode)soapenv:Server.userException(/faultcode)
   (faultstring)org.xml.sax.SAXException: Could not find deserializer for field: WhatId of type {urn:enterprise.soap.sforce.com}ID(/faultstring)
   (detail/)
  (/soapenv:Fault)
 (/soapenv:Body)
(/soapenv:Envelope)

 

DevAngelDevAngel

Hi Erik,

There is definitely a namespace problem, but I'm having trouble identifying it.  Here is a message that works, maybe you can figure out the difference.  The things that stands out  for me is the SessionHeader namespace "SoapService" and the namespace mentioned in the fault return "urn.enterprise.soap.sforce.com".  Are you sending the request to a url that ends in "/services/Soap/u/2.5"?

Erik ForsbergErik Forsberg

Yes, all POSTs are done to the Soap/U/2.5 address.

We only use the partner API so I also wondered about that enterprise urn.

 

Erik ForsbergErik Forsberg

Hmm, cant see your example of a "working" message ??

 

adamgadamg
Not sure what Dave had to tried to post, but you should be able to find examples of working messages in the documentation.
Erik ForsbergErik Forsberg

Yes, I know, and my failing example is virtually identical to the documentation example.

And the error is field-specific, it is only the WhatId field that causes a problem, if I

dont try to modify the WhatId field it works fine.

 

DevAngelDevAngel

Hi Erik,

Sorry about not including the message earlier, but here it is.

POST http://na1-api.salesforce.com/services/Soap/u/2.5 HTTP/1.1

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 1.1.4322.573)

Content-Type: text/xml; charset=utf-8

SOAPAction: ""

Content-Length: 852

Expect: 100-continue

Proxy-Connection: Keep-Alive

Host: na1-api.salesforce.com

 

<?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:Header>
         <SessionHeader xmlns="urn:partner.soap.sforce.com">
            <sessionId>cWinHyKoN8Pom.fSqmbTZJ9fsZ8diduZzS1ev7U3JhLMNz3Ehimr9ylGAGXd5tFkvQIyVXXsm6o9EQLlsQlaBfbtzKggVlhL</sessionId>
         </SessionHeader>
      </soap:Header>
      <soap:Body>
         <update xmlns="urn:partner.soap.sforce.com">
            <sObjects>
               <type xmlns="urn:sobject.partner.soap.sforce.com">Task</type>
               <Id xmlns="urn:sobject.partner.soap.sforce.com">00T30000001SkKK</Id>
               <Description xmlns="">New Description</Description>
               <Status xmlns="">In Progress</Status>
               <WhatId xmlns="">001300000019kt7</WhatId>
               <ActivityDate xmlns="">2004-01-21T12:55:10.00Z</ActivityDate>
            </sObjects>
         </update>
      </soap:Body>
   </soap:Envelope/>

Message Edited by DevAngel on 01-21-2004 12:59 PM

DevAngelDevAngel

Hi Erik,

On further review, the type of the object for update should be a child element of the <sObject> tag.  Having the type in the attribute of the <sObject> tag is indicative of the way the enterprise wsdl generated clients get serialized.  In the enterprise wsdl, all the objects are subclassed from the sObject and Soap indicates this by "type-ing" the sObject with a type attribute.

In the partner wsdl, on the other hand, the sObject is never sub-class and therefore should not have the type attribute.  I'm wondering if there is a mingling of the enterprise generated proxy classes and partner url and API usage happening here.

What development environment do you use?

Erik ForsbergErik Forsberg

That made sense. I'm writing my own C code for this so its not automatic to

pick up minor changes in the API. My code was based on the examples in the

API documentation, which is based on the enterprise version, so that style

was also present in my partner API version. Works fine now.

 

Thanks.