Separate WSDL File



Hi,
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";
xmlns:tns="http://test.com/TestService";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
targetNamespace="http://test.com/TestService"; name="GetCustomerService"
xmlns="http://schemas.xmlsoap.org/wsdl/";>
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/"; />
<types>
<xsd:schema>
<xsd:import
schemaLocation="http://localhost/TestService/TestService.xsd";
namespace="http://test.com/TestService"; />
</xsd:schema>
</types>
<message name="getCustomerIn">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/"; />
<part name="messagePart" element="tns:TestRequest" />
</message>
<message name="getCustomerOut">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/"; />
<part name="messagePart" element="tns:TestResponse" />
</message>
<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" />
</operation>
</portType>
<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" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="CustomerService">
<port name="CustomerInterface" binding="tns:CustomerInterface">
<soap:address location="http://localhost/TestService/TestService.asmx"/>
</port>
</service>
</definitions>

This is the one VS produces:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/";
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/";
xmlns:s="http://www.w3.org/2001/XMLSchema";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:i0="http://test.com/TestService";
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/";
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/";
targetNamespace="http://test.com/TestService";
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/";>
<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";
/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

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(Name="CustomerInterface",
Namespace="http://test.com/TestService",Location="http://localhost/TestService/GetCustomerService.wsdl";)]

[System.Web.Services.WebServiceAttribute(Namespace="http://test.com/TestService";)]
public class CustomerService
{

/// <remarks/>
[System.Web.Services.WebMethodAttribute()]

[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://test.com/TestService:GetCustomer";,
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare,Binding="CustomerInterface")]
[return:
System.Xml.Serialization.XmlElementAttribute("TestResponse",
Namespace="http://test.com/TestService";)]
public TestResponse
GetCustomer([System.Xml.Serialization.XmlElementAttribute(Namespace="http://test.com/TestService";)] TestRequest TestRequest)
{
return null;
}
}

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

/// <remarks/>
public string id;
}

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

/// <remarks/>
public string Name;

/// <remarks/>
public string Age;

/// <remarks/>
public string dob;
}
}

Thanks for any help,
Dave

.



Relevant Pages

  • Re: WSDL Generated Proxy Classes?
    ... WSDL file is that each client can download the WSDL file and generate ... But what proxy classes do, the same can be done using business objects. ... Both Web Services & business objects require compiled objects that are ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: WSDL Generated Proxy Classes?
    ... Namespace lines) is encapsulated in an ASMX file after which WSDL is ... WSDL is Web Service Description Language. ... The advantage of generating a WSDL file is that each client can download the WSDL file and generate proxy "on the fly". ... However, there are also other consumers of web services, and they also create proxies in JavaScript dynamically using the WSDL file. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: How to Return an XML Doc via a Web Method
    ... There can be issues getting your .NET WSDL recognized in something ... but if you are interfacing with Java that is not an option (that I ... > I am trying to return an xml document from a asp .net web service. ... > WSDL file from a java client. ...
    (microsoft.public.dotnet.framework.webservices)
  • RFC: SOAP module with implicit WSDL generation
    ... WSDL file. ... with the first element containing all the parameters defined ... More complex types will follow, ...
    (comp.lang.perl.modules)
  • Re: tclsoap array-based queries
    ... How to use the WSDL file ... The WSDL file provides a standard description of CDAS web services. ... error changes to: ...
    (comp.lang.tcl)