[Mono-aspnet-list] How for force asmx web service to generate proper wsdl file

Andrus kobruleht2 at hot.ee
Mon Aug 23 12:38:32 EDT 2010


ASMX web service is defined as

namespace MyApp.Service
{
    [WebService(Namespace = "MyNsp1")]
    [ServiceContract(Name = "Name", Namespace = http://mycomp.com)]
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    [AspNetCompatibilityRequirements(RequirementsMode = 
AspNetCompatibilityRequirementsMode.Allowed)]   // required to get caller ip 
address
    public sealed partial class  MyService: WebService {
......

}

Class called from service method refers types using only from type 
parameters:

namespace MyApp.Service
{
    sealed class WholeMenuBuilder : MenuBuilder
    {
        internal void Build()
        {
            MenuBuilder listMenu = new MenuBuilder();
            listMenu.Add<Bilkaib>();
            listMenu.Add<Customer>();
.....


Mono 2.4 ASMX proxy generates WSDL file for those types without namespace 
qualifier:

<?xml version="1.0" encoding="utf-16"?>
<xs:schema elementFormDefault="qualified" 
xmlns:xs="http://www.w3.org/2001/XMLSchema">
  <xs:complexType name="EntityBase"/>
  <xs:complexType name="Bilkaib">
    <xs:complexContent mixed="false">
      <xs:extension base="EntityBase">
        <xs:sequence>
          <xs:element minOccurs="0" maxOccurs="1" name="Adoknr" 
type="xs:string"/>
..

This violates standard as noted in proxy page:

R2105: All xsd:schema elements contained in a wsdl:types element of a 
DESCRIPTION MUST have a targetNamespace attribute with a valid and non-null 
value, UNLESS the xsd:schema element has xsd:import and/or xsd:annotation as 
its only child element(s)
Schema '', in Service Description 'MyNsp1'

How to make Mono generated WSDL standard compatible ?
Not sure is this caused by using type only as generic parameter or by 
something other.

Andrus.

WSDL file generated by VS2010 includes namespaces for those types:

<?xml version="1.0" encoding="utf-8" ?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="MyNsp1" 
xmlns:s="http://www.w3.org/2001/XMLSchema" 
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="MyNsp1" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
...
 <s:complexType name="Bilkaib">
 <s:complexContent mixed="false">
 <s:extension base="tns:EntityBase">
 <s:sequence>
  <s:element minOccurs="0" maxOccurs="1" name="Adoknr" type="s:string" />
..



More information about the Mono-aspnet-list mailing list