Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Services > Binding a WSDL file to a web service class

Reply
Thread Tools

Binding a WSDL file to a web service class

 
 
Youcef
Guest
Posts: n/a
 
      08-20-2004
I started developing an ASP.NET web service by explicitly
designing the WSDL and separating the data type definitions into XSD
files. I followed the steps described in the following MSDN article to
enlist the help of VS.NET in doing this through the use of separate
namespaces and the [WebServiceBindingAttribute]. See :

http://msdn.microsoft.com/library/de...ce08202002.asp

But I found that I couldn't pass an XML Schema ComplexType (e.g. an
address class) as an input parameter to one of the methods of the web
service !! If I pass a simple type or I move the same complextype
parameter as a return value from the method, VS.NET 2003 generates the
right stuff and the method is listed among the available methods for
the web service . I spent 2 days checking and re-checking everything
to no avail. This must be a bug, but I couldn't find it mentioned
anywhere. Has anybody tried this ?
 
Reply With Quote
 
 
 
 
Youcef
Guest
Posts: n/a
 
      08-20-2004
By the way, below is the simplified example of my web service and the
complextype I'm trying to pass in as parameter. The WSDL and XSD files were
generated and fixed as described in the MSDN article:

[WebServiceAttribute(Namespace="http://acme.com/2004/SampleService")]
[WebServiceBindingAttribute("SampleBinding",
"http://acme.com/2004/SampleService/SampleBinding",
"http://localhost/SampleService/Service1.wsdl")]

public class UserService : System.Web.Services.WebService
{
public UserService()
{
//CODEGEN: This call is required by the ASP.NET Web Services Designer
InitializeComponent();
}

#region Component Designer generated code

//Required by the Web Services Designer
private IContainer components = null;

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if(disposing && components != null)
{
components.Dispose();
}

base.Dispose(disposing);
}

#endregion

// WEB SERVICE EXAMPLE

[WebMethod]
[SoapDocumentMethodAttribute(Binding="SampleBinding ")]
public void StoreUser(User userData)
{
}
}


and here is the definition of the input parameter of type User ( a
complextype):

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://acme.com/2004/SampleService/DataTypes")]
public class User
{
public string firstname;
public string lastname;
}






"Youcef" wrote:

> I started developing an ASP.NET web service by explicitly
> designing the WSDL and separating the data type definitions into XSD
> files. I followed the steps described in the following MSDN article to
> enlist the help of VS.NET in doing this through the use of separate
> namespaces and the [WebServiceBindingAttribute]. See :
>
> http://msdn.microsoft.com/library/de...ce08202002.asp
>
> But I found that I couldn't pass an XML Schema ComplexType (e.g. an
> address class) as an input parameter to one of the methods of the web
> service !! If I pass a simple type or I move the same complextype
> parameter as a return value from the method, VS.NET 2003 generates the
> right stuff and the method is listed among the available methods for
> the web service . I spent 2 days checking and re-checking everything
> to no avail. This must be a bug, but I couldn't find it mentioned
> anywhere. Has anybody tried this ?
>

 
Reply With Quote
 
 
 
 
Dino Chiesa [Microsoft]
Guest
Posts: n/a
 
      08-23-2004
instead of a named complexType, can you specify the input datatype as an
element?


"Youcef" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> By the way, below is the simplified example of my web service and the
> complextype I'm trying to pass in as parameter. The WSDL and XSD files

were
> generated and fixed as described in the MSDN article:
>
> [WebServiceAttribute(Namespace="http://acme.com/2004/SampleService")]
> [WebServiceBindingAttribute("SampleBinding",
> "http://acme.com/2004/SampleService/SampleBinding",
> "http://localhost/SampleService/Service1.wsdl")]
>
> public class UserService : System.Web.Services.WebService
> {
> public UserService()
> {
> //CODEGEN: This call is required by the ASP.NET Web Services Designer
> InitializeComponent();
> }
>
> #region Component Designer generated code
>
> //Required by the Web Services Designer
> private IContainer components = null;
>
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> }
>
> /// <summary>
> /// Clean up any resources being used.
> /// </summary>
> protected override void Dispose( bool disposing )
> {
> if(disposing && components != null)
> {
> components.Dispose();
> }
>
> base.Dispose(disposing);
> }
>
> #endregion
>
> // WEB SERVICE EXAMPLE
>
> [WebMethod]
> [SoapDocumentMethodAttribute(Binding="SampleBinding ")]
> public void StoreUser(User userData)
> {
> }
> }
>
>
> and here is the definition of the input parameter of type User ( a
> complextype):
>
>

[System.Xml.Serialization.XmlTypeAttribute(Namespac e="http://acme.com/2004/S
ampleService/DataTypes")]
> public class User
> {
> public string firstname;
> public string lastname;
> }
>
>
>
>
>
>
> "Youcef" wrote:
>
> > I started developing an ASP.NET web service by explicitly
> > designing the WSDL and separating the data type definitions into XSD
> > files. I followed the steps described in the following MSDN article to
> > enlist the help of VS.NET in doing this through the use of separate
> > namespaces and the [WebServiceBindingAttribute]. See :
> >
> >

http://msdn.microsoft.com/library/de...ce08202002.asp
> >
> > But I found that I couldn't pass an XML Schema ComplexType (e.g. an
> > address class) as an input parameter to one of the methods of the web
> > service !! If I pass a simple type or I move the same complextype
> > parameter as a return value from the method, VS.NET 2003 generates the
> > right stuff and the method is listed among the available methods for
> > the web service . I spent 2 days checking and re-checking everything
> > to no avail. This must be a bug, but I couldn't find it mentioned
> > anywhere. Has anybody tried this ?
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating a Web Service (Service, not Client) from WSDL Bert Leu ASP .Net 1 11-23-2007 08:29 PM
Creating a Web Service (Service, not Client) from WSDL Bert Leu ASP .Net Web Services 1 11-23-2007 07:59 PM
wsdl.exe fails with WebMethods generated wsdl file mrnu ASP .Net Web Services 0 06-07-2004 04:51 PM
WSDL file produces useless class when imported with WSDL.exe RH ASP .Net Web Services 1 05-27-2004 09:40 PM
is the w3c's schema for wsdl and wsdl/soap binding possibly buggy ? _clb_ Chris Bedford XML 0 08-20-2003 11:52 PM



Advertisments