.Net WSDL command line error

I point to the .Net command line WSDL utility that comes with Visual Studio 2005 on a web service implemented in Java (which I have no control over) and it spits out the following error:

WSDL : error WSDL1: Unable to cast object of type 'System.Xml.XmlElement' 
to type 'System.Web.Services.Description.ServiceDescriptionFormatExtension'.

      

However, if I point Visual Studio 2005 to a service via the Add Web Reference dialog box, it generates a proxy class for me.

I'm using the WSDL utility to generate all my proxy services just fine (although the old one generates a bunch of warnings).

I am currently pointing the WSDL utility to the URLs of the deployed web services. All of them were developed in Java.

I want to use the WSDL command line utility in my build process so that every time I compile I have the most up-to-date proxy code.

0


source to share


3 answers


Try to specify the SOAP12 protocol option

/ protocol: protocol ( as shown on MSDN )

Specifies the protocol to be implemented. You can specify SOAP (default), HttpGet, HttpPost, or your own protocol specified in the config file. When using the / parameters option, this value is an element and contains a string.

If that doesn't help, then .......



Visual Studio Add Web Link calls WSDL.exe when adding a Web link. Basically there is no difference other than the one you save when you run WSDL.exe from the command line. I suspect one of your arguments is wrong or different from the one that Visual Studio installs alone.

To test this, you will need to compare the output from two different XSD files that are generated, which will give you more information on what is wrong (as Clazzazt suggested).

Luck

+2


source


Is this an XSD file? files have dependencies. Download the dependency files and place them side / side / side with the loaded XSD. I would suggest that visual studio might be asking for dependencies.



If this does not solve the problem, please provide more details.

0


source


I managed to get rid of this error by decorating a (specific) ServiceBehavior and giving it a namespace.

using System.ServiceModel;

[ServiceBehavior(Name = "MyConcreteServiceName", Namespace = "http://www.mycompany.com/services/")]
public class MyConcreteService: IMyService
{
}

      

Note: Set via ServiceBehavior attribute on service class (not contract (interface))

Instead of this:

<wsdl:definitions name="MyConcreteServiceName" targetNamespace="http://tempuri.org/">

      

I got it:

<wsdl:definitions name="MyConcreteServiceName" targetNamespace="http://www.mycompany.com/services/">

      

0


source







All Articles