My blog has moved and can now be found at http://blog.aniljohn.com

No action is needed on your part if you are already subscribed to this blog via e-mail or its syndication feed.

Tuesday, May 10, 2005
« Mid-Atlantic Code Camp | Main | IEEE Computer Society Meeting (5/19/2005... »

The majority of the web service work that I am involved with has platform/technology Interop in the mix. As such I lean towards the WSDL-First style of web service development. I am also pragmatic enough to try to start out with a subset of schema that is supported on both ends of the pipe.. More on that later.

Since I generate the WSDL first, I really do not want the auto generated WSDL to show up on the .NET Web service documentation page. So I actually would like the "Service Description" link to point to my manually generated WSDL instead of the one generated by "MyWebService.asmx?WSDL".

I was under the impression that setting the Location property of the WebServiceBindingAttribute would enable me to point to my WSDL. In effect, map the "Service Description" link to my WSDL location.

But unfortunately that does not seem to be happening.  Here is the relevant code:

[WebServiceAttribute(
    Namespace="urn:my:service:2005:04:16",
    Description="This is a DEV instance of myService.")]
[WebServiceBindingAttribute(
    Name="myWebService", 
    Namespace="urn:my:service:2005:04:16",
    Location="myWebService.wsdl")]

I am missing something obvious. Any ideas?

UPDATE: I got this to work ....after a fashion. The trick is to make sure that you specify the WebServiceAttribute Binding Name (i.e. "myWebService") as the Binding on the SoapDocumentMethodAttribute for EVERY SINGLE web method.

[WebMethodAttribute(
   Description="Not Implemented")]
[System.Web.Services.Protocols.SoapDocumentMethodAttribute(
   Action="urn:my:services:2005:04:16:setSomething",
   Binding="myWebService",
   Use=System.Web.Services.Description.SoapBindingUse.Literal,
   ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Bare)]
public string
setSomething(SomeType setSomething)
{
}

When you do this, the Service Description link on the documentation page still points to the auto-generated WSDL location, but instead of the complete WSDL, what you will get is a WSDL import statement that looks like this:

<wsdl:import namespace="urn:my:service:2005:04:16" location="myWebService.wsdl" />

which points to my manually generated WSDL. Very nice!

The only issue that I am running into is that one of my Web Methods is simply NOT showing up at all on the documentation page.. <sigh>. I think it has something to do with the Request Type that I am passing in.

5/10/2005 10:42 PM Eastern Daylight Time  |  Comments [7]  |  Disclaimer  |  Permalink    Tracked by:
"re:IEEE Computer Society Meeting (5/19/2005 ) - Application of Operations Resea... [Trackback]
Thursday, May 12, 2005 1:12:23 PM (Eastern Daylight Time, UTC-04:00)
Doesn't that location have to be in URL format?
Thursday, May 12, 2005 1:36:00 PM (Eastern Daylight Time, UTC-04:00)
I did try that, Scott.. No joy :-(
Friday, May 27, 2005 5:40:34 PM (Eastern Daylight Time, UTC-04:00)
I have a similar problem (missing method) and I was wondering if you found an answer for this. The missing method is the one on which I have the SoapDocumentMethodAttribute.
Amina
Monday, May 30, 2005 10:37:40 PM (Eastern Daylight Time, UTC-04:00)
Amina,

I did not find a resolution to this.. and after a bit, lost patience as well. :-)

What I finally ended up doing was to take out the location attribute. What I then did was use the "wsdlHelpGenerator" in web.config to create a Custom Documenation page (Instead of the auto generated one) on which I described the web service and provided my WSDL and Schema for download.

< webServices >
< wsdlHelpGenerator href="myWebServiceDesc.aspx" / >
< /webServices >

If you do find a resolution to the location problem, please do let me know..
Anil John
Saturday, September 10, 2005 5:48:34 AM (Eastern Daylight Time, UTC-04:00)
From MSDN:

A binding, as defined by Web Services Description Language (WSDL), is similar to an interface, in that it defines a concrete set of operations. Each XML Web service method is an operation within a particular binding. XML Web service methods are members of either the default binding for an XML Web service or in a binding specified within a WebServiceBindingAttribute applied to a class implementing an XML Web service. An XML Web service can implement multiple bindings, by applying multiple WebServiceBindingAttribute attributes to an XML Web service.

So obviously you would have the scenario that you are currenlty facing.

Monday, January 9, 2006 12:24:56 PM (Eastern Standard Time, UTC-05:00)
Doesnt work for me :(
Sunday, September 10, 2006 11:34:12 PM (Eastern Daylight Time, UTC-04:00)
thanks
Comments are closed.