Welcome to the "trac"-ing site of soap4r!
[soap4r] [httpclient] [openpgp4u] [pkcs1] [logger] [csv] [vtr]

Ticket #148 (closed enhancement: fixed)

Opened 3 years ago

Last modified 1 year ago

SForce sample: how to create?

Reported by: wrex Assigned to: nahi
Priority: high Milestone: 1.5.6
Component: wsdl4r Version: 1.5
Keywords: Cc:

Description

Thank you for your sample salesforce wsdl sample.

Unfortunately the sample only shows how to query and delete objects, not how to create them.

I'm trying to figure out how to create an object.

Ultimately, I think the resulting XML request must contain something like:

  <env:Body>
    <create xmlns="urn:enterprise.soap.sforce.com"><sObject xsi:type="Account"><
name>Spaceley Sprockets</name></sObject></create>
  </env:Body>

But I can't figure out any way to set the xsi:type attribute on the sObject (or SObjects).

My last attempt looked something like:

so = SObject.new("Account", nil, nil, { :name => "Spaceley Sprockets" })

params = Create.new([so])
result = binding.create(params).result

But when I run this, the wiredump looks like:

= Request

POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.4 (/92, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Mon Sep 12 22:58:03 PDT 2005
Content-Length: 899
Host: na1-api.salesforce.com

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
        <SessionHeader env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <sessionId>0uLbGV0UZKL0L23vzH823Du9kt2hodevLF81DISnUpkDOcPws_l1Py_JRxy.SBGj_LTU568QNJVwD2reihliUxhD2wYHcrlK4SNdGN37zi4=</sessionId>
        </SessionHeader>
        <CallOptions env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <client>client</client>
        </CallOptions>
  </env:Header>
  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects>
        <any>
          <name>Spaceley Sprockets</name>
        </any>
        <type>Account</type>
      </sObjects>
    </create>
  </env:Body>
</env:Envelope>

= Response

HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
Date: Tue, 13 Sep 2005 05:58:06 GMT

0303
<?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</faultcode>
   <faultstring>common.exception.ApiException: Must send a concrete entity type.</faultstring>
   <detail>
    <sf:fault xsi:type="sf:InvalidSObjectFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com">
     <sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>
     <sf:exceptionMessage>Must send a concrete entity type.</sf:exceptionMessage>
     <sf:row>-1</sf:row>
     <sf:column>-1</sf:column>
    </sf:fault>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>
0

I'm sure I'm calling this incorrectly, but I can't figure out what the proper syntax is to set the attributes on the sObjects.

Any help will be GREATLY appreciated.

Thanks.

Change History

09/19/05 09:07:24 changed by anonymous

  • type changed from defect to enhancement.

09/22/05 10:48:55 changed by wrex

There is a slight change in behaviour when using soap4r-1_5_5 with changesets 1629 and 1631 applied.

Using:

mycontact = SObject.new
mycontact.type = "Contact"
mycontact.any = {"LastName" => "Spaceley"}

params = Create.new([mycontact])
result = drv.soap.create(params).result

gives a wiredump of:

= Request

POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.5 (/114, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Wed Sep 21 18:34:01 PDT 2005
Content-Length: 950
Host: na1-api.salesforce.com

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
        <SessionHeader env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <sessionId>X1H2S_foo_bar_baz_blat=</sessionId>
        </SessionHeader>
        <CallOptions env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <client>client</client>
        </CallOptions>
  </env:Header>
  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <n1:type>Contact</n1:type>
        <any>
          <LastName>Spaceley</LastName>
        </any>
      </sObjects>
    </create>
  </env:Body>
</env:Envelope>

= Response

HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Transfer-Encoding: chunked
Date: Thu, 22 Sep 2005 01:33:58 GMT

0303
<?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</faultcode>
   <faultstring>common.exception.ApiException: Must send a concrete entity type.</faultstring>
   <detail>
    <sf:fault xsi:type="sf:InvalidSObjectFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com">
     <sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>
     <sf:exceptionMessage>Must send a concrete entity type.</sf:exceptionMessage>
     <sf:row>-1</sf:row>
     <sf:column>-1</sf:column>
    </sf:fault>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

The "n1:type" stuff is new.

I'm still absolutely stumped as to how to get the xsi:type attribute into an SObject.

09/23/05 15:21:27 changed by nahi

  • priority changed from normal to high.
  • status changed from new to assigned.
  • type changed from enhancement to defect.
  • milestone changed from undefined to 1.5.6.

Hmm. I found "Sample Request Message-create Call-Partner API" at http://www.sforce.com/us/resources/soap/sforce60/sforce_API_messages_create.html#wp1319393

Can you try to pass a String "n1:Contact" or "urn:sobject.partner.soap.sforce.com.Contact" as a type attribute?

mycontact.type = "n1:Contact"

and

mycontact.type = "urn:sobject.partner.soap.sforce.com.Contact"

Both are trying to fake the XML Namespace parser at server side. Same error message?

09/24/05 09:57:25 changed by wrex

Thank you so much for your help with this!

Using "mycontact.type = 'n1:Contact'" generates

  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <n1:type>n1:Contact</n1:type>
        <any>
          <LastName>Spaceley</LastName>
        </any>
      </sObjects>
    </create>
  </env:Body>

which results in the same "Must send a concrete entity type" error message.

Using "mycontact.type = 'urn:sobject.partner.soap.sforce.com.Contact'" generates:

  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <n1:type>urn:sobject.partner.soap.sforce.com.Contact</n1:type>
        <any>
          <LastName>Spaceley</LastName>
        </any>
      </sObjects>
    </create>
  </env:Body>

With the same error.

09/24/05 10:06:32 changed by nahi

Thank you for your time. Hmm. How about it?

ns = "urn:sobject.partner.soap.sforce.com"
ele = SOAP::SOAPElement.new(XSD::QName.new(ns, "type"))
ele.text = "Contact"
ele.extraattr["xmlns"] = ns
obj.create(Create.new([SObject.new(ele, ["fields", "To", "Null"], "id", {"LastName" => "Spaceley"}) ]))

It generates a following XML for me.

      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <n1:type xmlns="urn:sobject.partner.soap.sforce.com">Contact</n1:type>
        ...

which seems like http://www.sforce.com/us/resources/soap/sforce60/sforce_API_messages_create.html#wp1319393

09/24/05 11:02:12 changed by wrex

Arghh! So close!

It does look similar to the example, but I'm still getting the same error:

= Request

POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.5 (/114, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Fri Sep 23 18:59:43 PDT 2005
Content-Length: 994
Host: na1-api.salesforce.com

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
        <SessionHeader env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <sessionId>NbTyiWK8nCEgc8iytxR7yKi7XMWDHKccFQ2izmOO06At1K8TuHNwDpqs4YZICe_ERJb0WSACeczRDlsBVkRvwxhD2wYHcrlK4SNdGN37zi4=</sessionId>
        </SessionHeader>
        <CallOptions env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <client>client</client>
        </CallOptions>
  </env:Header>
  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <n1:type xmlns="urn:sobject.partner.soap.sforce.com">Contact</n1:type>
        <any>
          <LastName>Spaceley</LastName>
        </any>
      </sObjects>
    </create>
  </env:Body>
</env:Envelope>

= Response

HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Connection: close
Transfer-Encoding: chunked
Date: Sat, 24 Sep 2005 01:59:38 GMT

0303
<?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</faultcode>
   <faultstring>common.exception.ApiException: Must send a concrete entity type.</faultstring>
   <detail>
    <sf:fault xsi:type="sf:InvalidSObjectFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com">
     <sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>
     <sf:exceptionMessage>Must send a concrete entity type.</sf:exceptionMessage>
     <sf:row>-1</sf:row>
     <sf:column>-1</sf:column>
    </sf:fault>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

I see two differences from the example:

"n1:type" instead of just "type"

and

        <any>
          <LastName>Spaceley</LastName>
        </any>

instead of just

      <LastName>Spaceley</LastName>

Since the error seems to be related to the type field, and the n1 stuff seems to have arrived with 1_5_5, I'm going to try it with 1_5_4 just to see what happens.

09/24/05 11:08:22 changed by wrex

With 1_5_4 the "<type>" field doesn't appear at all:

  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects>
        <any>
          <LastName>Spaceley</LastName>
        </any>
      </sObjects>
    </create>
  </env:Body>

No joy.

Using SOAP::SOAPElement.new() definitely seems like the right approach, but why is it generating n1:type instead of just type?

(It's scaring me how little I understand of all this :-)

09/24/05 11:24:50 changed by nahi

Hmm. How about this?

ele = SOAP::SOAPElement.new(XSD::QName.new(nil, "type"))

I think the XML instances with/without above change are semantically same though...

With the above change, I get;

    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <type xmlns="urn:sobject.partner.soap.sforce.com">Contact</type>

which has just an extra "xmlns:n1" attribute in sObjects element.

09/24/05 12:57:25 changed by wrex

Grr. I'm starting to to disbelieve the sample.

Your suggestion indeed works fine. I see nothing wrong with the request (except possibly the "<any>" bit). But nonetheless get the same error:

= Request

! CONNECTION ESTABLISHED
POST /services/Soap/c/6.0 HTTP/1.1
SOAPAction: ""
Content-Type: text/xml; charset=utf-8
User-Agent: SOAP4R/1.5.5 (/92, ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0])
Date: Fri Sep 23 20:54:42 PDT 2005
Content-Length: 941
Host: na1-api.salesforce.com

<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <env:Header>
        <SessionHeader env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <sessionId>4r1Oyv5QaSWDHQ1mZLpZgeq5.6rev.FxOlXtrGWuzQMXE65TKsBd4sMrfkK.MHJQuPd3yV9tr4u2pMIyBMJb9hhD2wYHcrlK4SNdGN37zi4=</sessionId>
        </SessionHeader>
        <CallOptions env:mustUnderstand="0"
            xmlns="urn:partner.soap.sforce.com">
          <client>client</client>
        </CallOptions>
  </env:Header>
  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects>
        <type xmlns="urn:sobject.partner.soap.sforce.com">Contact</type>
        <any>
          <LastName>Spaceley</LastName>
        </any>
      </sObjects>
    </create>
  </env:Body>
</env:Envelope>

= Response

HTTP/1.1 500 Internal Server Error
Server: sfdc
Cache-Control: private
Content-Type: text/xml; charset=utf-8
Connection: close
Transfer-Encoding: chunked
Date: Sat, 24 Sep 2005 03:55:15 GMT

0303
<?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</faultcode>
   <faultstring>common.exception.ApiException: Must send a concrete entity type.</faultstring>
   <detail>
    <sf:fault xsi:type="sf:InvalidSObjectFault" xmlns:sf="urn:fault.enterprise.soap.sforce.com">
     <sf:exceptionCode>INVALID_TYPE</sf:exceptionCode>
     <sf:exceptionMessage>Must send a concrete entity type.</sf:exceptionMessage>
     <sf:row>-1</sf:row>
     <sf:column>-1</sf:column>
    </sf:fault>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

Let me post on the sforce forum and see if anyone can figure it out what's wrong with the request. I'll let you know the response.

Yoroshiku onegaishimasu!

(By the way, if you're located anywhere near Tokyo, I'd be happy to buy you dinner the next time I'm over there -- I travel to Tokyo quite frequently, Osaka/Itami somewhat less so. :-)

09/24/05 13:14:55 changed by nahi

Possibly there's something difference between version 5 and version 6 ? The sample page we're referencing seems to be for version 5 (from accessing endpoint). I think "any" bits can be a cause of the error, too. Maybe I should get my sforce account (if I can) and read SDK by myself... I think I'll be able to allocate enough time at the beginning/middle of October.

I'm working at Takebashi (near Otemachi/Tokyo sta.) Thank you for you offering, but no need to buy me, for your great support about sforce-soap4r interoperability problem. I wish I were able to hear/speak English. :-)

09/24/05 15:08:42 changed by wrex

Progress!!

I was making a foolish mistake -- I was using the partner wsdl with an enterprise endpoint. With the correct server url I am finally getting past the type error (thanks to your help).

Now it is complaining about the "<any></any>" bits as expected. I think I can figure this out now, though (the API documentation gives some java and C# examples. I think I also need to use SOAP::SOAPElement with the "any" accessor, but I haven't figured it out exactly yet.

The SForce API document shows the following java example, but I can't figure out the ruby/soap4r equivalent:

private void createContactSample() {
SObject[] cons = new SObject[1];
  MessageElement[] contact = new MessageElement[5];
  contact[0] = new MessageElement (new QName("FirstName"), "Joe");
  contact[1] = new MessageElement (new QName("lastname"), "Blow");
  contact[2] = new MessageElement (new QName("Salutation"), "Mr.");
  contact[3] = new MessageElement (new QName("Phone"), "999.999.9999");
  contact[4] = new MessageElement (new QName("Title"), "Purchasing Director");
  cons[0] = new SObject();
  cons[0].setType("Contact");
  cons[0].set_any(contact);
  
  SaveResult[] sr = binding.create(cons);

I need to learn more about SOAP in general, and the SOAP::, XSD::, and WSDL:: modules specifically. This is powerful stuff.

本当にすごく有り難い!

日本語しゃべるけど、書くのはヘタなんです。

Your written English is excellent. It is very easy to understand.

Beers are definitely on me next time I'm in Takebashi! (Actually, I may be in Tokyo the week of October 10th -- I'd certainly like to meet you if you are available)

09/24/05 15:42:56 changed by nahi

Good. According to "any" problem, sorry about that, it's another bug of soap4r. I found the current soap4r cannot handle "##any" definition in XML Schema.

I'll try to fix it till 1.5.6 but for a workaround this time, can you try the following?

ns = "urn:sobject.partner.soap.sforce.com"
include XSD
obj.create(:sObjects =>
  [
    {
      QName.new(ns, "type") => "Contact",
      QName.new(ns, "Id") => "id",
      :FirstName => "Joe",
      :lastname => "Blow",
      :Salutation => "Mr.",
      :Phone => "999.999.9999",
      :Title => "Purchasing Director",
    }
  ]
)

A hash is converted to SOAPElement by a MappingRegistry?. Elements ordering may be a problem... The server may not accept illegal ordering.

09/24/05 16:02:50 changed by wrex

Aha!

The above generates:

  <env:Body>
    <create xmlns="urn:partner.soap.sforce.com">
      <sObjects xmlns:n1="urn:sobject.partner.soap.sforce.com">
        <FirstName>Joe</FirstName>
        <lastname>Blow</lastname>
        <n1:Id>id</n1:Id>
        <Salutation>Mr.</Salutation>
        <n1:type>Contact</n1:type>
        <Phone>999.999.9999</Phone>
        <Title>Purchasing Director</Title>
      </sObjects>
    </create>
  </env:Body>

Exactly as you explained, the problem is that the conversion from the hash is not preserving the ordering.

Knowing the problem is half the battle. :-)

This is great progress. I will try to see if I can discover some elegant way to use an Array instead of a Hash, but I can wait until the next release of soap4r.

Thank you for your excellent support.

Good night!

09/24/05 16:05:55 changed by wrex

Oops. Just in case it wasn't clear -- the request above generates the message:

org.xml.sax.SAXException: Missing entity type information. sObject requires a separate 'type' field be sent.

The SForce support people say the elements must arrive in the correct order.

09/24/05 16:29:56 changed by nahi

Then, a next workaround:

  1. get OrderdHash? from http://raa.ruby-lang.org/project/orderedhash/
  2. use it instead of a Hash.
    require 'orderedhash'
    sobj = OrderedHash.new
    sobj[QName.new(ns, "type")] = "Contact"
    sobj[QName.new(ns, "Id")] = "id"
    sobj[:FirstName] = "Joe"
    sobj[:lastname] = "Blow"
    sobj[:Salutation] = "Mr."
    sobj[:Phone] = "999.999.9999"
    sobj[:Title] = "Purchasing Director"
    obj.create(:sObjects => [sobj, sobj])
    

09/25/05 02:25:43 changed by wrex

Success!

That worked beautifully.

RAA was down when I went to retrieve it -- thank heavens for google cache! :-)

Are you planning to use orderedhash or a similar idea in MappingRegistry??

This is great -- I'm indebted.

09/25/05 09:43:56 changed by nahi

Good morning. Yes, I should add some support for sforce's WSDL usage.

  1. let wsdl2ruby.rb generate appropriate stub classes so that "obj.create(Create.new(SObject.new(...))" work. <any> support is a must(#155). <extention> of <complexContent> is a push(#72)
  2. consider to add ordering support for simple Ruby <-> XML interface. let SOAPElement work like orderedhash?

Let me see what I can do till 2005-10-10.

09/25/05 10:15:52 changed by Rup

Sorry, but in my case

			sobj = OrderedHash.new
			sobj[XSD::QName.new(ns, "type")] = "Account"
			sobj[QName.new(ns, "Id")] = "id"
			sobj["FirstName"] = "Joe"
			sobj["LastName"] = "Blow"
			sobj["Salutation"] = "Mr."
			sobj["Phone"] = "999.999.9999"
			sobj["Title"] = "Founder and COO"

			params = Create.new([ sobj ])
			res = @iforce.create([ sobj ])

produces

<env:Body>
    <create xmlns=\"urn:partner.soap.sforce.com\">{urn:sobject.partner.soap.sforce.com}typeAccount{urn:sobject.partner.soap.sforce.com}IdidFirstNameJoeLastNameBlowSalutationMr.Phone999.999.9999TitleFounder and COO</create>
  </env:Body>

I am using soap4r_20050923. What do you think ?

Rup

09/25/05 11:05:44 changed by nahi

Hi,

Would you please try replacing the last line with:

@iforce.create(:sObjects => [sobj])

09/25/05 21:24:11 changed by nahi

Here's another workaround with SOAPElement. It must be easier.

ns1 = 'urn:partner.soap.sforce.com'
ns2 = "urn:sobject.partner.soap.sforce.com"
ele = SOAPElement.new(QName.new(ns1, 'create'))
sobj = SOAPElement.new(QName.new(ns1, 'sObjects'))
sobj.add(SOAPElement.new(QName.new(ns2, "type"), "Contact"))
sobj.add(SOAPElement.new(QName.new(ns2, 'Id'), "012345678901234567"))
sobj.add(SOAPElement.new(QName.new(nil, 'FirstName'), 'Joe'))
sobj.add(SOAPElement.new(QName.new(nil, 'lastname'), 'Blow'))
sobj.add(SOAPElement.new(QName.new(nil, 'Salutation'), 'Mr.'))
sobj.add(SOAPElement.new(QName.new(nil, 'Phone'), '999.999.9999'))
sobj.add(SOAPElement.new(QName.new(nil, 'Title'), 'Purchasing Director'))
ele.add(sobj)
ele.add(sobj)
result = sforce.create(ele)

09/26/05 06:00:03 changed by Rup

Thanks, this works for me now, although it is rather heavy. If you have any suggestions for making this lighter, or including some of it in wsdl2ruby-generated classes, I am listening.

09/26/05 09:42:49 changed by nahi

Agreed. With [1635] (#153), SOAPElement approach became as followings:

sobj = [
  [QName.new(ns, "type"), "Contact"],
  [QName.new(ns, "Id"), "012345678901234567"],
  [:FirstName, "Joe"],
  [:lastname, "Blow"],
  [:Salutation, "Mr."],
  [:Phone, "999.999.9999"],
  [:Title, "Purchasing Director"]
]
obj.create(:sObjects => [sobj, sobj])
obj.create(ele)

But it's still not intiutive.

09/26/05 15:31:51 changed by Rup

OK, that is quite clean since

ns = SObject::schema_ns

Thanks for your reactivity on these subjects.

10/19/05 22:35:17 changed by nahi

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [1650]) <any/> support for WSDL2Ruby generated class and stubs. closes #148.

10/21/05 14:02:31 changed by nahi

  • component changed from soap4r to wsdl4r.

05/28/06 19:55:39 changed by kkkkoaaa

Keep a good job up! http://quick-adult-links.com

06/01/07 17:34:39 changed by nahi

  • type set to enhancement.