The new forums will be named Coin Return (based on the most recent vote)! You can check on the status and timeline of the transition to the new forums here.
The Guiding Principles and New Rules document is now in effect.

Does anyone here develop against Salesforce?

exmelloexmello Registered User regular
edited August 2009 in Help / Advice Forum
I am trying to accomplish something from Salesforce to a .NET webservice but there may be precedent for the concepts in other languages.

Normally you would define a complex datatype in a webservice, then that datatype would be defined in the WSDL. The calling program would be developed using this WSDL to generate classes for these complex datatypes.

I want to do this the other way around. Salesforce has a datatype called sObject and provides a Partner WSDL that defines this type. I reference this WSDL in a C# project and want to create a webservice that takes an sObject as a parameter. When I run it and generate a service definition from this webservice, it contains a new definition of sObject.

The problem I am having is that when I give this definition to Salesforce, it does not recognize that it already knows this type (even though the namespace has not changed). In fact it defines a class called sObject_x.

Is there any way around this? Similar problems in other domains/languages?

exmello on

Posts

  • GanluanGanluan Registered User regular
    edited August 2009
    Are you generating the service reference using svcutil?

    If you reflect the two types (one provided by the service, one you're trying to get it to recognize), do they appear to match at the metadata level? I wouldn't be surprised if their hash codes don't line up.

    Ganluan on
  • exmelloexmello Registered User regular
    edited August 2009
    Actually I'm pretty new to this WSDL/SOAP stuff. I've been spoiled by how simple it is to connect to simple webservices with VS 2008.

    I don't think they line up. I created the service reference by running the .asmx test form through firefox and tagging "?WSDL" onto the end.

    I will try comparing the xml nodes. I'll post an example on here when I can.

    exmello on
  • exmelloexmello Registered User regular
    edited August 2009
    From the wsdl Salesforce provides:
    <complexType name="sObject">
                    <sequence>
                        <element name="type"               type="xsd:string"/>
                        <element name="fieldsToNull"       type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
                        <element name="Id"                 type="tns:ID" nillable="true" />
                        <any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
                    </sequence>
                </complexType>
    

    From the wsdl generated from my webservice:
    <s:import namespace="urn:sobject.partner.soap.sforce.com" />
    

    and
    <s:complexType name="ArrayOfSObject">
            <s:sequence>
              <s:element minOccurs="0" maxOccurs="unbounded" name="sObject" nillable="true" type="s1:sObject" />
            </s:sequence>
          </s:complexType>
    

    The most annoying part is that when Salesforce generates classes from this, the sObject_x class is nested in a class called SobjectPartnerSoapSforceCom. I think it's also missing the "Any" property which is where the actual data is held.

    exmello on
Sign In or Register to comment.