Thursday, April 28, 2016

Android Device Registration on WSO2 Enterprise Mobility Manager


EMM Configs:

Before we proceed we need to make the following config changes

Change the LBHostPortPrefix and ServerUrl values from localhost to server IP at
<EMM_HOME>\repository\conf\cdm-config.xml


Change the host value under generalConfig from localhost to server IP at
<EMM_HOME>\repository\deployment\server\jaggeryapps\emm\config\config.json


Add SMTP configurations:

Add the following code to the axis2.xml which is located at <EMM_HOME>/server/repository/conf/axis2
[1/8/16, 2:06 PM] Milan Perera (milan@wso2.com):<transportSender name="mailto"
                     class="org.apache.axis2.transport.mail.MailTransportSender">
        <parameter name="mail.smtp.from">abc@gmail.com</parameter>
        <parameter name="mail.smtp.user">abcr@gmail.com</parameter>
        <parameter name="mail.smtp.password">abc123</parameter>
        <parameter name="mail.smtp.host">smtp.gmail.com</parameter>

        <parameter name="mail.smtp.port">587</parameter>
        <parameter name="mail.smtp.starttls.enable">true</parameter>
        <parameter name="mail.smtp.auth">true</parameter>
    </transportSender>


Create User

Go to https://<server_ip>:9443/emm














log in to the console (default admin/admin).
Click on Add under USERS
Fill in the information. The last field asks you to enter a user role. If you have a user role you can directly define it here. Creating a role will be discussed in the next section below.















Once you submit an email will be sent to the specified address with the EMM Agent download URL. And also a screen will appear with a QR code that embeds the download URL as well.
















Once this is done you can download the EMM Agent to your mobile device using the URL.

To register agent, follow steps given in [1] below:

[1] https://docs.wso2.com/display/EMM200/End-user+Registering+an+Android+Device


Once you register your device it will show up under Device Management in the EMM Console






By clicking on the view icon under the device you can view all device management options for the device:





Saturday, April 23, 2016

In and Out of JMS queue using WSO2 ESB

In this example we'll take a look at inserting a message to a JMS queue via a proxy service in WSO2 ESB, and how to pull it from the queue using an Inbound Endpoint


Part 1: Get Message From Queue

For the first part we will be using Sample 901 which ships with ESB 4.9.0.

Install ActiveMQ and follow steps in the following sample 901:
https://docs.wso2.com/display/ESB490/Sample+901%3A+Inbound+Endpoint+JMS+Protocol+Sample


For the first part you need to start the ESB with Sample configuration 901.
in <ESB_HOME>/bin
wso2esb-samples.bat -sn 901 for Windows

./wso2esb-samples.sh -sn 901 in Linux


Deploy SimpleStockQuoteService:

Run ant from <ESB_HOME>/samples/axis2Server/src/SimpleStockQuoteService


Then start the Axis2 Server at <ESB_HOME>/samples/axis2Server and send a message to the queue as shown in the sample.


Output - you will see a stock quote for IBM generated  in the Axis2 Server console.


Part 2: Put message to queue using proxy service

Create a pass through proxy and modify the source configuration with the following:

<?xml version="1.0" encoding="UTF-8"?>
<proxy xmlns="http://ws.apache.org/ns/synapse"
       name="StockQuoteProxyToJMSQueue"
       transports="http"
       statistics="disable"
       trace="disable"
       startOnLoad="true">
   <target>
      <inSequence>
         <property name="OUT_ONLY" value="true"/>
         <property name="FORCE_SC_ACCEPTED" value="true" scope="axis2"/>
         <send>
            <endpoint>
               <address uri="jms:/ordersQueue?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://127.0.0.1:61616&amp;transport.jms.DestinationType=queue"/>
            </endpoint>
         </send>
      </inSequence>
   </target>
   <description/>
</proxy>


The above is a pretty simple configuration that will forward the message sent to the proxy to the JMS queue.

You can get the WSDL file for the proxy service and invoke the proxy via SoapUI with the same payload shown in Sample 901. The end-to-end scenario will be when you send a message to the proxy the proxy will forward it to the JMS queue, and the inbound endpoint will pick it from the queue and send it to the SimpleStockQuoteService

--