13.07.2015 Views

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

Applied XML Programming for Microsoft .NET.pdf - Csbdu.in

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The SoapRpcMethod AttributeThe RPC <strong>for</strong>mat is expressed by the SoapRpcMethod attribute and specifies that allparameters are encapsulated with<strong>in</strong> a s<strong>in</strong>gle <strong>XML</strong> element named after the Web servicemethod, as shown <strong>in</strong> the follow<strong>in</strong>g code. The RPC style does not support the Literalb<strong>in</strong>d<strong>in</strong>g mode; only the SOAP-encoded b<strong>in</strong>d<strong>in</strong>g mode (Encoded) is accepted.POST /salesreport/SalesReportService.asmx HTTP/1.1Host: expo-starContent-Type: text/xml; charset=utf-8Content-Length: lengthSOAPAction: "xmlnet/cs/0735618011/GetSalesReportBarChart"<strong>in</strong>tYou must <strong>in</strong>clude the System.Web.Services.Protocols andSystem.Web.Services.Description namespaces <strong>in</strong> the Web service source to useSOAP <strong>for</strong>matt<strong>in</strong>g attributes.NoteWeb service methods <strong>in</strong> which the OneWay property of either theSoapRpcMethod attribute or the SoapDocumentMethod attribute isset to true do not have access to ASP.<strong>NET</strong> objects packed <strong>in</strong> theHttpContext object. References to these objects are still allowed,but null is always returned.The Sales Report Web ServiceTo see a concrete example of a Web service, let's trans<strong>for</strong>m the remote service created<strong>in</strong> Chapter 12 <strong>in</strong>to a Web service. The Web service class makes externally available agroup of functions nearly identical to that of the .<strong>NET</strong> Remot<strong>in</strong>g component. In do<strong>in</strong>g so,it also uses the same <strong>in</strong>ternal class, thus demonstrat<strong>in</strong>g a true reuse of code.464

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!