Displaying soap message

  • Thread starter Barbara Alderton
  • Start date
B

Barbara Alderton

I have a .NET web service that takes in a dataset based on defined schema and
outputs the same type, which utilizes a SOAP header. I have a testharness
which I use to call the web service, which conducts different actions
depending on an action field set in the header. I set the header fields and
attach the header to the proxy object and then call the web service. I am
able to display the incoming and outgoing datasets as xml for testing.
However, what I really want to do is display the complete SOAP message.

For example:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
---->
<soapenv:Header>
----
</soapenv:Header>
<soapenv:Body>
----
</soapenv:Body>
</soapenv:Envelope>

Current sample code:

Dim objtest As ProxyClass = New ProxyClass
Dim TestHeader As SSSoapHeader = New SSSoapHeader
Dim dsMessageOut As New DataSetSchema
Dim dsMessageIn As New DataSetSchema
Dim strMessageType As String

Select Case strMessageType
Case Type1
TestHeader.Action = strMessageType
TestHeader.TransDatetime = Now

Dim fs As New
FileStream(HttpContext.Current.Server.MapPath("TestDataIn.xml"), _
FileMode.Open, FileAccess.Read)
Dim xmlStream As New StreamReader(fs)
dsMessageOut.ReadXml(xmlStream)

' Add the TestHeader SOAP header to the SOAP request.
objtest.SSSoapHeaderValue = TestHeader

' Call Web Service
dsMessageIn = objtest.ProcessMessage(dsMessageOut)

TestHeader = objtest.SSSoapHeaderValue

' Display header values
lblAction.Text = TestHeader.Action
lblTransDt.Text = TestHeader.TransDatetime

txtXML.Text = dsMessageOut.GetXml + dsMessageIn.GetXml
End Select

How can I retrieve the SOAP message and display to a multi-line textbox, as
I am the in/out datasets?
 
S

Steven Cheng[MSFT]

Hi Barbara,

Thank you for posting.

Regarding on the capture and displaying SOAP message of the webservice
application call, do you means you want to Trace the webservice method call
and its underlying SOAP message for debugging/testing? If so, I think you
can consider the following options:

1. You can use some trace tools to capture SOAP message (over the
underlying tansport protocol), e.g: the tcpTrace(proxyTrace) or the trace
Utility in SOAP toolkit 3.0.

http://www.microsoft.com/downloads/details.aspx?FamilyId=C943C0DD-CEEC-4088-
9753-86F052EC8450&displaylang=en

2. Also, ASP.NET webservice also allow us to write custom soapExtension to
intercept underlying soap message:

#SoapExtension Class
http://msdn2.microsoft.com/en-us/library/system.web.services.protocols.soape
xtension.aspx

#extend the ASP.NET WebMethod Framework by Adding XML Schema Validation
http://msdn.microsoft.com/msdnmag/issues/03/07/xmlschemavalidation/default.a
spx

So we can also write a custom Trace extension to capture the underling raw
SOAP message.

Hope this helps.

Regards,

Steven Cheng
Microsoft Online Community Support


==================================================

When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.

==================================================


This posting is provided "AS IS" with no warranties, and confers no rights.



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

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,982
Messages
2,570,185
Members
46,738
Latest member
JinaMacvit

Latest Threads

Top