• jkyrohonka
  • NEWBIE
  • 0 Points
  • Member since 2003

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies

Hi,

Could someone give a hint to why the following SOAP batch delete
call returns an error. What I would like to is to delete several
tasks (or accounts.. etc.).

The error is 1208, 'batch arguments 0 must be struct'
(inside an array, one error for both the first ("batch arguments 0")
and the second ("batch arguments 1") input array)

<?xml version="1.1" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/1999/XMLSchema"
 xmlns:tns="salesforce"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

 <s:Header>
  <tns:headerStruct>
   <session_id xsi:type='xsd:string'> . . . </session_id>
   <version xsi:type='xsd:string'>2.0</version>
  </tns:headerStruct>
 </s:Header>

 <s:Body>
  <m:batch xmlns:m='sfconnector:SalesforceConnector'>

   <type xsi:type='xsd:string'>task</type>
   <operation xsi:type='xsd:string'>delete<operation>

   <arguments xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[2]">

    <value xsi:type='SOAP-ENC:Array'SOAP-ENC:arrayType="xsd:string[1]">
     <id xsi:type='xsd:string'>00T30000...</id>
    </value>

    <value xsi:type='SOAP-ENC:Array'SOAP-ENC:arrayType="xsd:string[1]">
     <id xsi:type='xsd:string'>00T30000...</id>
    </value>

   </arguments>

  </m:batch>
 </s:Body>

</s:Envelope>


There is the 'operation' member, and the 'arguments' member is an array with
two sub-arrays, one for each task to be deleted. Each sub-array contains a
single 'id' member.

The documentation says to use an array of structs or a maps that contain a
single 'id' member for each target of a batch delete, if I understood
correctly.

What actually are the differences between an array, a struct and a map from
the sforce point of view?


Thank you,

 Jussi

Hi,

I was unable to express myself more concise, sorry.

Does anyone know if there is a problem with the following soap envelope.
I am trying to do an insert call.
The session id removed for clarity.

<?xml version="1.1" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
  xmlns:tns="salesforce"
  xmlns:SOAP-ENC="http://www.schemas.xmlsoap.org/soap/encoding">
 <soap:Header>
  <tns:headerStruct>
   <session_id xsi:type='xsd:string'> . . . </session_id>
   <version xsi:type='xsd:string'>2.0</version>
  </tns:headerStruct>
 </soap:Header>
 <s:Body>
  <m:insert xmlns:m='sfconnector:SalesforceConnector'>
   <type xsi:type='xsd:string'>account</type>
   <record xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:mapEntry[1]">
    <value xsi:type='tns:mapEntry'>
     <key xsi:type='xsd:string'>name</key>
     <value xsi:type='xsd:string'>fredin akkountti 54321</value>
    </value>
   </record>
  </m:insert>
 </s:Body>
</s:Envelope>

Sending it gives a fault. Faultcode 1101, record field must be struct.

The next thing I tried was to use the format in the SOAP examples, that is

<?xml version="1.1" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
  xmlns:SOAP-ENC="http://www.schemas.xmlsoap.org/soap/encoding">

 <soap:Header>
  <tns:headerStruct>
   <session_id xsi:type='xsd:string'> . . . </session_id>
   <version xsi:type='xsd:string'>2.0</version>
  </tns:headerStruct>
 </soap:Header>

 <s:Body>
  <q1:insert xmlns:q1="sfconnector:SalesforceConnector">
    <type xsi:type="xsd:string">account</type>
    <record href="#id1" />
  </q1:insert>
  <soapenc:Array id="id1" soapenc:arrayType="tns:mapEntry[1]">
    <Item href="#id2" />
  </soapenc:Array>
  <tns:mapEntry id="id2" xsi:type="tns:mapEntry">
    <key xsi:type="xsd:string">name</key>
    <value xsi:type="xsd:string">fredin akkountti 54321</value>
  </tns:mapEntry>
 </s:Body>
</s:Envelope>

the response is the same.

Does it make a difference if the parts of the record parameter are
included through reference?

Also, if the envelope below would be collapsed in to a structure with
no references, would it look like:

  <q1:insert xmlns:q1="sfconnector:SalesforceConnector">
    <type xsi:type="xsd:string">account</type>
    <record xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:mapEntry[1]"/>
     <Item xsi:type="tns:mapEntry">
      <key xsi:type="xsd:string">name</key>
      <value xsi:type="xsd:string">fredin akkountti 54321</value>
     </Item>
    </record>
  </q1:insert>

If so, isn't it said in the WSDL that the name of the elements inside a Map is 'value'?

I was just wondering if this could have anything to do with the error on the struct.

<xsd:complexType name="map">
 <xsd:complexContent>
  <xsd:restriction base="SOAP-ENC:Array">
   <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="value"
                 type="tns:mapEntry"/>                  // ^^^^^^ NAME
   </xsd:sequence>
   <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:mapEntry[]"/>
  </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>


And more. Doesn't a map traditionally map keys to values (as the complex type mapEntry is
defined in the WSDL)? However, e.g. the loginresponse has a map with three items: server_url,
session_id and user_id inside valueMap tags of type "map". (This isn't 'tns:map' map for the
map defined in the WSDL, is it?)

I hope I made my point..

thanks

 - Jussi

 

Hi,

Could someone give a hint to why the following SOAP batch delete
call returns an error. What I would like to is to delete several
tasks (or accounts.. etc.).

The error is 1208, 'batch arguments 0 must be struct'
(inside an array, one error for both the first ("batch arguments 0")
and the second ("batch arguments 1") input array)

<?xml version="1.1" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
 xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
 xmlns:xsd="http://www.w3.org/1999/XMLSchema"
 xmlns:tns="salesforce"
 xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">

 <s:Header>
  <tns:headerStruct>
   <session_id xsi:type='xsd:string'> . . . </session_id>
   <version xsi:type='xsd:string'>2.0</version>
  </tns:headerStruct>
 </s:Header>

 <s:Body>
  <m:batch xmlns:m='sfconnector:SalesforceConnector'>

   <type xsi:type='xsd:string'>task</type>
   <operation xsi:type='xsd:string'>delete<operation>

   <arguments xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="xsd:anyType[2]">

    <value xsi:type='SOAP-ENC:Array'SOAP-ENC:arrayType="xsd:string[1]">
     <id xsi:type='xsd:string'>00T30000...</id>
    </value>

    <value xsi:type='SOAP-ENC:Array'SOAP-ENC:arrayType="xsd:string[1]">
     <id xsi:type='xsd:string'>00T30000...</id>
    </value>

   </arguments>

  </m:batch>
 </s:Body>

</s:Envelope>


There is the 'operation' member, and the 'arguments' member is an array with
two sub-arrays, one for each task to be deleted. Each sub-array contains a
single 'id' member.

The documentation says to use an array of structs or a maps that contain a
single 'id' member for each target of a batch delete, if I understood
correctly.

What actually are the differences between an array, a struct and a map from
the sforce point of view?


Thank you,

 Jussi

Hi,

I was unable to express myself more concise, sorry.

Does anyone know if there is a problem with the following soap envelope.
I am trying to do an insert call.
The session id removed for clarity.

<?xml version="1.1" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
  xmlns:tns="salesforce"
  xmlns:SOAP-ENC="http://www.schemas.xmlsoap.org/soap/encoding">
 <soap:Header>
  <tns:headerStruct>
   <session_id xsi:type='xsd:string'> . . . </session_id>
   <version xsi:type='xsd:string'>2.0</version>
  </tns:headerStruct>
 </soap:Header>
 <s:Body>
  <m:insert xmlns:m='sfconnector:SalesforceConnector'>
   <type xsi:type='xsd:string'>account</type>
   <record xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:mapEntry[1]">
    <value xsi:type='tns:mapEntry'>
     <key xsi:type='xsd:string'>name</key>
     <value xsi:type='xsd:string'>fredin akkountti 54321</value>
    </value>
   </record>
  </m:insert>
 </s:Body>
</s:Envelope>

Sending it gives a fault. Faultcode 1101, record field must be struct.

The next thing I tried was to use the format in the SOAP examples, that is

<?xml version="1.1" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"
  xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
  xmlns:xsd="http://www.w3.org/1999/XMLSchema"
  xmlns:SOAP-ENC="http://www.schemas.xmlsoap.org/soap/encoding">

 <soap:Header>
  <tns:headerStruct>
   <session_id xsi:type='xsd:string'> . . . </session_id>
   <version xsi:type='xsd:string'>2.0</version>
  </tns:headerStruct>
 </soap:Header>

 <s:Body>
  <q1:insert xmlns:q1="sfconnector:SalesforceConnector">
    <type xsi:type="xsd:string">account</type>
    <record href="#id1" />
  </q1:insert>
  <soapenc:Array id="id1" soapenc:arrayType="tns:mapEntry[1]">
    <Item href="#id2" />
  </soapenc:Array>
  <tns:mapEntry id="id2" xsi:type="tns:mapEntry">
    <key xsi:type="xsd:string">name</key>
    <value xsi:type="xsd:string">fredin akkountti 54321</value>
  </tns:mapEntry>
 </s:Body>
</s:Envelope>

the response is the same.

Does it make a difference if the parts of the record parameter are
included through reference?

Also, if the envelope below would be collapsed in to a structure with
no references, would it look like:

  <q1:insert xmlns:q1="sfconnector:SalesforceConnector">
    <type xsi:type="xsd:string">account</type>
    <record xsi:type="SOAP-ENC:Array" SOAP-ENC:arrayType="tns:mapEntry[1]"/>
     <Item xsi:type="tns:mapEntry">
      <key xsi:type="xsd:string">name</key>
      <value xsi:type="xsd:string">fredin akkountti 54321</value>
     </Item>
    </record>
  </q1:insert>

If so, isn't it said in the WSDL that the name of the elements inside a Map is 'value'?

I was just wondering if this could have anything to do with the error on the struct.

<xsd:complexType name="map">
 <xsd:complexContent>
  <xsd:restriction base="SOAP-ENC:Array">
   <xsd:sequence>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="value"
                 type="tns:mapEntry"/>                  // ^^^^^^ NAME
   </xsd:sequence>
   <xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="tns:mapEntry[]"/>
  </xsd:restriction>
 </xsd:complexContent>
</xsd:complexType>


And more. Doesn't a map traditionally map keys to values (as the complex type mapEntry is
defined in the WSDL)? However, e.g. the loginresponse has a map with three items: server_url,
session_id and user_id inside valueMap tags of type "map". (This isn't 'tns:map' map for the
map defined in the WSDL, is it?)

I hope I made my point..

thanks

 - Jussi