Get Raw XML from SoapServer.SoapInvoke Request, Response, ""

R

RobertHillEDS

While using the Soap generated ASP code, I would like to dump the raw
contents of the request and response objects using Response.AppendToLog.

I have tried using variations of the following code, but I may be barking up
the wrong tree with this approach. Any expert help would greatly be
appreciated.

Dim objReader
Set objReader = CreateObject("MSSOAP.SoapReader")
objReader.Load Request
add code to output to the log
objReader.Load Response
add code to output to the log


===SOAP GENERATED CODE===

<%@ LANGUAGE=VBScript %>
<%
Option Explicit
On Error Resume Next
Response.ContentType = "text/xml"
Dim SoapServer
If Not Application("CUCTransactionInitialized") Then
Application.Lock
If Not Application("CUCTransactionInitialized") Then
Dim WSDLFilePath
Dim WSMLFilePath
WSDLFilePath = Server.MapPath("CUCTransaction.wsdl")
WSMLFilePath = Server.MapPath("CUCTransaction.wsml")
Set SoapServer = Server.CreateObject("MSSOAP.SoapServer")
If Err Then SendFault "Cannot create SoapServer object. " &
Err.Description
SoapServer.Init WSDLFilePath, WSMLFilePath
If Err Then SendFault "SoapServer.Init failed. " & Err.Description
Set Application("CUCTransactionServer") = SoapServer
Application("CUCTransactionInitialized") = True
End If
Application.UnLock
End If
Set SoapServer = Application("CUCTransactionServer")
SoapServer.SoapInvoke Request, Response, ""
If Err Then SendFault "SoapServer.SoapInvoke failed. " & Err.Description
 
S

Steven Cheng[MSFT]

Hi Robert,

Welcome to MSDN newsgroup.
From your description, you're currently using the SoapServer component in
SoapToolKit to serve as XML webservice server in ASP application. And
you're wondering how to intercept the RAW soap XML message returned through
the SoapServer.Invoke method, yes?

As for the SoapServer.Invoke method, it accept an InputStream and an
OutputStream which implement IStream interface. The internally runtime will
retrieve SOAP request xml message from the input stream and then generate
output SOAP response message and write out into the OutputStream. If we
directl,y pass the ASP 's Request, response stream object into it, the
output respose SOAP message will be flushed directly into the
response/clientside, we haven't the chance to intercept the content. So if
you want to intercept the response content, we should not directly pass the
Response ASP object as the outpu Stream parameter. Instread , we need to
prepare another Stream object(implement IStream) and pass it in
SoapServer.Invoke and then we can retrieve the XML content in that Stream
object. After our cutomization, we write the content from our stream object
into the Response's Stream. For the custom stream object, you can have a
look at the ADODB.Stream component, also, we can also create our own COM
components which implement the IStream interface.

Thanks,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)




--------------------
| Thread-Topic: Get Raw XML from SoapServer.SoapInvoke Request, Response, ""
| thread-index: AcW9Ir1iglNLgLxbSFOl10o+wJtwLg==
| X-WBNR-Posting-Host: 192.85.50.1
| From: "=?Utf-8?B?Um9iZXJ0SGlsbEVEUw==?=" <[email protected]>
| Subject: Get Raw XML from SoapServer.SoapInvoke Request, Response, ""
| Date: Mon, 19 Sep 2005 07:02:15 -0700
| Lines: 46
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 7bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.inetserver.asp.general
| NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.inetserver.asp.general:26407
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
|
| While using the Soap generated ASP code, I would like to dump the raw
| contents of the request and response objects using Response.AppendToLog.
|
| I have tried using variations of the following code, but I may be barking
up
| the wrong tree with this approach. Any expert help would greatly be
| appreciated.
|
| Dim objReader
| Set objReader = CreateObject("MSSOAP.SoapReader")
| objReader.Load Request
| add code to output to the log
| objReader.Load Response
| add code to output to the log
|
|
| ===SOAP GENERATED CODE===
|
| <%@ LANGUAGE=VBScript %>
| <%
| Option Explicit
| On Error Resume Next
| Response.ContentType = "text/xml"
| Dim SoapServer
| If Not Application("CUCTransactionInitialized") Then
| Application.Lock
| If Not Application("CUCTransactionInitialized") Then
| Dim WSDLFilePath
| Dim WSMLFilePath
| WSDLFilePath = Server.MapPath("CUCTransaction.wsdl")
| WSMLFilePath = Server.MapPath("CUCTransaction.wsml")
| Set SoapServer = Server.CreateObject("MSSOAP.SoapServer")
| If Err Then SendFault "Cannot create SoapServer object. " &
| Err.Description
| SoapServer.Init WSDLFilePath, WSMLFilePath
| If Err Then SendFault "SoapServer.Init failed. " & Err.Description
| Set Application("CUCTransactionServer") = SoapServer
| Application("CUCTransactionInitialized") = True
| End If
| Application.UnLock
| End If
| Set SoapServer = Application("CUCTransactionServer")
| SoapServer.SoapInvoke Request, Response, ""
| If Err Then SendFault "SoapServer.SoapInvoke failed. " & Err.Description
|
| --
| Robert Hill
|
 
S

Steven Cheng[MSFT]

Hi Robert,

Have you got any further progress on this issue or does the suggestion in
my last reply helps a little? If there're any further things we can help,
please feel free to post here.

Thanks & Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)



--------------------
| X-Tomcat-ID: 58676845
| References: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain
| Content-Transfer-Encoding: 7bit
| From: (e-mail address removed) (Steven Cheng[MSFT])
| Organization: Microsoft
| Date: Tue, 20 Sep 2005 03:38:56 GMT
| Subject: RE: Get Raw XML from SoapServer.SoapInvoke Request, Response, ""
| X-Tomcat-NG: microsoft.public.inetserver.asp.general
| Message-ID: <ri#[email protected]>
| Newsgroups: microsoft.public.inetserver.asp.general
| Lines: 107
| Path: TK2MSFTNGXA01.phx.gbl
| Xref: TK2MSFTNGXA01.phx.gbl microsoft.public.inetserver.asp.general:26430
| NNTP-Posting-Host: TOMCATIMPORT1 10.201.218.122
|
| Hi Robert,
|
| Welcome to MSDN newsgroup.
| From your description, you're currently using the SoapServer component
in
| SoapToolKit to serve as XML webservice server in ASP application. And
| you're wondering how to intercept the RAW soap XML message returned
through
| the SoapServer.Invoke method, yes?
|
| As for the SoapServer.Invoke method, it accept an InputStream and an
| OutputStream which implement IStream interface. The internally runtime
will
| retrieve SOAP request xml message from the input stream and then generate
| output SOAP response message and write out into the OutputStream. If we
| directl,y pass the ASP 's Request, response stream object into it, the
| output respose SOAP message will be flushed directly into the
| response/clientside, we haven't the chance to intercept the content. So
if
| you want to intercept the response content, we should not directly pass
the
| Response ASP object as the outpu Stream parameter. Instread , we need to
| prepare another Stream object(implement IStream) and pass it in
| SoapServer.Invoke and then we can retrieve the XML content in that Stream
| object. After our cutomization, we write the content from our stream
object
| into the Response's Stream. For the custom stream object, you can have a
| look at the ADODB.Stream component, also, we can also create our own COM
| components which implement the IStream interface.
|
| Thanks,
|
| Steven Cheng
| Microsoft Online Support
|
| Get Secure! www.microsoft.com/security
| (This posting is provided "AS IS", with no warranties, and confers no
| rights.)
|
|
|
|
| --------------------
| | Thread-Topic: Get Raw XML from SoapServer.SoapInvoke Request, Response,
""
| | thread-index: AcW9Ir1iglNLgLxbSFOl10o+wJtwLg==
| | X-WBNR-Posting-Host: 192.85.50.1
| | From: "=?Utf-8?B?Um9iZXJ0SGlsbEVEUw==?=" <[email protected]>
| | Subject: Get Raw XML from SoapServer.SoapInvoke Request, Response, ""
| | Date: Mon, 19 Sep 2005 07:02:15 -0700
| | Lines: 46
| | Message-ID: <[email protected]>
| | MIME-Version: 1.0
| | Content-Type: text/plain;
| | charset="Utf-8"
| | Content-Transfer-Encoding: 7bit
| | X-Newsreader: Microsoft CDO for Windows 2000
| | Content-Class: urn:content-classes:message
| | Importance: normal
| | Priority: normal
| | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| | Newsgroups: microsoft.public.inetserver.asp.general
| | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
| | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
| | Xref: TK2MSFTNGXA01.phx.gbl
microsoft.public.inetserver.asp.general:26407
| | X-Tomcat-NG: microsoft.public.inetserver.asp.general
| |
| | While using the Soap generated ASP code, I would like to dump the raw
| | contents of the request and response objects using Response.AppendToLog.
| |
| | I have tried using variations of the following code, but I may be
barking
| up
| | the wrong tree with this approach. Any expert help would greatly be
| | appreciated.
| |
| | Dim objReader
| | Set objReader = CreateObject("MSSOAP.SoapReader")
| | objReader.Load Request
| | add code to output to the log
| | objReader.Load Response
| | add code to output to the log
| |
| |
| | ===SOAP GENERATED CODE===
| |
| | <%@ LANGUAGE=VBScript %>
| | <%
| | Option Explicit
| | On Error Resume Next
| | Response.ContentType = "text/xml"
| | Dim SoapServer
| | If Not Application("CUCTransactionInitialized") Then
| | Application.Lock
| | If Not Application("CUCTransactionInitialized") Then
| | Dim WSDLFilePath
| | Dim WSMLFilePath
| | WSDLFilePath = Server.MapPath("CUCTransaction.wsdl")
| | WSMLFilePath = Server.MapPath("CUCTransaction.wsml")
| | Set SoapServer = Server.CreateObject("MSSOAP.SoapServer")
| | If Err Then SendFault "Cannot create SoapServer object. " &
| | Err.Description
| | SoapServer.Init WSDLFilePath, WSMLFilePath
| | If Err Then SendFault "SoapServer.Init failed. " & Err.Description
| | Set Application("CUCTransactionServer") = SoapServer
| | Application("CUCTransactionInitialized") = True
| | End If
| | Application.UnLock
| | End If
| | Set SoapServer = Application("CUCTransactionServer")
| | SoapServer.SoapInvoke Request, Response, ""
| | If Err Then SendFault "SoapServer.SoapInvoke failed. " & Err.Description
| |
| | --
| | Robert Hill
| |
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top