473,288 Members | 1,718 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,288 software developers and data experts.

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(Nam e="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.SoapDocumentMethodAt tribute("http://test.com/TestService:GetCustomer",
Use=System.Web.Services.Description.SoapBindingUse .Literal,
ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Bare,Binding="CustomerInterface")]
[return:
System.Xml.Serialization.XmlElementAttribute("Test Response",
Namespace="http://test.com/TestService")]
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,
Dave

Nov 12 '05 #1
0 1913

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: trexim | last post by:
Hi, I am trying to create a Web Reference for CSTA using the URL http://www.ecma-international.org/standards/ecma-348/csta-wsdl/csta-wsdl-all-operations.wsdl Visual .Net complains that: "...
1
by: ffhansix | last post by:
Hi, I am having problems with generating a c# proxy class from a IBM websphere WSDL file, when running the wsdl.exe to create the c# proxy file command i recieve an error: Warning: one or...
0
by: saish | last post by:
Hello I am new to vb.net webservice. My requirement is to design a VB.net web service which will send and receive xml documents. The xml document send and received would be a very complex .xsd...
1
by: drb | last post by:
Hi, Newbie question #2 - hope that's OK! I'm trying to create a WSDL file using one or more XSD schema files. While WSDL.exe doesn't seem to support the XSD "import" function, if I include a...
10
by: Zoe Hart | last post by:
I have a wsdl file that I received from a third party and I'm using wsdl.exe (.NET 2.0) to import it and generate a proxy class. I've actually got a proxy class that works, but I'm trying to...
4
by: WebDev2 | last post by:
I have a web service created via Visual Web Developer Express Edition on a IIS Server with .NET 2.0 installed. The test page displays just fine when the URL of the .asmx page is entered into a...
3
by: Arpan | last post by:
Web Services make use of proxy classes whose methods & properties are accessed in exactly the same way as how a normal class' methods & properties are accessed. So what for does ASP.NET generate...
9
by: Cesar | last post by:
Hello there, A java programmer sent me a wsdl file, which I have to use to consume his web methods. When I run the wsld.exe tool to generate the class' code, I get the following message: ...
3
by: Siva | last post by:
Hi all, I want to Convert a WSDL to a SOAP message. Is there any way to do this. I am using .NET 2.0 Thanks in Advance Siva
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.