What is wrong with this code

D

Diego Gonzalez

If you remove the comments for the second method it does not works because
of the following error: "The namespace, urn:lagash, is a duplicate."

<%@ WebService Language="c#" Class="TestWebProject.Service1" %>

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Web;
using System.Web.Services;
using System.Xml.Serialization;

namespace TestWebProject
{
[System.Xml.Serialization.XmlTypeAttribute(Namespace="urn:lagash")]
[System.Xml.Serialization.XmlRootAttribute(Namespace="urn:lagash",
IsNullable=false)]
public class MyRequest
{
public string Something;
}

public class MyDataSet : DataSet
{
public MyDataSet()
{
this.Namespace = "urn:lagash";
}
}


[WebService(Namespace="urn:lagash")]
public class Service1 : System.Web.Services.WebService
{
[WebMethod]
public string Works( [XmlElementAttribute("req", Namespace="urn:lagash")]
MyRequest req )
{
return "Works";
}

/*
[WebMethod]
public string DoesNotWork( [XmlElementAttribute("req",
Namespace="urn:lagash")] MyDataSet req )
{
return ":(";
}
*/
}
}

Any input appreciated.

DiegoG
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,280
Latest member
BGBBrock56

Latest Threads

Top