You need to sign in to do that
Don't have an account?
Problem with WSDL import in visual studio
Hi All,
I am getting an error while trying to add web reference in visual studio 2005:
The document at the url file:///C:/Users/Emil Kalin/Desktop/enterprize.wsdl was not recognized as a known document type.
The error message from each known type may help you fix the problem:
- Report from 'DISCO Document' is 'Data at the root level is invalid. Line 2, position 1.'.
- Report from 'WSDL Document' is 'There is an error in XML document (2, 1).'.
- Data at the root level is invalid. Line 2, position 1.
- Report from 'XML Schema' is 'Data at the root level is invalid. Line 2, position 1.'.
and also:
Invalid at the top level of the document. Error processing resource 'file:///C:/Users/Emil Kalin/Desktop/enterprize.wsdl'. ...
<?xml version="1.0" encoding="UTF-8" ?>
Has any one any idea? I have generated an enterprise WSDL file and copies all its content
from the browser window with the WDSL xml file.
The begining of the file:
<?xml version="1.0" encoding="UTF-8" ?>
- <!--
Salesforce.com Enterprise Web Services API Version 20.0
Generated on 2011-01-05 14:16:48 +0000.
Package Versions:
Aspira XObject (Version: 1.20, Namespace: aspirax)
PRM (Version: 1.2, Namespace: xforce_prm)
Salesforce for Google AdWords (Version: 1.2, Namespace: sfga)
CountryComplete (Version: 1.2, Namespace: pw_cc)
iCalendar Export (Version: 1.4, Namespace: icalendar)
Copyright 1999-2011 salesforce.com, inc.
All Rights Reserved
-->
<definitions targetNamespace="urn:enterprise.soap.sforce.com" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:enterprise.soap.sforce.com" xmlns:fns="urn:fault.enterprise.soap.sforce.com" xmlns:ens="urn:sobject.enterprise.soap.sforce.com">
<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)
-->
- <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="AggregateResult">
- <complexContent>
- <extension base="ens:sObject">
- <sequence>
Thank you all!
It looks like you cut'n'pasted it from the browser, which won't work as you get all the - expand/collapse items which make the xml invalid. you want to right click on the wsdl link and click save as.
Thank you for the example. I still seem to be getting an error so I think there is something wrong with the way I reference the WSDLs. I obtained the WSDLs by generating them in the UI, right clicked, and clicked "Save As". The content then downloaded as an xml file. In Visual Studio 2010, I went under Project>Add Service Reference>Advanced>Add Web Reference and located the file in my local directory. Lastly, I named the reference and clicked add reference.
When I try running the code, it returns this error to me:
This happens for both WSDLs I referenced. Is there anything obvious I'm doing wrong here?
Its sounds like there's a mix up on namespace/class names, check in the generated source code for the package names, and adjust your using's to suit.