Component Calling Limitations


Components are valuable because they encapsulate code you can reuse without adding it to your current application. You can access components with a mobile device in a number of ways. The method that ensures maximum compatibility relies on a Web page. Simply add the component to the Web project as you would any component. Any device with an appropriate browser can use the component and you can control access to the data using the data hiding techniques, shown in Listing 13.2 and 13.3.

However, it’s not always possible to work with a component using a Web page, due to performance or data handling factors. In this case, you might have to turn to alternative methods that could incur a higher security risk. For example, you can employ the component as a Web service, as in the COM+ example in Chapter 8 (Listing 8.5). In this case, you might find yourself using a third party product such as PocketSoap (http://www.pocketsoap.com/) to gain access to the component. Listing 13.4 shows a typical example of how this product works. In this case, the mobile device accesses a component with a method named GetCompName().

Listing 13.4 Accessing Web Services Using SOAP

start example
<SCRIPT LANGUAGE="JScript"> function cmdGetSingleName_Click() {     var SOAPEnv;    // SOAP envelope     var Transport;  // SOAP transport     var Param;      // Parameter list     var SOAPParam;  // SOAP method call parameters.     var RecData;    // Received data holder     // Create the envelope.     SOAPEnv = new ActiveXObject("pocketSOAP.Envelope");     SOAPEnv.MethodName = "GetCompName";     SOAPEnv.URI = "https://tempuri.org/message/";     // Create a parameter to place within the envelope.     Param = SOAPEnv.CreateParameter("NameType",        window.document.SampleForm1.comboName.value, "");     // Send the request and receive the data.     Transport = new ActiveXObject("pocketSOAP.HTTPTransport");     Transport.SOAPAction =        "https://tempuri.org/action/NameValuesProc.GetCompName"     Transport.Send(        "https://WinServer/soapexamples/ComputerName/CompNameProc.WSDL",        SOAPEnv.Serialize());     RecData = Transport.Receive();     SOAPEnv.Parse(RecData);     // Display the result.     RecData = SOAPEnv.Parameters.Item(0);     window.document.SampleForm1.Results.value = RecData.Value; } </SCRIPT>
end example

This example uses a five-step process to access the component. First, the code creates an envelope. Second, the code places data within the envelope. Third, the code initializes the data. Fourth, the code sends and receives the data. Finally, the code displays the data on screen.

Aside from the fact that this is an interesting way to use a Web service from a Pocket PC, notice that the URLs all use the HTTPS protocol. This application uses SSL rather than the standard straight text data transfer, which makes it a lot more secure than using a simple Web page. This technique only works with the Pocket PC, but it’s an important technique to consider when the data provided by your component is too sensitive for other data transfer techniques and you must support some form of wireless device. Note that PocketSoap is one of the few products that will support SSL transfer for a Pocket PC.




.Net Development Security Solutions
.NET Development Security Solutions
ISBN: 0782142664
EAN: 2147483647
Year: 2003
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net