473,387 Members | 1,520 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Error adding a Web reference to a VS .NET project

Hi,

I'm trying to create a web service client in C# but I get stuck at one of
the first steps.
When adding a Web reference to the Visual Studio project; I get this error
(this is a translation, the English terms might not be exact) :

"Error in the custom tool : Impossible to import WebService/Schema.
Impossible to import binding 'cmsserverbinding' (it's the name of the binding
in my WSDL file) from namesapce 'urn:cms. Impossible to import operation
'GetRubriques'. The schema with targetNamespace='urn:cms' has an invalid
syntax. The attribute 'name' may not be present."

Here's the WSDL file of the Web Service I'm trying to reach :

<?xml version="1.0" encoding="ISO-8859-1"?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:si="http://soapinterop.org/xsd"
xmlns:tns="urn:cms" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:cms">

<types><xsd:schema elementFormDefault="qualified" targetNamespace="urn:cms">

<xsd:complexType name="Rubrique">
<xsd:all>
<xsd:element name="id_rubrique" type="xsd:string" />
<xsd:element name="nom" type="xsd:string" />
</xsd:all>
</xsd:complexType>
<xsd:complexType name="Groupe">
<xsd:all>
<xsd:element name="id_groupe" type="xsd:string" />
<xsd:element name="nom" type="xsd:string" />
</xsd:all>
</xsd:complexType>

<xsd:element name="Rubriques">
<xsd:complexType name="tabRubriques">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType"
wsdl:arrayType="cms:Rubrique[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

<xsd:element name="Groupes">
<xsd:complexType name="tabGroupes">
<xsd:complexContent>
<xsd:restriction base="SOAP-ENC:Array">
<xsd:attribute ref="SOAP-ENC:arrayType" wsdl:arrayType="cms:Groupe[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:element>

<xsd:element name="string1" type="xsd:string">
</xsd:element>

<xsd:element name="string2" type="xsd:string">
</xsd:element>

</xsd:schema>
</types>

<message name="listeRubriquesResponse"><part name="parameters"
element="tns:Rubriques" /></message>
<message name="listeRubriquesRequest"><part name="parameters"
element="tns:string1" /></message>

<message name="listeGroupesResponse"><part name="parameters"
element="tns:Groupes" /></message>
<message name="listeGroupesRequest"><part name="parameters"
element="tns:string2" /></message>

<portType name="cmsserverPortType">
<operation name="getGroupes"><input
message="tns:listeGroupesRequest"/><output
message="tns:listeGroupesResponse"/></operation>
<operation name="getRubriques"><input
message="tns:listeRubriquesRequest"/><output
message="tns:listeRubriquesResponse"/></operation>
</portType>

<binding name="cmsserverBinding" type="tns:cmsserverPortType">
<soap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getGroupes">
<documentation>Liste des groupes du CMS</documentation>
<soap:operation soapAction="urn:cms#getGroupes" style="document"/>
<input><soap:body use="literal" namespace="urn:cms"/></input>
<output><soap:body use="literal" namespace="urn:cms"/></output>
</operation>
<operation name="getRubriques">
<documentation>Liste des rubriques du CMS</documentation>
<soap:operation soapAction="urn:cms#getRubriques" style="document"/>
<input><soap:body use="literal" namespace="urn:cms"/></input>
<output><soap:body use="literal" namespace="urn:cms"/></output>
</operation>

</binding>

<service name="cmsserver">
<port name="cmsserverPort" binding="tns:cmsserverBinding">
<soap:address
location="http://localhost/cms_test/backend/webservice/webservice.php"/></port>
</service>

</definitions>
I can't see what "name" attribute the error message refers to. I've tried to
remove each of them but removing the "name" attribute of an element either
generates another error message or doesn't change anything.

I've got the feeling that DotNet is particularly capricious when it comes to
web service description schemas.
For instance, the same WSDL is fully accepted by a web service client
written in PHP...
Nov 23 '05 #1
4 3689
glebur -

My guess is that VS.Net is having trouble connecting to the server that
contains your .asmx file.

We use a webmethods call to get the latest product version number and a
list of sponsors from our main website (ex:
http://www.vinfo.com/Updates/TGPlugIn/ProductInfo.asmx).

You can download the source code listed below from www.TekGuard.com,
along with the project file and the Web Reference. This will let you
see how it is used in context with the .asmx file. We use the same code
for both our TekGuard Mail Server product and our Outlook anti-spam
plugin.

Look for the following section of code in "Bootstrap.cs":

<snippet>

#region TGPCheckUpdates
public void TGPCheckUpdates ()
{
// Already Checking?
if (m_thrChecking != null) return;

// Have we checked in the past week since startup?
if (!m_bCheckUpdates || (m_dtLastCheck.AddDays(VER_CHECKWEEKLY) >
DateTime.Now)) return;

// Create a new thread for the WebMethods call
m_thrChecking = new Thread(new
ThreadStart(TGPCheckUpdates_Thread));
m_thrChecking.Priority = ThreadPriority.Lowest;
m_thrChecking.IsBackground = true;
m_thrChecking.Start();
}
private void TGPCheckUpdates_Thread()
{
string NewVersion;
string[] Sponsors;

// Connect to VISI web service
// Note: This is done without sending any information about your
computer
if (CheckUpdates_WebMethod(out NewVersion, out Sponsors))
{
// Success - save last version check date
m_dtLastCheck = DateTime.Now;

// Update Sponsors list
m_PlugIn.Sponsors = Sponsors;

// New version available?
if (NewVersion != null) m_PlugIn.LogAlert("Start", "A newer
version (" + NewVersion + ") is available", null);
}

// Done checking
m_thrChecking = null;
}
private bool CheckUpdates_WebMethod (out string NewVersion, out
string[] Sponsors)
{
try
{
// Get VISI Product info using WebMethods call
ProductInfo Info = new ProductInfo();

// Set the timeout to be relaively short
Info.Timeout = WEB_TIMEOUT;

// Get this local (running) version
string ThisVersion =
Assembly.GetExecutingAssembly().GetName().Version. ToString();

// Future: Use split command to compare embedded values
string CurrentVersion = Info.getVersion();

// Return version status
NewVersion = (CurrentVersion.CompareTo(ThisVersion) > 0) ?
Info.getVersion() : null;

// Return sponsor list
Sponsors = Info.getSponsors();

// Success
return (true);
}
catch
{
// Assume no updates available if info not available
NewVersion = null;
Sponsors = null;
return (false);
}
}
#endregion
</snippet>
Posted by www.AndrewM.com [PostID 20050621]

Software Entrepreneurs, ISV's, Developers - Sell & Support your
programs with an 800# virtual auto-attendant:
www.VoiceInfo.com - <a href="http://www.VoiceInfo.com">
Virtual Office, Automated Phone Assistant, Web Access </a><br>

Developers, ISP's, Small Business Owners - Need a starting point
for an anti-spam email server, Outlook client, WebMail?
www.TekGuard.com - <a href="http://www.TekGuard.com">
Free Mail Server, Outlook PlugIn, WebMail, C# Source Code </a>

Nov 23 '05 #2
glebur -

My guess is that VS.Net is having trouble connecting to the server that
contains your .asmx file.

We use a webmethods call to get the latest product version number and a
list of sponsors from our main website (ex:
http://www.vinfo.com/Updates/TGPlugIn/ProductInfo.asmx).

You can download the source code listed below from www.TekGuard.com,
along with the project file and the Web Reference. This will let you
see how it is used in context with the .asmx file. We use the same code
for both our TekGuard Mail Server product and our Outlook anti-spam
plugin.

Look for the following section of code in "Bootstrap.cs":

<snippet>

#region TGPCheckUpdates
public void TGPCheckUpdates ()
{
// Already Checking?
if (m_thrChecking != null) return;

// Have we checked in the past week since startup?
if (!m_bCheckUpdates || (m_dtLastCheck.AddDays(VER_CHECKWEEKLY) >
DateTime.Now)) return;

// Create a new thread for the WebMethods call
m_thrChecking = new Thread(new
ThreadStart(TGPCheckUpdates_Thread));
m_thrChecking.Priority = ThreadPriority.Lowest;
m_thrChecking.IsBackground = true;
m_thrChecking.Start();
}
private void TGPCheckUpdates_Thread()
{
string NewVersion;
string[] Sponsors;

// Connect to VISI web service
// Note: This is done without sending any information about your
computer
if (CheckUpdates_WebMethod(out NewVersion, out Sponsors))
{
// Success - save last version check date
m_dtLastCheck = DateTime.Now;

// Update Sponsors list
m_PlugIn.Sponsors = Sponsors;

// New version available?
if (NewVersion != null) m_PlugIn.LogAlert("Start", "A newer
version (" + NewVersion + ") is available", null);
}

// Done checking
m_thrChecking = null;
}
private bool CheckUpdates_WebMethod (out string NewVersion, out
string[] Sponsors)
{
try
{
// Get VISI Product info using WebMethods call
ProductInfo Info = new ProductInfo();

// Set the timeout to be relaively short
Info.Timeout = WEB_TIMEOUT;

// Get this local (running) version
string ThisVersion =
Assembly.GetExecutingAssembly().GetName().Version. ToString();

// Future: Use split command to compare embedded values
string CurrentVersion = Info.getVersion();

// Return version status
NewVersion = (CurrentVersion.CompareTo(ThisVersion) > 0) ?
Info.getVersion() : null;

// Return sponsor list
Sponsors = Info.getSponsors();

// Success
return (true);
}
catch
{
// Assume no updates available if info not available
NewVersion = null;
Sponsors = null;
return (false);
}
}
#endregion
</snippet>
Posted by www.AndrewM.com [PostID 20050621]

Software Entrepreneurs, ISV's, Developers - Sell & Support your
programs with an 800# virtual auto-attendant:
www.VoiceInfo.com - <a href="http://www.VoiceInfo.com">
Virtual Office, Automated Phone Assistant, Web Access </a><br>

Developers, ISP's, Small Business Owners - Need a starting point
for an anti-spam email server, Outlook client, WebMail?
www.TekGuard.com - <a href="http://www.TekGuard.com">
Free Mail Server, Outlook PlugIn, WebMail, C# Source Code </a>

Nov 23 '05 #3
Hi,

Thanks for your answer, but the error actually occurs during the parsing of
the WSDL file (and my SOAP server is not in Dotnet but in PHP).

I removed the name attribute of the SOAP-ENC:Arrays, and it solved the
problem but I get another error message :

The element string2 has been imported twice for different reasons :
(primitiveMapping, membersMapping).
Does someone have any idea about what it means ?

PS : I'm sorry about all the & lt; and & gt; hieroglyphs in my first
message, but I can't do anything about it ;it's a shame you can't post XML
code in this newsgroup...
Nov 23 '05 #4
Hi,

Thanks for your answer, but the error actually occurs during the parsing of
the WSDL file (and my SOAP server is not in Dotnet but in PHP).

I removed the name attribute of the SOAP-ENC:Arrays, and it solved the
problem but I get another error message :

The element string2 has been imported twice for different reasons :
(primitiveMapping, membersMapping).
Does someone have any idea about what it means ?

PS : I'm sorry about all the & lt; and & gt; hieroglyphs in my first
message, but I can't do anything about it ;it's a shame you can't post XML
code in this newsgroup...
Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: aualias | last post by:
I am getting the following error: Warning: The dependency 'ShoppingCart, Version=1.0.1895.27037, Culture=neutral' in project 'www.sitename.com' cannot be copied to the run directory because it...
4
by: Lowell | last post by:
Any tips for trouble shooting errors when the ASPX page won't even compile? What happens is that VS will "build" the code-behind object and the component that it instantiates, but when I navigate to...
5
by: Raterus | last post by:
I'm just throwing this error out for my sanity, I've seen posts about this, but never solutions. I'm using VS.NET 2003, Framework 1.1, and I'm getting a random error about every 1 out of 10 times...
0
by: Nikhil Patel | last post by:
Hi all, I am having a problem adding a reference in an ASP.Net project. I have written a custom control using a Web Control Library project. I compiled this project and generated a dll. Now...
16
by: Paul S. Natanson | last post by:
What is a Null Reference error and how do I fix it? My newly installed VB.Net2003 gives me a "Microsoft Development Environment" error message box EVERY time I try to run/start ANY project -...
8
by: Jon Paal | last post by:
Compiler Error Message: BC30002: Type 'System.Management.ManagementObjectCollection' is not defined. Source Error: Imports System.Management .... Line 40: Dim moColl As...
6
by: daviddou2006 | last post by:
When adding a Web Reference to a new project before I even add any code to test the service I thought i would build the project to see if it would complie and following error occured: Custom...
5
by: Alias | last post by:
Hi - I'm trying to implement a custom RoleProvider based on the SqlRoleProvider. I keep receiving a an error that it can't load type 'MyRoleTest.MyRoleProvider' when trying to load my...
0
by: andrew.j.matheny | last post by:
Hi, I'm trying to include a dll written in managed C++ in a C# code behind file for an asp.net website and I'm running into some problems. Whenever I add the file as a reference to the asp.net...
4
by: =?Utf-8?B?Z3JlZw==?= | last post by:
I am trying to create an instance of a 3rd party COM component, and I'm getting an error. I've opened a ticket with this vendor as well, but I want to approach it from the C# .NET side to make...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.