By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,494 Members | 1,502 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,494 IT Pros & Developers. It's quick & easy.

Separate WSDL File

P: n/a
If anyone could help with this, I would greatly appreciate it!

I've created my own WSDL file and referenced an XSD file too. I've generated
a service side interface using wsdl /server, and created an ASMX file from
this. I've then set the Binding for the class and methods and set the
Location to my WSDL file. If I put the wsdl:service element in the WSDL file
that points to my endpoint, I can go to Add Web Reference and my methods show
up, add the reference, and all is ok.

However, what I want to do is to be able to browse to the ASMX file and do
page?WSDL to use my binding, but for Visual Studio to add the service
endpoint. So, I added a Location attribute and binding to the class and
binding to the method, but when I Add Web Reference on the asmx file, I get
no methods dispalyed (I get the error that no ports or methods are available)
and no methods added to my project. The WSDL that Visual Studio creates has
imported my WSDL file without problems, and as I said, if I use the same one
but add my own endpoint in and browse to that to add a web reference, it
works. Is there any reason why I can't create my own XSD and WSDL, set the
Location attribute to my WSDL in my code and for it to work as I expect?

This is my WSDL where I define my own service, which works:
<?xml version="1.0" encoding="utf-8"?>
<definitions xmlns:xsd=""
targetNamespace="" name="GetCustomerService"
<documentation xmlns="" />
namespace="" />
<message name="getCustomerIn">
<documentation xmlns="" />
<part name="messagePart" element="tns:TestRequest" />
<message name="getCustomerOut">
<documentation xmlns="" />
<part name="messagePart" element="tns:TestResponse" />
<portType name="GetCustomerServiceInterface">
<documentation xmlns="" />
<operation name="GetCustomer">
<documentation xmlns="" />
<input message="tns:getCustomerIn" />
<output message="tns:getCustomerOut" />
<binding name="CustomerInterface" type="tns:GetCustomerServiceInterface">
<soap:binding transport=""
style="document" />
<operation name="GetCustomer">
<soap:operation soapAction=""
style="document" />
<soap:body use="literal" />
<soap:body use="literal" />
<service name="CustomerService">
<port name="CustomerInterface" binding="tns:CustomerInterface">
<soap:address location="http://localhost/TestService/TestService.asmx"/>

This is the one VS produces:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http=""
<wsdl:import namespace=""
location="http://localhost/TestService/GetCustomerService.wsdl" />
<wsdl:types />
<wsdl:service name="CustomerService">
<documentation xmlns="" />
<wsdl:port name="CustomerInterface" binding="i0:CustomerInterface">
<soap:address location="http://localhost/TestService/TestService.asmx"

This looks ok to me. The code looks like this:
namespace Test.TestService
using System.Diagnostics;
using System.Xml.Serialization;
using System;
using System.Web.Services.Protocols;
using System.ComponentModel;
using System.Web.Services;
/// <remarks/>

[System.Web.Services.WebServiceBindingAttribute(Nam e="CustomerInterface",

[System.Web.Services.WebServiceAttribute(Namespace= "")]
public class CustomerService

/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare,Binding="CustomerInterface")]
System.Xml.Serialization.XmlElementAttribute("Test Response",
public TestResponse
GetCustomer([System.Xml.Serialization.XmlElementAttribute(Names pace="")] TestRequest TestRequest)
return null;

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="")]
public class TestRequest

/// <remarks/>
public string id;

/// <remarks/>
[System.Xml.Serialization.XmlTypeAttribute(Namespac e="")]
public class TestResponse

/// <remarks/>
public string Name;

/// <remarks/>
public string Age;

/// <remarks/>
public string dob;

Thanks for any help,

Nov 12 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.