Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > .NET Web Services
|
.NET Web Services Discussions about .NET XML Web Service technologies including ASMX files, WSDL and SOAP.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET Web Services section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 14th, 2006, 10:55 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Soap Extension and error being returned

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 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





Similar Threads
Thread Thread Starter Forum Replies Last Post
The remote server returned an error: (404) Not Fou princechalakkal XSLT 1 September 12th, 2006 11:45 AM
Front Page server extension error NWilson Assembly Language 1 January 17th, 2006 01:55 PM
activating a SOAP extension from a client Robert Rotstein ASP.NET 1.0 and 1.1 Professional 0 January 10th, 2006 11:18 AM
Returned Error chuck BOOK: Beginning VB.NET Databases 6 February 13th, 2005 04:07 PM
SP Returned Output with Error sidneyfuerte Classic ASP Professional 0 September 8th, 2003 02:11 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.