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
JMcIvorJMcIvor 

Issue With WSDL Import Visual Studio 2010

Hello,

 

I have created the WSDL Enterprise file in the Setup and I have added the Web Reference in Visual Studio 2010 I am receiving the following errors:

 

Error 1 Custom tool error: Unable to import WebService/Schema. Unable to import binding 'SoapBinding' from namespace 'urn:enterprise.soap.sforce.com'. Unable to import operation 'create'. The datatype 'urn:sobject.enterprise.soap.sforce.com:RecordType' is missing.

 

Error 2 Custom tool error: Unable to import WebService/Schema. Unable to import binding 'SoapBinding' from namespace 'urn:enterprise.soap.sforce.com'. Unable to import operation 'create'. The datatype 'urn:sobject.enterprise.soap.sforce.com:RecordType' is missing.

 

These errors are in the Settings.settings file and Reference.map file respectively. Any help you could provide would be greatly appreciated.

Best Answer chosen by Admin (Salesforce Developers) 
SebrabSebrab

Ok, after trying remove piece of xml in my new WSDL, step by step, I found that is "RecordType" is the origin of the issue.

 

In definition / types / schema / complexType[name="Idea"] / complexContent / extension[base="ens:sObject"] / sequence tag I have : 

<element name="RecordType" nillable="true" minOccurs="0" type="ens:RecordType"/>

<element name="RecordTypeId" nillable="true" minOccurs="0" type="tns:ID"/>

 

I remove this lines and VS accept the WSDL without any problems.

I don't know exactly why but i assume that the reason is that RecordType either is not a sforce type or is declaration was forget from the wsdl.

 

Does anybody can confirm my theory or explain the deep reasons of this issue?

Does my work around is reliable ?

 

Thanks for your help.

All Answers

Keyur PatelKeyur Patel

Hello,

 

Make sure that , you have added all require references or dll in your application. It seems that namespace is missing. If possible, please provide your WSDL file. I can try with my VS 2010.

 

Regards,

Keyur Patel

SanjaySSanjayS

Did you copy the WSDL on your local drive and added the reference? If not copy on your local drive and add the reference (even if it says URL enter the complete path instead).

 

JMcIvorJMcIvor

I tried using the URL as well as saving the WSDL locally and adding the reference that way. I received the same errors on both. Is it possible that the Enterprise WSDL is corrupt due to something in our SalesForce instance?

SanjaySSanjayS

Did you saved the WSDL by right clicking and selecting 'Save Target As'?

I normally add it as 'Service Reference'. Also to point out that you need the password and security token to connect to salesforce.

 

JMcIvorJMcIvor

Yes, I right-clicked and saved the file locally. I then added the reference to Visual Studio, and I don't even get a chance to log in before it is throwing errors at me.

SanjaySSanjayS

Check this link and see if your WSDL is valid:

http://www.w3.org/wiki/WsdlValidator

SebrabSebrab

Does anyone have a solution ?

I have exactly the same issue.

 

Somebody in my company does some objects modification in Salesforce and when I've wanna update the WSDL in visual studio, I just can't.

The errors are (my "french to english translation") : 

 

Error : Unable to import the binding 'SoapBinding' from the namespace 'urn:enterprise.soap.sforce.com'.
- Unable to import the operation 'create'.

- The data type 'urn:sobject.enterprise.soap.sforce.com:RecordType' missing.

 

Thanks

Saurabh DhobleSaurabh Dhoble

I'm still not clear what the issue is - do you get an issue when adding the web reference, or do you get it when you invoke some code that tries to make Salesforce web service call.

 

I just added a web reference to VS2010 and did not get any errors, so not sure what exact issue you are having.

JMcIvorJMcIvor

I receive these errors when I try to build my solution after adding the reference. It does not allow me to make any calls to SalesForce as the Reference is not building correctly.

Saurabh DhobleSaurabh Dhoble

All right, I was also able to build it, so I suspect something is wrong with your project. Try the following steps -

1. Start with a blank project, that does not have any code.

2. In solution explorer, right-click "References" --> Add Service Reference --> Advanced --> Add Web Reference (under compatibility).

3. Copy-paste the file path of the "Enterprise.WSDL". Hit Ok.


Once you have added the web reference like this, try instantiating the object with something like this :-

 

WebReference.SforceService sf = new WebReference.SforceService();

 

Try compiling the project -- this should compile without any issues.

SanjaySSanjayS

So when you run your codes in VS2010 IDE it runs fine? Only when you try to build it errors out.

If you are trying to compile a file with blank code  (class) then you need to use correct namespaces in your .net application.

JMcIvorJMcIvor

The errors come up as soon as I add the Web Reference. It does not allow me to instatiate anything because the reference isn't available for use.

 

Screenshot

Saurabh DhobleSaurabh Dhoble

You are using Visual Studio 2012, not VS 2010.


I was able to build a simple console application using the steps I had listed earlier - did you try that ?

 

 

JMcIvorJMcIvor

I recently ugraded to VS 2012, but the issue is the same in 2010 and 2012. See updated screenshot of console app (same result)

 

Screenshot

Saurabh DhobleSaurabh Dhoble

I'm afraid this seems to be more of a VS issue than a Salesforce issue. Did you alter your enterprise.wsdl file in any way before adding as web reference ? I googled it and found some links, but it appears it's a dead end - try emailing the guy SimonF at Salesforce to see if he can suggest a fix - his email address is in this post.

http://boards.developerforce.com/t5/NET-Development/Error-Adding-Web-Reference/td-p/109427

 

Some other links I found that might help.

http://forums.asp.net/t/1144637.aspx/1

http://bytes.com/topic/net/answers/432410-unable-import-webservice-schema

http://social.msdn.microsoft.com/Forums/en-US/csharpide/thread/a2cdfd85-049d-4be3-9597-0cb3d071f346/

http://support.microsoft.com/kb/820122

 

Saurabh DhobleSaurabh Dhoble

Also look at this one - looks like this happens if your WSDL is referencing an external XSD file. You might be able to solve it by manually importing the XSD content in your WSDL file.

 

http://stackoverflow.com/questions/77534/wsdl-exe-error-unable-to-import-binding-from-namespace

SebrabSebrab

Thanks for all this information. I'll try some stuff as you advice us.

Actually, I'm under VS2008 (that's a quite old version) and in my case the error appears when I do "Update Reference" or when I run wsdl.exe with my Wsdl Partner File in paramater in VS Command Prompt.

 

Ok, so I try some of your "solutions" and keep you inform about the next.

SanjaySSanjayS

Other thing  I would check would be the OS and the version of .net framework.

I hope you are not using Windows Vista.

JMcIvorJMcIvor

I tried using Visual Studio 2010, .NET 3.5 and Windows 7.

 

I am now trying with Visual Studio 2012, .NET 4.5 and Windows 8. 

 

I think it is an issue with the WSDL itself, and not my system as I have tried it on 2 completely different systems. I have also successfully used a WSDL from my DeveloperForce SalesForce.

SanjaySSanjayS

Then we need to check the steps we take to create WSDL. Can you check that  if you have checked  'API Enabled' (under your profile) and you need to have permission to modify all data (normally an Administrator or any user that can modify all data).

JMcIvorJMcIvor

I am the System Administrator and API is enabled.

SanjaySSanjayS

Now remove the web reference in VS and add a service reference instead.  

BethNBethN

I am having the same problem with our company's WSDL. It used to generate and import correctly, but since Jan 2013 we have not been able to re-generate the WSDL and import to VS2010.

 

It gives this error when trying to do "Update Web Reference" (or when running wsdl.exe from the VS Command Prompt):

Custom tool error: Unable to import WebService/Schema. Unable to import binding 'SoapBinding' from namespace 'urn:enterprise.soap.sforce.com'. Unable to import operation 'create'. The datatype 'urn:sobject.enterprise.soap.sforce.com:RecordType' is missing. 

 

I have tried importing it into a standalone C# console application and that does not work either. I've read all the related articles in this post and they either did not apply or did not help.

 

This seems to be a Salesforce problem.

 

Any help getting a working WSDL would be appreciated. I can email the old working WSDL and the new one that does not import, if that would help.

SanjaySSanjayS

Can you paste few lines from the schema element (<schema>) that is contained in the types  section (<types>) in the WSDL.

 

BethNBethN

Here's the start of the <schema> tag

<types>

        <schema elementFormDefault="qualified" xmlns=http://www.w3.org/2001/XMLSchema" targetNamespace="urn:sobject.enterprise.soap.sforce.com>

 

            <import namespace="urn:enterprise.soap.sforce.com"/>

 

            <!--  Base sObject (abstract) -->

            <complexTypename="sObject">

                <sequence>

                    <element name="fieldsToNull"       type="xsd:string"nillable="true"minOccurs="0"maxOccurs="unbounded"/>

                    <element name="Id"                 type="tns:ID"nillable="true" />

                </sequence>

            </complexType>

            <complexTypename="AggregateResult">

                <complexContent>

                    <extension base="ens:sObject">

                        <sequence>

                            <any namespace="##targetNamespace"minOccurs="0"maxOccurs="unbounded"processContents="lax"/>

                        </sequence>

                    </extension>

                </complexContent>

            </complexType>

 

 

FWIW: This part of the WSDL hasn't changed from our old version (which worked) and our new version I just generated (which does not work).

JMcIvorJMcIvor

My WSDL <schema> tag starts like this:

 

 <schema elementFormDefault="qualified" xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:sobject.enterprise.soap.sforce.com">

            <import namespace="urn:enterprise.soap.sforce.com"/>


            <!-- Base sObject (abstract) -->
            <complexType name="sObject">
                <sequence>
                    <element name="fieldsToNull"       type="xsd:string" nillable="true" minOccurs="0" maxOccurs="unbounded"/>
                    <element name="Id"                 type="tns:ID" nillable="true" />
                </sequence>
            </complexType>

            <complexType name="ApexClass">
                <complexContent>
                    <extension base="ens:sObject">
                        <sequence>
                            <element name="ApiVersion" nillable="true" minOccurs="0" type="xsd:double"/>
                            <element name="Body" nillable="true" minOccurs="0" type="xsd:string"/>
                            <element name="BodyCrc" nillable="true" minOccurs="0" type="xsd:double"/>
                            <element name="CreatedBy" nillable="true" minOccurs="0" type="ens:User"/>
                            <element name="CreatedById" nillable="true" minOccurs="0" type="tns:ID"/>
                            <element name="CreatedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
                            <element name="IsValid" nillable="true" minOccurs="0" type="xsd:boolean"/>
                            <element name="LastModifiedBy" nillable="true" minOccurs="0" type="ens:User"/>
                            <element name="LastModifiedById" nillable="true" minOccurs="0" type="tns:ID"/>
                            <element name="LastModifiedDate" nillable="true" minOccurs="0" type="xsd:dateTime"/>
                            <element name="LengthWithoutComments" nillable="true" minOccurs="0" type="xsd:int"/>
                            <element name="Name" nillable="true" minOccurs="0" type="xsd:string"/>
                            <element name="NamespacePrefix" nillable="true" minOccurs="0" type="xsd:string"/>
                            <element name="Status" nillable="true" minOccurs="0" type="xsd:string"/>
                            <element name="SystemModstamp" nillable="true" minOccurs="0" type="xsd:dateTime"/>
                        </sequence>
                    </extension>
                </complexContent>
            </complexType>

            <complexType name="AggregateResult">
                <complexContent>
                    <extension base="ens:sObject">
                        <sequence>
                            <any namespace="##targetNamespace" minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
                        </sequence>
                    </extension>
                </complexContent>
            </complexType>

 

SanjaySSanjayS

This looks good. Now lets see how the service endpoints looks like in the WSDL ( the tag <service> ).

Also, can you check the IIS version on your machine if it is version 7.5 then we will try few more things.

BethNBethN

    <!-- Soap Service Endpoint -->
    <service name="SforceService">
        <documentation>Sforce SOAP API</documentation>
        <port binding="tns:SoapBinding" name="Soap">
            <soap:address location="https://login.salesforce.com/services/Soap/c/27.0/0DFA0000000MIFy"/>
        </port>
    </service>

 

The only thing that changed in this section between the WSDL that works and this one is the number 27.0. It used to be 26.0.

I'm using Window 8, so I have IIS Version 8.0.9200.16384.

 

But we were also getting this problem earlier this year (since Jan 2013) on a Windows 7 box.

SanjaySSanjayS

I believe that the WSDL is fine. Some unknown setting in  VS2010/Windows  is giving this error.

Now let us try below:

 

1. go to  Control Panel ->System Security--> Administrative Tools

2. Click on Internet Information Services (IIS) Manager

3. on Connections  split window on left select  'Application Pools'

4.Under  'Actions' on the right side select 'Set Application Pool Defaults'

5. On the 'Applications Pool Defaults'   the 'Identity' entry should point to 'ApplicationPoolIdentity'  (This entry is under 'Process Model' on the 'Application Pool Defaults'.

 

 

The second step will be to give  'IIS AppPool\DefaultAppPool' access to C:\Windows\Temp directory (You need your System Administrator to set this if you need a helping hand).

 

This setting is true for IIS 7.5. Also I run my VS2010 under Windows 7.

 

SebrabSebrab

Hi,

 

I was away from salesforce business these last time.

 

So I'm recaping, i'm on Win7 (32bits) with VS 2008 .Net3.5 SP1.

I tried several things : 

  • Add Web reference with an old version of my "WSDL SForce Enterprise"(26) and a new one (27), the old version works fine not the new one.
  • Add the new WSDL as Service References and/or Web References, none works.
  • Try the Sanjay S trick, before realized that my application is a console application :)

I believe that their is something new in the Salesforce WSDL that "Visual WSDL.exe" doesn't like, but what??

 

Does any body find a solution to this issue?

SebrabSebrab

Ok, after trying remove piece of xml in my new WSDL, step by step, I found that is "RecordType" is the origin of the issue.

 

In definition / types / schema / complexType[name="Idea"] / complexContent / extension[base="ens:sObject"] / sequence tag I have : 

<element name="RecordType" nillable="true" minOccurs="0" type="ens:RecordType"/>

<element name="RecordTypeId" nillable="true" minOccurs="0" type="tns:ID"/>

 

I remove this lines and VS accept the WSDL without any problems.

I don't know exactly why but i assume that the reason is that RecordType either is not a sforce type or is declaration was forget from the wsdl.

 

Does anybody can confirm my theory or explain the deep reasons of this issue?

Does my work around is reliable ?

 

Thanks for your help.

This was selected as the best answer
JMcIvorJMcIvor

Removing these 2 lines of code from the "Idea" section of the WSDL fixed my issue as well. It appears that the Idea object is still functioning correctly as you can still create an Idea, and set all of the properties, etc. 

 

Thank you to everyone for their help with this issue.