470,647 Members | 1,409 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,647 developers. It's quick & easy.

Separate WSDL File

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="http://www.w3.org/2001/XMLSchema"
targetNamespace="http://test.com/TestService" name="GetCustomerService"
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
namespace="http://test.com/TestService" />
<message name="getCustomerIn">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<part name="messagePart" element="tns:TestRequest" />
<message name="getCustomerOut">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<part name="messagePart" element="tns:TestResponse" />
<portType name="GetCustomerServiceInterface">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<operation name="GetCustomer">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<input message="tns:getCustomerIn" />
<output message="tns:getCustomerOut" />
<binding name="CustomerInterface" type="tns:GetCustomerServiceInterface">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<operation name="GetCustomer">
<soap:operation soapAction="http://test.com/TestService:GetCustomer"
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="http://schemas.xmlsoap.org/wsdl/http/"
<wsdl:import namespace="http://test.com/TestService"
location="http://localhost/TestService/GetCustomerService.wsdl" />
<wsdl:types />
<wsdl:service name="CustomerService">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<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= "http://test.com/TestService")]
public class CustomerService

/// <remarks/>

[System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://test.com/TestService:GetCustomer",
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="http://test.com/TestService")] TestRequest TestRequest)
return null;

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

/// <remarks/>
public string id;

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

/// <remarks/>
public string Name;

/// <remarks/>
public string Age;

/// <remarks/>
public string dob;

Thanks for any help,

Nov 12 '05 #1
0 1763

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by saish | last post: by
3 posts views Thread by Arpan | last post: by
9 posts views Thread by Cesar | last post: by
3 posts views Thread by Siva | last post: by
reply views Thread by warner | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.