Exploring the SoapEnvelope Class in WSE2.0 - Body Property and SetBodyObject() method
(Page 5 of 5 )
A similar web service along the same lines as the above can be used to investigate and explore the Body property as well as the SetBodyObject() methods. Here the Body is a string, "Thing of beauty is a joy for ever." The SetBodyObject() method will set up the above "body" as the body of the envelope.
Public Function SetBdyObj() As String
Dim sen1 As New Microsoft.Web.Services2.SoapEnvelope
Dim strbdy As String
strbdy = "Thing of beauty is a joy for ever"
sen1.SetBodyObject(strbdy)
Try
Return sen1.Body.InnerXml
Catch ex As Exception
Return ex.Message
End Try
End Function
The web client would see the code shown in the next paragraph when he accesses this service and calls the SetBdyObj() function.
<string>
<string xmlns="http://tempuri.org/">Thing of beauty is a joy for
ever</string>
</string>
Summary
This article explored the SoapEnvelope class in WSE2.0 by interrogating some of its properties and methods. The namespace to which this class belongs has a large number of classes and each of them have a large number of properties and methods; that includes the inherited ones. In addition to Microsoft's WSE2.0 document, the following resources are also recommended:
Programming Microsoft .NET XML Web Services by D.Foggon et al, Published by Microsoft Press, ISBN 0-7356-1912-3, 2003
Understanding Web Services Specifications and the WSE by J.H.Gailey, Published by Microsoft Press, ISBN 0-7356-1913-1, 2004
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |