webservice and method decoration

F

Francesco Spegni

hi there,

i'm a newbie in this field and i hope i'm not asking a very stupid
question, but googling i didn't find my way out of here.

what i want to do is to write a method, export it through a webservice
in such a way that the result is sent back to the caller in a
compressed way (the soap header remains uncompressed, but the body of
the soap message is compressed). so i followed the instructions here:

http://www.mastercsharp.com/article.aspx?ArticleID=86&TopicID=7

and it's easy to understand what it does. at least i think so. the
problem is a step further. let's say i export the webmethod:

[WebMethod,CompressionExtension]
public string foo_method(...)
{
....
}

at the address http://localhost/mywebservice.asmx . now, if i try to
create a proxy for my webservice through the:

c:\> wsdl http://localhost/mywebservice.asmx?wsdl

command, what i get is a (auto-generated) class containing a (auto-
generated) method:

[WebMethod]
public string foo_method(...)
{
....
}

this means that invokin the foo_method() from my proxy, i get an error
because the result is compressed while proxy expects it to be
uncompressed. so what i do is to modify the proxy method manually
adding the CompressionExtension.

the question is: how can i do in order to let wsdl to auto-generate
also the [CompressionExtension] decoration? in this way i can make
faster (and "batchable") my development and deployment phases. i hope
i was able to explain my trouble.

thank you in advantage for any hint you can give to me :)

have a nice day

francesco
 
J

John Saunders [MVP]

Francesco Spegni said:
hi there,

i'm a newbie in this field and i hope i'm not asking a very stupid
question, but googling i didn't find my way out of here.

what i want to do is to write a method, export it through a webservice
in such a way that the result is sent back to the caller in a
compressed way (the soap header remains uncompressed, but the body of
the soap message is compressed). so i followed the instructions here:

http://www.mastercsharp.com/article.aspx?ArticleID=86&TopicID=7

and it's easy to understand what it does. at least i think so. the
problem is a step further. let's say i export the webmethod:

[WebMethod,CompressionExtension]
public string foo_method(...)
{
...
}

at the address http://localhost/mywebservice.asmx . now, if i try to
create a proxy for my webservice through the:

c:\> wsdl http://localhost/mywebservice.asmx?wsdl

command, what i get is a (auto-generated) class containing a (auto-
generated) method:

[WebMethod]
public string foo_method(...)
{
...
}

You should not be getting a [WebMethod] attribute on your proxy methods.
What command line did you use in the WSDL command?
 
F

Francesco Spegni

You should not be getting a [WebMethod] attribute on your proxy methods.
What command line did you use in the WSDL command?

oops, you're right i said a wrong thing: what i really get is
something like:

/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://
attiweb/Autentica", RequestNamespace="http://attiweb/",
ResponseNamespace="http://attiweb/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,

ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public CoppiaOfInt32String[] Autentica(string strUserCredentials)
{
object[] results = this.Invoke("Autentica", new object[] {
strUserCredentials});
return ((CoppiaOfInt32String[])(results[0]));
}

where "Autentica" is the name of my webmethod and "http://attiweb" is
the namespace of my webservice. it remains the problem: i would like
to prepose the method signature with something like:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute(...),CompressionExtension]
.... rest of the method signature...

is that possible in some way?

to answer your question: the command i use is:

c:\> wsdl http://localhost/mywebservice.asmx?wsdl

(as i specified in my first message).

thanx
 
J

John Saunders [MVP]

Francesco Spegni said:
You should not be getting a [WebMethod] attribute on your proxy methods.
What command line did you use in the WSDL command?

oops, you're right i said a wrong thing: what i really get is
something like:

/// <remarks/>
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://
attiweb/Autentica", RequestNamespace="http://attiweb/",
ResponseNamespace="http://attiweb/",
Use=System.Web.Services.Description.SoapBindingUse.Literal,

ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
public CoppiaOfInt32String[] Autentica(string strUserCredentials)
{
object[] results = this.Invoke("Autentica", new object[] {
strUserCredentials});
return ((CoppiaOfInt32String[])(results[0]));
}

where "Autentica" is the name of my webmethod and "http://attiweb" is
the namespace of my webservice. it remains the problem: i would like
to prepose the method signature with something like:

[System.Web.Services.Protocols.SoapDocumentMethodAttribute(...),CompressionExtension]
... rest of the method signature...

Francesco,

I haven't tried this, but I believe that you can configure SOAP extensions
in the configuration file of your client application, the same way you can
for a web service application.

There is a more general mechanism, which will work for .NET clients, but is
more involved. See "Walkthrough: Customizing the Generation of Service
Descriptions and Proxy Classes" at
http://msdn2.microsoft.com/en-us/library/x4s9z3yc(vs.80).aspx.
 

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,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top