472,789 Members | 1,127 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,789 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 3646
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.