473,797 Members | 2,970 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Soap Extension and returning Nothing

Hello.

I am writing a web service and I need to use a Soap Extension to add a
custom header that is expected at the destination. I can use the Soap
Extension successfully for adding the header in the AfterSerialize
section and the destination accepts my request and sends back the
appropriate data, but my problem comes when I try to return the data.
Depending on what I do I either get an exception that "the root element
is missing" or being returned Nothing.

The following is where the exception is being generated:

Dim results() As Object = Me.Invoke("Proc essMessage", New Object()
{payload})
payload = CType(results(0 ), Payload)

I have found some references that ChainStream in the soap extension may
be causing this issue but I am unable to find any mention of exactly
what I have to do or exactly what is causing the issue.

Any and all help is appreciated!

Thanks,

Kelly

Jul 13 '06 #1
1 1905
Maybe if I give some more information.

I can use the Soap Extension successfully for adding the header in the
AfterSerialize section and the destination accepts my request and sends
back the appropriate data, but my problem comes when I try to return
the data. Depending on what I do in the BeforeDeseriali ze staage I
either get an exception that "the root element is missing" or being
returned Nothing. I know I am getting proper response back because I
can see the response using Fiddler.

The sub which calls the webservice in my proxy class is:

Public Sub ProcessMessage( ByRef payload As Payload)
Try
Dim results() As Object = Me.Invoke("Proc essMessage", New
Object() {payload})
payload = CType(results(0 ), Payload)
Catch ex As Exception
Dim em As String = ex.Message()
End Try
End Sub

Some of the code in my soap extension:
Public Overrides Function ChainStream(ByV al stream As Stream) As Stream
MessageStream = stream
InternalStream = New MemoryStream
Return InternalStream
End Function

Sub Copy(ByVal fromStream As Stream, ByVal toStream As Stream)
Dim reader As New StreamReader(fr omStream)
Dim writer As New StreamWriter(to Stream)
writer.WriteLin e(reader.ReadTo End())
writer.Flush()
End Sub

If I have the following code in the soap extension:

Public Overrides Sub ProcessMessage( ByVal message As
System.Web.Serv ices.Protocols. SoapMessage)
Select Case message.Stage
Case SoapMessageStag e.BeforeDeseria lize
Copy(MessageStr eam, InternalStream)
InternalStream. Position = 0

I get Nothing returned.

If I have the following code:

Public Overrides Sub ProcessMessage( ByVal message As
System.Web.Serv ices.Protocols. SoapMessage)
Select Case message.Stage
Case SoapMessageStag e.BeforeDeseria lize
' do nothing

I get an error which says "the root element is missing."

I really have no idea what my problem is and why i cannot get a value
back. If anyone can offer some advice and/or code to help solve this
problem I would greatly appreciate it!

Thank you,

Kelly

Jul 14 '06 #2

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

Similar topics

1
5728
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 null'. When the extension attribute is not applied it runs fine. The wierd thing is that it does not appear to be an error within the SOAP extension because I break-pointed it and when the proxy function gets called the SOAP extension runs fine....
3
7377
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 occured: Client found response content type of '', but expected 'text/xml'. Calling this web service from the browser (as recommended) produced little more explanation:
4
6031
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 extension. The code like this: public string HelloWorld() { return "Hello World.";
0
4369
by: Matt Wood | last post by:
Hi, I have written a Web Service for a customer which expects a SOAP message with Document/Literal encoding, and uses RoutingStyle=SoapServiceRoutingStyle.RequestElement to route the SOAP body message to my Web Method. The Web Method expects a string as its parameter and then feeds that string to an XML deserializer which maps the XML elements contained within the string to my custom objects, then performs an insert/update on an SQL...
0
1396
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 have a service (.asmx file) which contains the following: namespace OfficerCallIn { public class OfficerCallInService :
0
1335
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 contains the following: namespace OfficerCallIn {
2
4038
by: Frederik Vanderhaegen | last post by:
Hi, I'm writing a simple soap extension for a webservice I developed (without the use of an extension the webservice works perfect). The extension is registered through the web.config files of my webservice and my application. In my extension I override the Chainstream method and implement the abstract methods (GetInitializer, Initialize and ProcessMessage) my chainstream method:
1
1396
by: Datawright | last post by:
This might be a daft post but I am very new to the SOAP Extension class. Basically I have taken the MSDN example that writes the SOAP request and response to a log file in C#. The code works fine and writes the data to the log file. As such I tweaked the code to change the new stream to remove some unwanted items. This also works fine and the resulting log has the tweaked response. So far so good. However, the original stream is...
1
4838
by: klerik123456 | last post by:
I try set soap extension attributes on client side. For example: Implementation in web service: public class EncryptMessageAttribute : SoapExtensionAttribute { private string strKey="null";
0
9685
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9536
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10468
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10205
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7559
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6802
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4131
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
2
3748
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2933
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.