473,396 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Web Service Soap extension , how set attribute

I try set soap extension attributes on client side. For example:

Implementation in web service:

Expand|Select|Wrap|Line Numbers
  1. [AttributeUsage(AttributeTargets.Method)]
  2. public class EncryptMessageAttribute : SoapExtensionAttribute
  3. {
  4. private string strKey="null";
  5.  
  6. public string StrKey
  7. {
  8. get {  return strKey; }
  9.  
  10. set { strKey = value; }    
  11. }
  12. }
  13.  
Soap extension class:

Expand|Select|Wrap|Line Numbers
  1. public class EncryptMessage : SoapExtension
  2. {
  3. ...
  4. }
  5.  
Used on web method:

Expand|Select|Wrap|Line Numbers
  1. [WebMethod]
  2. [EncryptMessage( StrKey = "pass")]
  3. public string test2()
  4. {
  5. return "ok";
  6. }
Implementation in Proxy class:

Expand|Select|Wrap|Line Numbers
  1. [System.Web.Services.Protocols.SoapDocumentMethodAttribute("http://tempuri.org/test", RequestNamespace="http://tempuri.org/", ResponseNamespace="http://tempuri.org/", Use=System.Web.Services.Description.SoapBindingUse.Literal, ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
  2. [EncryptMessage( StrKey = "pass")]
  3. public string test() {
  4. object[] results = this.Invoke("test", new object[0]);
  5. return ((string)(results[0]));
  6. }

Soap extension attributes are::[EncryptMessage( StrKey = "pass")]

I want set Soap Extension Attribute on client side, before than I use Soap Extension, when I call some web methods.

Example: I call some method, wich set soap extension attributes on both side, before than soap extension is used. Can somebody help me ?
Sep 9 '09 #1
1 4798
I have problem, I want set soap extension attribute in web method:
Soap extension in web service:

Expand|Select|Wrap|Line Numbers
  1. public class EncryptMessageAttribute : SoapExtensionAttribute
  2. {
  3. private string strKey="null";
  4.  
  5. public void  setKey(string s)
  6. {
  7. strKey=s;
  8. }
  9. }
Soap extension class:

Expand|Select|Wrap|Line Numbers
  1. public class EncryptMessage : SoapExtension
  2. {
  3. ....
  4. }

Soap extension on web method:

Expand|Select|Wrap|Line Numbers
  1. public class Service1 : System.Web.Services.WebService
  2. {
  3. public string k;
  4.  
  5. [WebMethod]
  6. [EncryptMessageAttribute(setKey(k))]
  7. public string test2()
  8. {
  9. return "ok";
  10. [WebMethod]
  11. [EncryptMessage(setKey(k))]
  12. public string test2()
  13. {
  14. return "ok";
  15. }
  16.  
  17. }

It finish with this compile error:

Error 1 The name 'setKey' does not exist in the current context
Error 2 An object reference is required for the non-static field, method, or property

Can somebody help me??
Sep 9 '09 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: David | last post by:
Hi everyone, I wonder how is it possible to make PHP SOAP extension convert the returned complex type to an instance of one of my classes. Here I give you a short example: complexTest.wsdl:...
1
by: David C. allen | last post by:
I have created a simple Client-side SOAP Extension for a webclass that I have. When I apply the extension attribute to the the calling function in the proxy class I get an error 'Value cannot be...
3
by: Dejan | last post by:
I was trying, for the first time, to create a (fairly simple) SOAP extension for some of my web services. They were to be called from the WindowsForms host application. Following error message...
4
by: pepcag | last post by:
I used http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconalteringsoapmessageusingsoapextensions.asp as a template to create a very simple web method with soap...
0
by: Amar | last post by:
I am recieving the "The root element is missing" error from my soap extension while attempting to validate an incoming SOAP message request. I suspect the problem resides in the ChainStream method...
4
by: Ramon de Klein | last post by:
I have created a SOAP extension that can be enabled using a SoapExtensionAttribute. This attibute holds two additional properties that are used to configure the SOAP extension. This works fine, but...
0
by: Robert Rotstein | last post by:
I want to write a SOAP extension that gets activated from both the client and the server. From whast I have read, this should be quite easy to do. Yet I can only activate it from the server. I...
0
by: Robert Rotstein | last post by:
I want to write a SOAP extension that gets activated from both the client and the server. But so far, I have only been able to activate from the server. I have a service (.asmx file) which...
0
by: Søren | last post by:
I have a web service with a SOAP extension loggin the SOAP. In the client's config file a <soapExtensionTypes> section is added and the SOAP extension is called as expected. Now the client is...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.