473,545 Members | 1,890 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reference a SoapExtension instance from within a WebMethod?

Hi,

Is it possible to reference a custom SoapExtension instance from within a
WebMethod?

I have a SoapExtension used by several web-services for generic logging.
The SoapExtension logs the ServiceId, Soap Request, Start Time, End Time
etc. to the database. I need to get the Id of the row the SoapExtension
inserts into
the database from within the Web Method. (The web method sends a
text-formatted request based on the SoapRequest to an external system and
that needs to be logged in the same database row)

Has anyone had a similar problem?... and if so, how did you approach it?

-Trevor
Nov 23 '05 #1
3 3599

"Trevor Pinkney" <tp******@cyenc e.com> wrote in message
news:16******** ************@ne ws.microsoft.co m...
Hi,

Is it possible to reference a custom SoapExtension instance from within a
WebMethod?

I have a SoapExtension used by several web-services for generic logging.
The SoapExtension logs the ServiceId, Soap Request, Start Time, End Time
etc. to the database. I need to get the Id of the row the SoapExtension
inserts into the database from within the Web Method. (The web method
sends a text-formatted request based on the SoapRequest to an external
system and that needs to be logged in the same database row)

Has anyone had a similar problem?... and if so, how did you approach it?

-Trevor


Hi,

Are you hosting the web service in IIS? If so, the SoapExtension can can
store the Id into HttpContext.Cur rent.Cache with a known key. The web method
can then get the Id from the cache using the same key.

Regards,
Sami
Nov 23 '05 #2
Hello Sami,

Thanks for the idea but unfortunately that will cause problems with concurrent
requests because one Id may overwrite another.

"The Cache has some similarities to the Application object and is a container
of global data (as opposed to session-specific data)"

I might end up using Session though which is along the same lines.

-Trevor

"Trevor Pinkney" <tp******@cyenc e.com> wrote in message
news:16******** ************@ne ws.microsoft.co m...
Hi,

Is it possible to reference a custom SoapExtension instance from
within a WebMethod?

I have a SoapExtension used by several web-services for generic
logging. The SoapExtension logs the ServiceId, Soap Request, Start
Time, End Time etc. to the database. I need to get the Id of the row
the SoapExtension inserts into the database from within the Web
Method. (The web method sends a text-formatted request based on the
SoapRequest to an external system and that needs to be logged in the
same database row)

Has anyone had a similar problem?... and if so, how did you approach
it?

-Trevor

Hi,

Are you hosting the web service in IIS? If so, the SoapExtension can
can store the Id into HttpContext.Cur rent.Cache with a known key. The
web method can then get the Id from the cache using the same key.

Regards,
Sami


Nov 23 '05 #3
You are right, using the Cache you would have to handle concurrent access.
HttpContext.Cur rent.Items, on the other hand, is per-request and should be
safe from concurrency issues.

Regards,
Sami

"Trevor Pinkney" <tp******@cyenc e.com> wrote in message
news:35******** ************@ne ws.microsoft.co m...
Hello Sami,

Thanks for the idea but unfortunately that will cause problems with
concurrent requests because one Id may overwrite another.

"The Cache has some similarities to the Application object and is a
container of global data (as opposed to session-specific data)"

I might end up using Session though which is along the same lines.

-Trevor

"Trevor Pinkney" <tp******@cyenc e.com> wrote in message
news:16******** ************@ne ws.microsoft.co m...
Hi,

Is it possible to reference a custom SoapExtension instance from
within a WebMethod?

I have a SoapExtension used by several web-services for generic
logging. The SoapExtension logs the ServiceId, Soap Request, Start
Time, End Time etc. to the database. I need to get the Id of the row
the SoapExtension inserts into the database from within the Web
Method. (The web method sends a text-formatted request based on the
SoapRequest to an external system and that needs to be logged in the
same database row)

Has anyone had a similar problem?... and if so, how did you approach
it?

-Trevor

Hi,

Are you hosting the web service in IIS? If so, the SoapExtension can
can store the Id into HttpContext.Cur rent.Cache with a known key. The
web method can then get the Id from the cache using the same key.

Regards,
Sami


Nov 23 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2148
by: Dave Buxbaum via .NET 247 | last post by:
Hi, I have a SoapExtension that adds a SoapHeader to all outboundmessages. This works fine, but I don't see a way to control thenamespace of the emitted header. Here is what I'm doing: I have created a subclass of SoapHeader ('MyHeader') and thisclass is in a defined namespace. I then create an instance ofthis class within my SoapExtension...
1
1262
by: alex bean | last post by:
How do i get them value of the web service namespace from inside a SoapExtension? For example my web service is defiend as: public class MyTest: WebService { public string HelloWorld(y)
2
6547
by: SP | last post by:
Hello All, I have a web method in a web service as follows: public SqlDataReader Display_test_data() { string connectionInfo = ConfigurationSettings.AppSettings;
0
812
by: jgrant | last post by:
Hi I am pretty new in SoapExtension so I will like to know if there is any "Hello World" example that uses SoapExtension and with Xsd for a WebMethod. Thanks.
2
5577
by: lprisr | last post by:
Hi, I have double byte characters in the content that I am returning using Web Services. However, the encoding in the xml file returned by Web Services is utf-8 and I am unable to read the content, not even by changing browser encoding setting to the appropriate one. I implemented SoapExtension (called EncodingExtension) to rewrite the...
10
2201
by: Andy Kendall | last post by:
I have a problem accessing my custom SoapHeader from a SoapExtension. My extension has no compile time reference to the class derived from SoapHeader, so how can cast it into a SoapHeader of the correct type? Thanks, Andy
0
911
by: Madhu Kumar | last post by:
Hi, I am working in C# web services. In my web service i included a soapextension class(ya attribute class too). using a client application i tried to consume the web method but error: 'Response is not well formed XML' is returned. Could any one help me please. regards, Madhu
2
2134
by: John | last post by:
I'm calling the Webmethod from JS and at the end of the function I would like to do a a ListViewBillable.DataBind() in the Webmethod, calling a postback from JS is not rendering the correct results. How would I make a Reference to it as an Object to call the DataBind in the Webmethod VB code? Thanks John
0
1141
by: creatiive | last post by:
hi, i have a program that when executed, creates an instance of itself and then runs a method (that has been written in its base class). This works fine, and looks like this; public static void Main(string args) { ObjectOne myObject = new ObjectOne(); myObject.performUpdate(); } I have a windows...
0
7478
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7410
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7668
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7923
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
4960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1901
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
722
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.