User manual MATLAB MATLAB APPLICATION DEPLOYMENT WEB EXAMPLE GUIDE

DON'T FORGET : ALWAYS READ THE USER GUIDE BEFORE BUYING !!!

If this document matches the user guide, instructions manual or user manual, feature sets, schematics you are looking for, download it now. Diplodocs provides you a fast and easy access to the user manual MATLAB MATLAB APPLICATION DEPLOYMENT. We hope that this MATLAB MATLAB APPLICATION DEPLOYMENT user guide will be useful to you.


MATLAB MATLAB APPLICATION DEPLOYMENT WEB EXAMPLE GUIDE: Download the complete user guide (1169 Ko)

Manual abstract: user guide MATLAB MATLAB APPLICATION DEPLOYMENTWEB EXAMPLE GUIDE

Detailed instructions for use are in the User's Guide.

[. . . ] MATLAB® Application Deployment Web Example Guide How to Contact The MathWorks Web Newsgroup www. mathworks. com/contact_TS. html Technical Support www. mathworks. com comp. soft-sys. matlab suggest@mathworks. com bugs@mathworks. com doc@mathworks. com service@mathworks. com info@mathworks. com Product enhancement suggestions Bug reports Documentation error reports Order status, license renewals, passcodes Sales, pricing, and general information 508-647-7000 (Phone) 508-647-7001 (Fax) The MathWorks, Inc. 3 Apple Hill Drive Natick, MA 01760-2098 For contact information about worldwide offices, see the MathWorks Web site. MATLAB® Application Deployment Web Example Guide © COPYRIGHT 2008­2010 by The MathWorks, Inc. The software described in this document is furnished under a license agreement. The software may be used or copied only under the terms of the license agreement. [. . . ] Although these primitives can be wrapped in a number of complex object structures, the examples in this section will cover fundamental use cases that should be the same, regardless of data structure and business objects. 4-31 4 Business Service Developer Tasks In this section, you will learn how to create basic Java objects that handle business logic, while Apache Axis2 performs the mechanics involved with turning the logic a Web service and exposing it. Alternatively, you can start by using WSDL (Web Service Definition Language -- the definition of your service) and generate Java from that. Afterward you can customize the Java with your business logic, or change the WSDL manually in a number of other ways to meet your needs. Setting Up the Root Web Service Class Since Axis2 supports POJOs (Plain Old Java Objects) you will create a shell class to contain all the service methods: package examples; public class ExamplesWebService { //*************************** //**Place service methods here //**For our examples we will only //**be taking in and returning //**primitive values //*************************** } Interacting with the DAO Some examples of how to use the DAO with various data types follow: Numeric public int getInt() { Examples examples = new Examples(); int integer = examples. getIntFromMWNumericArray(); examples. dispose(); return integer; } 4-32 Hosting a DAO on a Web Server String public String getString() { Examples examples = new Examples(); String string = examples. getStringFromMWCharArray(); examples. dispose(); return string; } Numeric Array public int[] getIntArray() { Examples examples = new Examples(); int[] intArray = examples. getIntArrayFromMWNumericArray(); examples. dispose(); return intArray; } Character Array public char[] getCharArray() { Examples examples = new Examples(); char[] charArray = examples. getCharArrayFromMWCharArray(); examples. dispose(); return charArray; } Byte Array public byte[] getByteArray() { Examples examples = new Examples(); byte[] byteArray = examples. getByteArrayFromMWNumeric(); examples. dispose(); return byteArray; } 4-33 4 Business Service Developer Tasks Raw Image Bytes Raw Image Bytes public byte[] getImageByteArray() { Examples examples = new Examples(); byte[] rawImageBytes = examples. getImageByteArrayFromMWNumericArray(); examples. dispose(); return rawImageBytes; } Raw Image Bytes with Reorientation public byte[] reorientAndGetImageByteArray( int height, int width, int elevation, int rotation, String imageFormat) { Examples examples = new Examples(); byte[] rawImageBytes = examples. getImageByteArrayFromMWNumericArrayWithOrientation( height, width, elevation, rotation, imageFormat); examples. dispose(); return rawImageBytes; } Deploying the Web Service 1 Create a staging folder, if one does not exist, and copy the Examples DAO class created in "Creating a DAO for Deployment" on page 4-6 and the Web service class created in "Setting Up the Root Web Service Class" on page 4-32into it. 4-34 Hosting a DAO on a Web Server 2 Create a lib folder and copy your deployed component into it. 3 Create a meta-inf folder and, inside it, create a services. xml file with these contents: <service> <parameter name="ServiceClass" locked="false">examples. ExamplesWebService</parameter> <operation name="getInt"> <messageReceiver class="org. apache. axis2. rpc. receivers. RPCMessageReceiver"/> </operation> <operation name="getString"> <messageReceiver class="org. apache. axis2. rpc. receivers. RPCMessageReceiver"/> </operation> <operation name="getIntArray"> <messageReceiver class="org. apache. axis2. rpc. receivers. RPCMessageReceiver"/> </operation> <operation name="getCharArray"> <messageReceiver class="org. apache. axis2. rpc. receivers. RPCMessageReceiver"/> </operation> <operation name="getByteArray"> <messageReceiver class="org. apache. axis2. rpc. receivers. RPCMessageReceiver"/> </operation> <operation name="getImageByteArray"> <messageReceiver class="org. apache. axis2. rpc. receivers. RPCMessageReceiver"/> </operation> </service> The services. xml file tells Axis2 which methods to expose, and what mechanism to use to expose them. 4 Copy all of the files into a WAR (Web archive) file and place them in the axis2 component folder (axis2/WEB-INF/services). Use the java -jar 4-35 4 Business Service Developer Tasks command but give the output file an . aar extension rather than a . jar extension. 5 You should now see your service running in the Axis console. You will use this URL in other applications to communicate with your Web service. Hosting a . NET DAO with ASPX Initializing the DAO Before a DAO can be used, it must be initialized. The basic template to initialize a . NET DAO looks like this: using using using using using using using using using System; System. Data; System. Configuration; System. Web; System. Web. Security; System. Web. UI; System. Web. UI. WebControls; System. Web. UI. WebControls. WebParts; System. Web. UI. HtmlControls; public partial class _Default : System. Web. UI. Page { protected void Page_Load(object sender, EventArgs e) { Examples. Examples examples = new Examples. Examples(); //*************************************** //**This is where the examples would be pasted in //*************************************** //for Examples: int integer = examples. getIntFromMWNumericArray(); Response. Write("int: " + integer); examples. dispose(); } } 4-36 Hosting a DAO on a Web Server Interacting with the DAO Some examples of how to use the DAO with various data types follow: Numeric int integer = examples. getIntFromMWNumericArray(); Response. Write("int: " + integer); String String stringResult = examples. getStringFromMWCharArray(); Response. Write("String: " + stringResult); Double Array double[] doubleArray = examples. getDoubleArrayFromMWNumericArray(); Response. Write("Double Array: "); for (int i = 0; i < doubleArray. Length; i++) { Response. Write("Array index(" + i + "): " + doubleArray[i]); } Character Array char[] charArray = examples. getCharArrayFromMWCharArray(); Response. Write("Char Array: "); for (int i = 0; i < charArray. Length; i++) { Response. Write("Array index("+ i +"): " + charArray[i]); } Cell Array to Array Object[] array = examples. getArrayFromCellArray(); for (int i = 0; i < array. Length; i++) { Response. Write("Array index("+ i+"): " + array[i]); 4-37 4 Business Service Developer Tasks } Cell Array to List List<Object> list = examples. getListFromCellArray(); foreach (Object currentObj in list) { Response. Write("List Item: " + currentObj); } Structure Dictionary<Object, Object> dictionary = examples. getDictionaryFromStruct(); Response. Write("Structure Array: "); foreach (Object currentKey in dictionary. Keys) { Response. Write("Key: " + currentKey + " Value: " + dictionary[currentKey]); } Byte Array byte[] byteArray = examples. getByteArrayFromMWNumericArray(); Response. Write("Byte Array: "); for (int i = 0; i < byteArray. Length; i++) { Response. Write(byteArray[i]); } Response. BinaryWrite(byteArray); Raw Image Bytes byte[] rawImageBytes = examples. getImageByteArrayFromMWNumericArray(); Response. BinaryWrite(rawImageBytes); 4-38 Hosting a DAO on a Web Server Raw Image Bytes with Reorientation Note This example allows you to perform similar functionality to what WebFigures performs, but in a manual implementation. It is one of many ways you can implement this functionality in a stateless manner. int height = Convert. ToInt32(Request. Params. Get("height")); int width = Convert. ToInt32(Request. Params. Get("width")); int elevation = Convert. ToInt32(Request. Params. Get("elevation")); int rotation = Convert. ToInt32(Request. Params. Get("rotation")); String imageFormat = Request. Params. Get("imageFormat"); byte[] rawImageBytes = examples. getImageByteArrayFromMWNumericArrayWithOrientation( height, width, elevation, rotation, imageFormat); Response. BinaryWrite(rawImageBytes); WebFigure // In this example, we use a WebFigure Utility to get an HTML // String that // will display this figure, Notice // how we reference the name we used when attaching it to the // cache and we indicate // that the Attach type is session. String localEmbedString = WebFigureServiceUtility. GetHTMLEmbedString( "SessionStateWebFigure", WebFigureAttachType. session, 300, 300); Response. Write(localEmbedString); 4-39 4 Business Service Developer Tasks Deploying the ASPX You deploy an ASPX using the Publish functionality in Microsoft® Visual Studio. Visual Studio puts all of your code, along with any code your project depends upon, in a folder. Hosting a DAO Using a . NET Web Service Setting Up the Root Web Service Class When creating Web services within . NET, simply create a new Web site (or use an existing site), and add an item of type Web Service to it. This will generate the root class in which you place your methods. Interacting with the DAO Each of these methods would be placed in the Web service class as methods. Numeric [WebMethod] public int getInt() { Examples. Examples examples = new Examples. Examples(); int integer = examples. getIntFromMWNumericArray(); examples. dispose(); return integer; } String [WebMethod] public String getString() { Examples. Examples examples = new Examples. Examples(); String stringResult = examples. getStringFromMWCharArray(); examples. dispose(); return stringResult; } 4-40 Hosting a DAO on a Web Server Double Array [WebMethod] public double[] getDoubleArray() { Examples. Examples examples = new Examples. Examples(); double[] doubleArray = examples. getDoubleArrayFromMWNumericArray(); examples. dispose(); return doubleArray; } Double Matrix Since . NET Web services can't support multidimensional arrays, convert what is returned from MATLAB Builder NE into a jagged array, as follows: [WebMethod] public double[][] getDoubleMatrix(int argMagic) { Examples. ExamplesImpl examples = new Examples. ExamplesImpl(); double[, ] doubleMatrix = examples. getDoubleMatrixFromMWNumericArray(argMagic); int arraySize = (int)doubleMatrix. GetUpperBound(0) + 1; double[][] outputMatrix = new double[arraySize][]; int upperOuter = i < (int)doubleMatrix. GetUpperBound(0) + 1; for (int i = 0; upperOuter ; i++) { double[] subArray = new double[arraySize]; int upperInner = (int)doubleMatrix. GetUpperBound(1) + 1; for(int j = 0; j < upperInner; j++) { subArray[j] = doubleMatrix[i, j]; } outputMatrix[i] = subArray; 4-41 4 Business Service Developer Tasks } examples. dispose(); return outputMatrix; } Character Array [WebMethod] public char[] getCharArray() { Examples. Examples examples = new Examples. Examples(); char[] charArray = examples. getCharArrayFromMWCharArray(); examples. dispose(); return charArray; } Byte Array [WebMethod] public byte[] getByteArray() { Examples. Examples examples = new Examples. Examples(); byte[] byteArray = examples. getByteArrayFromMWNumericArray(); examples. dispose(); return byteArray; } Raw Image Bytes [WebMethod] public byte[] getImageByteArray() { Examples. Examples examples = new Examples. Examples(); byte[] rawImageBytes = examples. getImageByteArrayFromMWNumericArray(); examples. dispose(); return rawImageBytes; } 4-42 Hosting a DAO on a Web Server Raw Image Bytes with Reorientation [WebMethod] public byte[] getImageByteArrayWithOrientation( int height, int width, int elevation, int rotation, String imageFormat) { Examples. Examples examples = new Examples. Examples(); byte[] rawImageBytes = examples. getImageByteArrayFromMWNumericArrayWithOrientation( height, width, elevation, rotation, imageFormat); examples. dispose(); return rawImageBytes; } Deploying the Web Service Visual Studio 2005 does all of the work involved with generating Web service artifacts. Once you've created the above methods, just run the service and you'll see a tester page that shows you the location of the WSDL, and then allows you to test each method. 4-43 4 Business Service Developer Tasks 4-44 5 Front-End Developer Tasks · "Working with the Front-End Layer" on page 5-2 · "Creating a WebFigure on a JSP Page" on page 5-6 · "Creating a WebFigure on an ASPX Page" on page 5-10 · "Working with Static Images" on page 5-13 · "Displaying Complex Data Types Including Arrays and Matrices" on page 5-18 · "Using Web Services" on page 5-26 5 Front-End Developer Tasks Working with the Front-End Layer In this section. . . "About the Front-End Layer" on page 5-2 "About the Examples" on page 5-4 Service consumer responsible for presentation and usability Front-End Developer No MATLAB experience Creates front end applications About the Front-End Layer Note For comprehensive end-to-end implementations of the concepts in this chapter, see Appendix A, "Sources for More Information". In well-designed multi-tier application architectures, the front-end layer presents data to the end user and validates the user's input. This is accomplished by accessing data acquired at lower-level architectural tiers to the user and taking in user inputs, validating them, and then sending them to the lower-level tiers for processing. The data within this layer reside on servers that are almost always outside of the corporate firewall and therefore, accessible by everyone. Consequently, security and stability are integral to the front-end layer, and it is important to isolate implementation details outside of this layer so people cannot determine how your site is architected. A well-designed front-end layer has data access, translation and validation, and presentation functions separated into individual logical code sections. This increases an application or Web site's maintainability since you can change where the data originates or the format that it arrives in without changing user-visible code. A typical front-end layer contains the following sublayers. 5-2 Working with the Front-End Layer Elements of the Front End Layer · Data Access -- This sublayer pulls data in from middle-tier services like databases, where access into a deployed application would typically take place. Among the technologies used to transmit data at this sublayer are: - Remoting interfaces SOAP services 5-3 5 Front-End Developer Tasks - XML over HTTP protocol · Translation/Validation -- Data is passed from the data access sublayer to the translation sublayer and translated into objects used for data presentation. [. . . ] To download the example, go to "Quick Start: Building Your Example Component" on page 8-5. Quick Start: Building Your Example Component 1 Download the application code for this example from MATLAB Centrals File Exchange at http://www. mathworks. com/matlabcentral/fileexchange. Once you open the file exchange, search for "Java Web Example Guide End To End Chapter. " 8-5 8 End-to-End Developer Tasks 2 Extract the JavaEndToEnd. zip file into a working folder where you can build the application. 3 Start Tomcat by changing your folder to tomcat\bin and executing startup. bat. 4 Copy javabuilder. jar to the tomcat/common/libs folder. 5 Once Tomcat starts successfully, drag the JavaEndToEnd. war file into the webapps folder under the tomcat folder. 6 Execute the application by opening a Web browser and pointing to http://localhost:8080/JavaEndToEnd/MagicSquare/ExamplesPage. jsp. Advanced: Building Your Example Component Manually 1 Ensure you have a version of the Java Developer's Kit (JDK) installed that matches the version used by the MCR. See the MATLAB Compiler User's Guide reference pages for details on the mcrversion command. 2 Ensure you have Tomcat 5 or later on your system (other J2EE Web servers can work also, but the steps in this document have been tested with Tomcat). 3 Ensure the version of the MCR you have installed is the same version as the MCR running with MATLAB when the application was built. [. . . ]

DISCLAIMER TO DOWNLOAD THE USER GUIDE MATLAB MATLAB APPLICATION DEPLOYMENT




Click on "Download the user Manual" at the end of this Contract if you accept its terms, the downloading of the manual MATLAB MATLAB APPLICATION DEPLOYMENT will begin.

 

Copyright © 2015 - manualRetreiver - All Rights Reserved.
Designated trademarks and brands are the property of their respective owners.