473,396 Members | 2,151 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.

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("ProcessMessage", 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 1868
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 BeforeDeserialize 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("ProcessMessage", 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(ByVal 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(fromStream)
Dim writer As New StreamWriter(toStream)
writer.WriteLine(reader.ReadToEnd())
writer.Flush()
End Sub

If I have the following code in the soap extension:

Public Overrides Sub ProcessMessage(ByVal message As
System.Web.Services.Protocols.SoapMessage)
Select Case message.Stage
Case SoapMessageStage.BeforeDeserialize
Copy(MessageStream, InternalStream)
InternalStream.Position = 0

I get Nothing returned.

If I have the following code:

Public Overrides Sub ProcessMessage(ByVal message As
System.Web.Services.Protocols.SoapMessage)
Select Case message.Stage
Case SoapMessageStage.BeforeDeserialize
' 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
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: 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...
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...
2
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...
1
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...
1
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...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.