Click here to Skip to main content
15,896,201 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I'm a new web service user.

I have a question: I would like to take out (to extract) a soap message received by web service I published on the web, and save it in a txt file.

Please find below my web service published:

VB
'------------------------------------------------------------------------------
' <auto-generated>
' Il codice è stato generato da uno strumento.
' Versione runtime:2.0.50727.3603
'
' Le modifiche apportate a questo file possono provocare un comportamento 
' non corretto e andranno perse se
' il codice viene rigenerato.
' </auto-generated>
'------------------------------------------------------------------------------

Option Strict Off
Option Explicit On

Imports System
Imports System.ComponentModel
Imports System.Diagnostics
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Xml.Serialization

'
'Codice sorgente generato automaticamente da wsdl, versione=2.0.50727.3038.
'

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.Web.Services.WebServiceAttribute([Namespace]:="http://xxx.xx.xx/xx/xx/xx"), _
System.Web.Services.WebServiceBindingAttribute(Name:="InviaEsitoBinding", 
    [Namespace]:="http://xx.xx.it/xx/xx/xx"), _
System.Xml.Serialization.XmlIncludeAttribute(GetType(MessaggioNA))> _
Partial Public MustInherit Class InviaEsitoService
Inherits System.Web.Services.WebService

'''<remarks/>
<System.Web.Services.WebMethodAttribute(), _
System.Web.Services.Protocols.SoapDocumentMethodAttribute("inviaEsito", OneWay:=true,
   Use:=System.Web.Services.Description.SoapBindingUse.Literal, 
   ParameterStyle:=System.Web.Services.Protocols.SoapParameterStyle.Bare)> _
Public MustOverride Sub inviaEsito(<System.Xml.Serialization.XmlElementAttribute("inviaEsito", 
    [Namespace]:="http://xxx.xxx.it/xx/xx/xx")> ByVal inviaEsito1 As inviaEsito)
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, 
    [Namespace]:="http://regione.toscana.it/sis/rfc/na")> _
Partial Public Class inviaEsito

Private esitoField As Esito

'''<remarks/>
Public Property Esito() As Esito
Get
Return Me.esitoField
End Get
Set
Me.esitoField = value
End Set
End Property
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, 
    [Namespace]:="http://xxx.xx.it/xx/xx/xx")> _
Partial Public Class Esito
Inherits MessaggioNA

Private successoField As Boolean

Private erroriField() As Errore

Private avvisiField() As Avviso

'''<remarks/>
Public Property Successo() As Boolean
Get
Return Me.successoField
End Get
Set
Me.successoField = value
End Set
End Property

'''<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute(IsNullable:=false)> _
Public Property Errori() As Errore()
Get
Return Me.erroriField
End Get
Set
Me.erroriField = value
End Set
End Property

'''<remarks/>
<System.Xml.Serialization.XmlArrayItemAttribute(IsNullable:=false)> _
Public Property Avvisi() As Avviso()
Get
Return Me.avvisiField
End Get
Set
Me.avvisiField = value
End Set
End Property
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://xx.xx.it/xx/xx/xx")> _
Partial Public Class Errore

Private codiceField As ErroreCodice

Private descrizioneField As String

'''<remarks/>
Public Property Codice() As ErroreCodice
Get
Return Me.codiceField
End Get
Set
Me.codiceField = value
End Set
End Property

'''<remarks/>
Public Property Descrizione() As String
Get
Return Me.descrizioneField
End Get
Set
Me.descrizioneField = value
End Set
End Property
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, 
    [Namespace]:="http://xx.xx.it/xx/xx/xx")> _
Public Enum ErroreCodice

'''<remarks/>
SYN

'''<remarks/>
CNT

'''<remarks/>
ELB

'''<remarks/>
IDN
End Enum

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://xx.xx.it/xx/xx/xx")> _
Partial Public Class Avviso

Private codiceField As AvvisoCodice

Private descrizioneField As String

'''<remarks/>
Public Property Codice() As AvvisoCodice
Get
Return Me.codiceField
End Get
Set
Me.codiceField = value
End Set
End Property

'''<remarks/>
Public Property Descrizione() As String
Get
Return Me.descrizioneField
End Get
Set
Me.descrizioneField = value
End Set
End Property
End Class

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Xml.Serialization.XmlTypeAttribute(AnonymousType:=true, 
    [Namespace]:="http://xx.xx.it/xx/xx/xx")> _
Public Enum AvvisoCodice

'''<remarks/>
ANAG
End Enum

'''<remarks/>
<System.CodeDom.Compiler.GeneratedCodeAttribute("wsdl", "2.0.50727.3038"), _
System.SerializableAttribute(), _
System.Diagnostics.DebuggerStepThroughAttribute(), _
System.ComponentModel.DesignerCategoryAttribute("code"), _
System.Xml.Serialization.XmlTypeAttribute([Namespace]:="http://xx.xx.it/xx/xx/xx")> _
Partial Public MustInherit Class MessaggioNA

Private codiceInvianteField As String

Private dataInvioField As Date

Private codiceMessaggioField As String

'''<remarks/>
Public Property CodiceInviante() As String
Get
Return Me.codiceInvianteField
End Get
Set
Me.codiceInvianteField = value
End Set
End Property

'''<remarks/>
Public Property DataInvio() As Date
Get
Return Me.dataInvioField
End Get
Set
Me.dataInvioField = value
End Set
End Property

'''<remarks/>
Public Property CodiceMessaggio() As String
Get
Return Me.codiceMessaggioField
End Get
Set
Me.codiceMessaggioField = value
End Set
End Property
End Class
Public Class Form1
Sub test()
MsgBox("START: ")
End Sub

End Class
Posted
Updated 4-Dec-09 8:54am
v2

A neat way to do this while running an application is to use a tool like TCP monitor or fiddler. This will show you the entire soap message that was sent across the wire. You can save your SOAP message to a text file as desired.
 
Share this answer
 
You can parse any SOAP message for data by calling the SOAP interface.

Check this :

Extract Soap Body From Soap Message[^]
to extract body of the SOAP envelope.

But why do you need this. .NET has built in capability to create custom Types based on these SOAP envelope. :confused:
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900