ARTICLE

SOAP and VB.NET Remoting: Part 2

Posted by Sapna Articles | Visual Basic Language September 16, 2010
In this article I will explain you about SOAP and VB.NET Remoting.
 
Reader Level:

HTML clipboard

See Part 1
When we use HTTP, we use the POST request method because with this method, as opposed to the GET method, the size of the HTTP headers is unlimited. We will see two types of headers in HTTP-request headers and response headers. Please refer to the document RFC2616 (Hypertext Transfer Protocol-HTTP 1.1 by R. Fielding et al.) for more details about HTTP implementation details. Listing 23.2 shows an example of an HTTP POST request header. You can add any headers you like to HTTP-for example, in Listing 23.2 SOAPAction is a SOAP-added HTTP header referring to the remote method, UpdateData, to be invoked and its Uniform Resource Locator (URL).

Listing 23.2: HTTP POST Request Header

          POST /Order HTTP/1.1
          Host: www.mindcracker.com
          Content-Type: text/xml
          Content-Length: nnnn
          SOAPAction: "http://www.mindcracker.com#UpdateData"

Information being sent would be located here.

Listing 23.3 shows a good response-type HTTP header.

Listing 23.3: Good HTTP Response Header

          200 OK
          Content-Type: text/plain
          Content-Length: nnnn
          Content goes here.

Listing 23.4 shows a bad HTTP response header.

Listing 23.4: Bad HTTP Response Header

          400 Bad Request
          Content-Type: text/plain
          Content-Length: 0

A SOAP request document without HTTP headers is shown in Listing 23.5.

Listing 23.5: SOAP Request Document Without HTTP Headers


<
SOAP-ENV:Envelope
xmlns:xsi
="http://www.w3.org/1999/XMLSchema/instance"
xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope"
xsi:schemaLocation
=
"http://www.mindcracker.com/schemas/Schema.xsd">

          <
SOAP-ENV:Header xsi:type="MindcrackerHeader">
                   <
COM:GUID xmlns:COM="http://comobject.northwindtraders.com">
                             10000000-0000-abcd-0000-000000000001

                   </
COM:GUID>
          </
SOAP-ENV:Header>
          <
SOAP-ENV:Body xsi:type="MindcrackerBody">
                   <
OrderUpdate>
                             <
orderID>0</orderID>
                             <
item>89</item>
                   </
OrderUpdate>
          </
SOAP-ENV:Body>
</
SOAP-ENV:Envelope>

Listing 23.6 shows a SOAP body schema-the contents of the file http://www.mindcracker.com/schemas/Schema.xsd.

Listing 23.6: Schema.xsd File Contents


<
xsd:schema xmlns:xsd="http://www.w3.org/1999/XMLSchema"
targetNamespace
="http://schemas.xmlsoap.org/soap/envelope"
xmlns:SOAP
="http://schemas.xmlsoap.org/soap/envelope">
          <
xsd:complexType name="MindcrackerHeader">
                   <
xsd:element name="GUID" type="string"/>
          </
xsd:complexType>
          <
xsd:complexType name="MindcrackerBody">
                   <
xsd:element name="OrderUpdate">
                             <
xsd:complexType>
                                      <
element name="orderID" type="integer"/>
                                      <
element name="item" type="double"/>
                             </
xsd:complexType>
                   </
xsd:element>
          </
xsd:complexType>
</
xsd:schema>

A successful SOAP response document is shown in Listing 23.7.

Listing 23.7: Successful SOAP Response Document


<
SOAP-ENV:Envelope
xmlns:xsi
="http://www.w3.org/1999/XMLSchema/instance"
xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope"
xsi:schemaLocation
=
"http://www.mindcracker.com/schemas/Schema.xsd">

          <
SOAP-ENV:Body xsi:type="MindcrackerBody">
                   <
OrderUpdate>
                             <
orderID>09999</orderID>
                             <
return>0</return>
                   </
OrderUpdate>
          </
SOAP-ENV:Body>
</
SOAP-ENV:Envelope>

Listing 23.8 shows a faulty SOAP response document. The transaction has failed for the reason noted in the error message.

Listing 23.8: Faulty SOAP Response Document


<
SOAP-ENV:Envelope
xmlns:xsi
="http://www.w3.org/1999/XMLSchema/instance"
xmlns:SOAP-ENV
="http://schemas.xmlsoap.org/soap/envelope"
xsi:schemaLocation
=
"http://www.mindcracker.com/schemas/Schema.xsd">

          <
SOAP-ENV:Fault>
                   <
SOAP-ENV:faultcode>200</SOAP-ENV:faultcode>
                   <
SOAP-ENV:faultstring>
                             Must Understand Error

                   </
SOAP-ENV:faultstring>
                   <
SOAP-ENV:detail xsi:type="Fault">
                             <
errorMessage>
                                      The object cannot be found or is not installed.

                             </
errorMessage>
                   </
SOAP-ENV:detail>
          </
SOAP-ENV:Fault >
          </
SOAP-ENV:Body>
</
SOAP-ENV:Envelope>

Following is an example of a VB.NET SOAP server/client with the UpdateData method declaration:

    Public Function OrderUpdateMethod(ByRef OrderID As Integer, ByVal Item As Double) As Integer

    End Function

Conclusion

Hope this article would have helped you in understanding SOAP and VB.NET Remoting.

Login to add your contents and source code to this article
share this article :
post comment
 
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor