Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Nuwan Jayawardene
Hi Madawa,

Have you evaluated this approach? What are the advantages and drawbacks in
> terms of storage and retrieval of images by following this approach?


I've yet to look more into this option. I was actually hoping for some
feedback on whether or not I should pursue this or stick with the RDBMS
approach since I'm not experienced enough with Siddhi to do a knowledgeable
assessment.
At the moment, for the use case at hand, a simple storage and retrieval
would suffice. But if we consider the long run IMO it would be smarter to
go with a Siddhi based approach.
Then again comes the issue of whether Siddhi streams support image
analytics.

On Tue, Jan 16, 2018 at 12:50 PM, Madawa Soysa  wrote:

> Hi Nuwan,
>
> One other approach suggested to me was to use a *Siddhi Stream for both
>> storage and retrieval* purposes. This would further allow for analytics
>> to be performed on the data which not be very much possible with the
>> earlier mentioned approaches.
>
>
> Have you evaluated this approach? What are the advantages and drawbacks in
> terms of storage and retrieval of images by following this approach?
>
> On Tue, Jan 16, 2018 at 12:36 PM, Geeth Munasinghe  wrote:
>
>>
>>
>> On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene 
>> wrote:
>>
>>> Hi all,
>>>
>>> I'm currently working on a project to add image storing and retrieval
>>> capabilities to the WSO2 IoT Server.
>>>
>>> To achieve this I have implemented the following;
>>> 1) Added a separate DAO Table with a field with LONGBLOB data type for
>>> storing.
>>> 2) Added storage capabilities in the database for an image sent as a *File
>>> *in the form of a *BinaryStream*.
>>>
>>> As of now, I've written unit tests and the test images are getting
>>> stored successfully in the database.
>>>
>>> The problem lies in how to successfully retrieve the stored data. For
>>> this, I have come across 2 possible approaches.
>>> 1) *Retrieve as a File - *The notable downside I realized with this
>>> solution is that each time a new Image is retrieved, a new file will be
>>> created. Therefore measures would have to be taken to persist new files
>>> while purging older obsolete ones.
>>> 2) *Retrieve as BinaryStream - *Although this requires no persistent
>>> memory usage and the data will only be retrieved on call and issues may
>>> come up when representing that data from a UI end. Further analysis is
>>> required for this approach.
>>>
>>
>> +1 for retrieving as a BinaryStream. This will make it easy to handle in
>> the java level unlike handling as a file. This has to work in the cluster
>> of servers, hence retrieving as a file will cause other syncing issues.
>>
>>
>>> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
>>> one recommended mostly in forums and tutorials.
>>>
>>> One other approach suggested to me was to use a *Siddhi Stream for both
>>> storage and retrieval* purposes. This would further allow for analytics
>>> to be performed on the data which not be very much possible with the
>>> earlier mentioned approaches.
>>>
>>> Suggestions and Feedback are appreciated.
>>> Thanks and regards!
>>>
>>> --
>>> *Nuwan Jayawardene*
>>> *Software Engineering Intern*
>>> *WSO2, Inc.:http://wso2.com *
>>> *lean.enterprise.middleware*
>>> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>>>
>>>
>>>- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>>>**njaya/
>>>*
>>>- * *
>>>
>>>
>>
>>
>> --
>> *Geeth Munasinghe*
>> *WSO2, Inc. http://wso2.com  *
>> *lean.enterprise.middleware.*
>>
>> email: ge...@wso2.com
>> phone:(+94) 777911226 <+94%2077%20791%201226>
>>
>> 
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "WSO2 IoT Team Group" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to iot-group+unsubscr...@wso2.com.
>> For more options, visit https://groups.google.com/a/wso2.com/d/optout.
>>
>
>
>
> --
>
> Madawa Soysa / Software Engineer
> mada...@wso2.com / +94714616050 <+94%2071%20461%206050>
>
> *WSO2 Inc.*
> lean.enterprise.middleware
>
>   
>
>
>
>


-- 
*Nuwan Jayawardene*
*Software Engineering intern*
*WSO2, Inc.:http://wso2.com *
*lean.enterprise.middleware*
*Mobile  :- +94 71 1813299*


   - *Linkedin* *:- **https://www.linkedin.com/in/nuwa
   **njaya/
   *
   - * *
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Ruwan Yatawara
As to my knowledge, image analysis is not supported, and won't be supported
in the near future.

@Mohan, @Ramindu, please correct me if I am wrong.

Thanks and Regards,

Ruwan Yatawara

Technical Lead,
WSO2 Inc.

email : ruw...@wso2.com
mobile : +94 77 9110413
http://ruwansrants.blogspot.com/
https://500px.com/ruwan_ace
https://medium.com/@ruwanyatawara


On Tue, Jan 16, 2018 at 1:01 PM, Nuwan Jayawardene  wrote:

> Hi Madawa,
>
> Have you evaluated this approach? What are the advantages and drawbacks in
>> terms of storage and retrieval of images by following this approach?
>
>
> I've yet to look more into this option. I was actually hoping for some
> feedback on whether or not I should pursue this or stick with the RDBMS
> approach since I'm not experienced enough with Siddhi to do a knowledgeable
> assessment.
> At the moment, for the use case at hand, a simple storage and retrieval
> would suffice. But if we consider the long run IMO it would be smarter to
> go with a Siddhi based approach.
> Then again comes the issue of whether Siddhi streams support image
> analytics.
>
> On Tue, Jan 16, 2018 at 12:50 PM, Madawa Soysa  wrote:
>
>> Hi Nuwan,
>>
>> One other approach suggested to me was to use a *Siddhi Stream for both
>>> storage and retrieval* purposes. This would further allow for analytics
>>> to be performed on the data which not be very much possible with the
>>> earlier mentioned approaches.
>>
>>
>> Have you evaluated this approach? What are the advantages and drawbacks
>> in terms of storage and retrieval of images by following this approach?
>>
>> On Tue, Jan 16, 2018 at 12:36 PM, Geeth Munasinghe 
>> wrote:
>>
>>>
>>>
>>> On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene 
>>> wrote:
>>>
 Hi all,

 I'm currently working on a project to add image storing and retrieval
 capabilities to the WSO2 IoT Server.

 To achieve this I have implemented the following;
 1) Added a separate DAO Table with a field with LONGBLOB data type for
 storing.
 2) Added storage capabilities in the database for an image sent as a *File
 *in the form of a *BinaryStream*.

 As of now, I've written unit tests and the test images are getting
 stored successfully in the database.

 The problem lies in how to successfully retrieve the stored data. For
 this, I have come across 2 possible approaches.
 1) *Retrieve as a File - *The notable downside I realized with this
 solution is that each time a new Image is retrieved, a new file will be
 created. Therefore measures would have to be taken to persist new files
 while purging older obsolete ones.
 2) *Retrieve as BinaryStream - *Although this requires no persistent
 memory usage and the data will only be retrieved on call and issues may
 come up when representing that data from a UI end. Further analysis is
 required for this approach.

>>>
>>> +1 for retrieving as a BinaryStream. This will make it easy to handle in
>>> the java level unlike handling as a file. This has to work in the cluster
>>> of servers, hence retrieving as a file will cause other syncing issues.
>>>
>>>
 3) *Retrieve as FileOutputStream - *This is my preferred method and
 the one recommended mostly in forums and tutorials.

 One other approach suggested to me was to use a *Siddhi Stream for
 both storage and retrieval* purposes. This would further allow for
 analytics to be performed on the data which not be very much possible with
 the earlier mentioned approaches.

 Suggestions and Feedback are appreciated.
 Thanks and regards!

 --
 *Nuwan Jayawardene*
 *Software Engineering Intern*
 *WSO2, Inc.:http://wso2.com *
 *lean.enterprise.middleware*
 *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*


- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
**njaya/
*
- * *


>>>
>>>
>>> --
>>> *Geeth Munasinghe*
>>> *WSO2, Inc. http://wso2.com  *
>>> *lean.enterprise.middleware.*
>>>
>>> email: ge...@wso2.com
>>> phone:(+94) 777911226 <+94%2077%20791%201226>
>>>
>>> 
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups "WSO2 IoT Team Group" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to iot-group+unsubscr...@wso2.com.
>>> For more options, visit https://groups.google.com/a/wso2.com/d/optout.
>>>
>>
>>
>>
>> --
>>
>> Madawa Soysa / Software Engineer
>> mada...@wso2.com / +94714616050 <+94%2071%20461%206050>
>>
>> *WSO2 Inc.*
>> lean.enterprise.middleware
>>
>>   
>>
>>
>>
>>
>
>
> --
> *Nuwan Jayawardene*
> *Software Engineering intern*
> 

Re: [Dev] JSON payload being null inside script message context

2018-01-15 Thread Bhathiya Jayasekara
Thilini, shall we make this change soon, so that we find issues early if
there are any?

Thanks,
Bhathiya

On Tue, Jan 16, 2018 at 1:06 PM, Thilini Shanika  wrote:

> Hi Isuru,
>
> We are already tracking this requirement in [1] and will be adding this to
> APIM 2.2.0.
>
> [1] https://wso2.org/jira/browse/APIMANAGER-5529
>
> On Tue, Jan 16, 2018 at 12:45 PM, Isuru Haththotuwa 
> wrote:
>
>> Previously there were a few issues with using JsonStreamBuilder and
>> JsonStreamFormatter in APIM, hence by default APIM used JsonBuilder and
>> JsonFormatter (up to the release 2.1.0). I think we can move to
>> JsonStreamBuilder and JsonStreamFormatter in the 2.2.0 release.
>>
>> On Tue, Jan 9, 2018 at 8:59 PM, Sameera Gunarathne 
>> wrote:
>>
>>> Hi Milinda,
>>>
>>> I have tried the suggestion and that way I can access the message
>>> payload. I can see in the axis2.xml in apim 2.2.0 this configuration is
>>> commented and uses JsonBuilder instead.
>>>
>>> 
>>> >> class="org.apache.synapse.comm
>>> ons.json.JsonBuilder"/>
>>> 
>>>
>>> Is there any specific reason to use JsonBuilder and what would be the
>>> impact of using JsonStreamBuilder?
>>>
>>> Thanks and Regards,
>>>
>>> On Tue, Jan 9, 2018 at 8:49 PM, Milinda Perera 
>>> wrote:
>>>
 Hi Sameera,

 Please add JsonStreamBuilder instead of JsonBuilder and try

 >>> class="org.wso2.carbon.integra
 tor.core.json.JsonStreamBuilder"/>

 Thanks,
 Milinda

 On Tue, Jan 9, 2018 at 8:44 PM, Sameera Gunarathne 
 wrote:

> Hi,
>
> I'm using a script mediator to get JSON payload inside an API
> sequence. I'm using a payload as follows.
>
> curl -X POST --header 'Content-Type: application/json' --header 'Accept: 
> application/xml' --header 'Authorization: Bearer 
> c4f97c6e-60fc-3c26-97ad-48b9c9fa4566' -d '{ \
>"PhoneNumbers": ["123456789"] \
>  }' 'https://10.100.7.133:8243/phoneVerify/1.0.0/checkPhoneNumbers
>
> I'm accessing the payload inside the script mediator as follows.
>
>  
>  var payload = mc.getPayloadJSON();
>  
>
> There I get following exception at the script mediator on the
> json payload being null.
>
> [2018-01-09 20:37:55,454] ERROR - ScriptMessageContext JSON object is
> null.
> [2018-01-09 20:37:55,458] ERROR - ScriptMediator The script engine
> returned an error executing the inlined js script function mediate
>
> but I have looked into the wirelogs and the json message comes to the
> sequence.
>
> [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
> >> "Accept-Language: en-US,en;q=0.9,nl;q=0.8[\r][\n]"
> [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
> >> "[\r][\n]"
> [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
> >> "{[\n]"
> [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
> >> "  *"PhoneNumbers": ["123456789"][\n]"*
> [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
> >> "}"
>
> What could be the reason for this? Any other suggestions to access
> message context inside a script mediator.
>
> Thanks and Regards,
> Sameera.
> --
> Sameera Gunarathne
> Software Engineer, WSO2 Inc. http://wso2.com
> 
> Email: samee...@wso2.com
> Mobile: +94714155561
>



 --
 Milinda Perera
 Senior Software Engineer;
 WSO2 Inc. http://wso2.com ,
 Mobile: (+94) 714 115 032 <+94%2071%20411%205032>


>>>
>>>
>>> --
>>> Sameera Gunarathne
>>> Software Engineer, WSO2 Inc. http://wso2.com
>>> 
>>> Email: samee...@wso2.com
>>> Mobile: +94714155561
>>>
>>> ___
>>> Dev mailing list
>>> Dev@wso2.org
>>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>>
>>>
>>
>>
>> --
>> Thanks and Regards,
>>
>> Isuru H.
>> +94 716 358 048 <+94%2071%20635%208048>* *
>>
>>
>>
>
>
> --
> Thilini Shanika
> Senior Software Engineer
> WSO2, Inc.; http://wso2.com
> 20, Palmgrove Avenue, Colombo 3
>
> E-mail: tgtshan...@gmail.com
>
>


-- 
*Bhathiya Jayasekara*
*Associate Technical Lead,*
*WSO2 inc., http://wso2.com *

*Phone: +94715478185*
*LinkedIn: http://www.linkedin.com/in/bhathiyaj
*
*Twitter: https://twitter.com/bhathiyax *
*Blog: http://movingaheadblog.blogspot.com
*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] JSON payload being null inside script message context

2018-01-15 Thread Thilini Shanika
Hi Isuru,

We are already tracking this requirement in [1] and will be adding this to
APIM 2.2.0.

[1] https://wso2.org/jira/browse/APIMANAGER-5529

On Tue, Jan 16, 2018 at 12:45 PM, Isuru Haththotuwa  wrote:

> Previously there were a few issues with using JsonStreamBuilder and
> JsonStreamFormatter in APIM, hence by default APIM used JsonBuilder and
> JsonFormatter (up to the release 2.1.0). I think we can move to
> JsonStreamBuilder and JsonStreamFormatter in the 2.2.0 release.
>
> On Tue, Jan 9, 2018 at 8:59 PM, Sameera Gunarathne 
> wrote:
>
>> Hi Milinda,
>>
>> I have tried the suggestion and that way I can access the message
>> payload. I can see in the axis2.xml in apim 2.2.0 this configuration is
>> commented and uses JsonBuilder instead.
>>
>> 
>> > class="org.apache.synapse.comm
>> ons.json.JsonBuilder"/>
>> 
>>
>> Is there any specific reason to use JsonBuilder and what would be the
>> impact of using JsonStreamBuilder?
>>
>> Thanks and Regards,
>>
>> On Tue, Jan 9, 2018 at 8:49 PM, Milinda Perera  wrote:
>>
>>> Hi Sameera,
>>>
>>> Please add JsonStreamBuilder instead of JsonBuilder and try
>>>
>>> >> class="org.wso2.carbon.integra
>>> tor.core.json.JsonStreamBuilder"/>
>>>
>>> Thanks,
>>> Milinda
>>>
>>> On Tue, Jan 9, 2018 at 8:44 PM, Sameera Gunarathne 
>>> wrote:
>>>
 Hi,

 I'm using a script mediator to get JSON payload inside an API sequence.
 I'm using a payload as follows.

 curl -X POST --header 'Content-Type: application/json' --header 'Accept: 
 application/xml' --header 'Authorization: Bearer 
 c4f97c6e-60fc-3c26-97ad-48b9c9fa4566' -d '{ \
"PhoneNumbers": ["123456789"] \
  }' 'https://10.100.7.133:8243/phoneVerify/1.0.0/checkPhoneNumbers

 I'm accessing the payload inside the script mediator as follows.

  
  var payload = mc.getPayloadJSON();
  

 There I get following exception at the script mediator on the
 json payload being null.

 [2018-01-09 20:37:55,454] ERROR - ScriptMessageContext JSON object is
 null.
 [2018-01-09 20:37:55,458] ERROR - ScriptMediator The script engine
 returned an error executing the inlined js script function mediate

 but I have looked into the wirelogs and the json message comes to the
 sequence.

 [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
 >> "Accept-Language: en-US,en;q=0.9,nl;q=0.8[\r][\n]"
 [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
 >> "[\r][\n]"
 [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
 >> "{[\n]"
 [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
 >> "  *"PhoneNumbers": ["123456789"][\n]"*
 [2018-01-09 20:37:55,445] DEBUG - wire HTTPS-Listener I/O dispatcher-6
 >> "}"

 What could be the reason for this? Any other suggestions to access
 message context inside a script mediator.

 Thanks and Regards,
 Sameera.
 --
 Sameera Gunarathne
 Software Engineer, WSO2 Inc. http://wso2.com
 
 Email: samee...@wso2.com
 Mobile: +94714155561

>>>
>>>
>>>
>>> --
>>> Milinda Perera
>>> Senior Software Engineer;
>>> WSO2 Inc. http://wso2.com ,
>>> Mobile: (+94) 714 115 032 <+94%2071%20411%205032>
>>>
>>>
>>
>>
>> --
>> Sameera Gunarathne
>> Software Engineer, WSO2 Inc. http://wso2.com
>> 
>> Email: samee...@wso2.com
>> Mobile: +94714155561
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>
>
> --
> Thanks and Regards,
>
> Isuru H.
> +94 716 358 048 <+94%2071%20635%208048>* *
>
>
>


-- 
Thilini Shanika
Senior Software Engineer
WSO2, Inc.; http://wso2.com
20, Palmgrove Avenue, Colombo 3

E-mail: tgtshan...@gmail.com
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Geeth Munasinghe
On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene  wrote:

> Hi all,
>
> I'm currently working on a project to add image storing and retrieval
> capabilities to the WSO2 IoT Server.
>
> To achieve this I have implemented the following;
> 1) Added a separate DAO Table with a field with LONGBLOB data type for
> storing.
> 2) Added storage capabilities in the database for an image sent as a *File
> *in the form of a *BinaryStream*.
>
> As of now, I've written unit tests and the test images are getting stored
> successfully in the database.
>
> The problem lies in how to successfully retrieve the stored data. For
> this, I have come across 2 possible approaches.
> 1) *Retrieve as a File - *The notable downside I realized with this
> solution is that each time a new Image is retrieved, a new file will be
> created. Therefore measures would have to be taken to persist new files
> while purging older obsolete ones.
> 2) *Retrieve as BinaryStream - *Although this requires no persistent
> memory usage and the data will only be retrieved on call and issues may
> come up when representing that data from a UI end. Further analysis is
> required for this approach.
>

+1 for retrieving as a BinaryStream. This will make it easy to handle in
the java level unlike handling as a file. This has to work in the cluster
of servers, hence retrieving as a file will cause other syncing issues.


> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
> one recommended mostly in forums and tutorials.
>
> One other approach suggested to me was to use a *Siddhi Stream for both
> storage and retrieval* purposes. This would further allow for analytics
> to be performed on the data which not be very much possible with the
> earlier mentioned approaches.
>
> Suggestions and Feedback are appreciated.
> Thanks and regards!
>
> --
> *Nuwan Jayawardene*
> *Software Engineering Intern*
> *WSO2, Inc.:http://wso2.com *
> *lean.enterprise.middleware*
> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>
>
>- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>**njaya/
>*
>- * *
>
>


-- 
*Geeth Munasinghe*
*WSO2, Inc. http://wso2.com  *
*lean.enterprise.middleware.*

email: ge...@wso2.com
phone:(+94) 777911226


___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] wso2 http access logs customization

2018-01-15 Thread Prakhash Sivakumar
Hi Deepak,

Moving this discussion to the DEV as this is not about a security issue.

Thanks,
Prakhash

On Tue, Jan 16, 2018 at 12:54 PM, Deepak Singla 
wrote:

> Hello Wso2 Team
>
>
>
> I configured wso2 5.4.0 Identity Service on window environment. Here I am
> trying to customizing the maximum file size and Maximun back up index of
> http_access*.log, then I followed this link
> 
> to customize http_access logs.
>
>
>
> I also found this file *logging-bridge.properties* under directory
> “wso2\repository\conf\etc\logging-bridge.properties”. I applied above
> changes mentioned in link in logging-bridge.properties file. Like
>
> # Define the FileHandler
>
> handlers= java.util.logging.FileHandler
>
>
>
> # Configure the FileHandler
>
> java.util.logging.FileHandler.pattern = %h/java%u.log
>
> java.util.logging.FileHandler.limit = 1024000
>
> java.util.logging.FileHandler.count = 3
>
> java.util.logging.FileHandler.formatter =  java.util.logging.SimpleFormat
> ter
>
> java.util.logging.FileHandler.append=true
>
>
>
> Then I restarted the wso2 server, but it is not working for me.
>
>
>
> Kindly provide me your inputs to resolve this issue.
>
>
>
> Regards
>
> Deepak
>



-- 
Prakhash Sivakumar
Software Engineer | WSO2 Inc
Platform Security Team
Mobile : +94771510080 <+94%2077%20151%200080>
Blog : https://medium.com/@PrakhashS
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Madawa Soysa
Hi Nuwan,

One other approach suggested to me was to use a *Siddhi Stream for both
> storage and retrieval* purposes. This would further allow for analytics
> to be performed on the data which not be very much possible with the
> earlier mentioned approaches.


Have you evaluated this approach? What are the advantages and drawbacks in
terms of storage and retrieval of images by following this approach?

On Tue, Jan 16, 2018 at 12:36 PM, Geeth Munasinghe  wrote:

>
>
> On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene 
> wrote:
>
>> Hi all,
>>
>> I'm currently working on a project to add image storing and retrieval
>> capabilities to the WSO2 IoT Server.
>>
>> To achieve this I have implemented the following;
>> 1) Added a separate DAO Table with a field with LONGBLOB data type for
>> storing.
>> 2) Added storage capabilities in the database for an image sent as a *File
>> *in the form of a *BinaryStream*.
>>
>> As of now, I've written unit tests and the test images are getting stored
>> successfully in the database.
>>
>> The problem lies in how to successfully retrieve the stored data. For
>> this, I have come across 2 possible approaches.
>> 1) *Retrieve as a File - *The notable downside I realized with this
>> solution is that each time a new Image is retrieved, a new file will be
>> created. Therefore measures would have to be taken to persist new files
>> while purging older obsolete ones.
>> 2) *Retrieve as BinaryStream - *Although this requires no persistent
>> memory usage and the data will only be retrieved on call and issues may
>> come up when representing that data from a UI end. Further analysis is
>> required for this approach.
>>
>
> +1 for retrieving as a BinaryStream. This will make it easy to handle in
> the java level unlike handling as a file. This has to work in the cluster
> of servers, hence retrieving as a file will cause other syncing issues.
>
>
>> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
>> one recommended mostly in forums and tutorials.
>>
>> One other approach suggested to me was to use a *Siddhi Stream for both
>> storage and retrieval* purposes. This would further allow for analytics
>> to be performed on the data which not be very much possible with the
>> earlier mentioned approaches.
>>
>> Suggestions and Feedback are appreciated.
>> Thanks and regards!
>>
>> --
>> *Nuwan Jayawardene*
>> *Software Engineering Intern*
>> *WSO2, Inc.:http://wso2.com *
>> *lean.enterprise.middleware*
>> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>>
>>
>>- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>>**njaya/
>>*
>>- * *
>>
>>
>
>
> --
> *Geeth Munasinghe*
> *WSO2, Inc. http://wso2.com  *
> *lean.enterprise.middleware.*
>
> email: ge...@wso2.com
> phone:(+94) 777911226 <+94%2077%20791%201226>
>
> 
>
> --
> You received this message because you are subscribed to the Google Groups
> "WSO2 IoT Team Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to iot-group+unsubscr...@wso2.com.
> For more options, visit https://groups.google.com/a/wso2.com/d/optout.
>



-- 

Madawa Soysa / Software Engineer
mada...@wso2.com / +94714616050 <+94%2071%20461%206050>

*WSO2 Inc.*
lean.enterprise.middleware

  
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] [Analytics] Can we analyze api invocations against the app language

2018-01-15 Thread Nuwan Dias
I don't think so. If the App sends the User-Agent header in the correct
form, it should display it correctly.

On Mon, Jan 15, 2018 at 1:41 PM, Jason De Silva  wrote:

> Hi Praminda,
>
> As I understood even if the client app sends the User-Agent header with
> the information of which type of client invoked the API, the
> API_REQ_USER_BROW_SUMMARY table currently records only the OS and browser
> version. So, still we will need improve that aspect to record the client
> type which invoked the API to cater this scenario.
>
> Regards,
> Jason
>
> Jason De Silva
> *Software Engineer - QA*
> Mobile: +94 (0) 772 097 678
> Email: jas...@wso2.com
> WSO2 Inc. www.wso2.com
> 
>
> On Mon, Jan 15, 2018 at 12:38 PM, Praminda Jayawardana 
> wrote:
>
>> Hi Jason,
>>
>> This is still possible if the client application is configured (or
>> implemented) to send the User-Agent header which specify the specific
>> client used to invoke the API. If some information regarding who invoked
>> the API is not sent by the client, I don't see a clear way to distinguish
>> requests among different clients.
>>
>> Thanks,
>> Praminda
>>
>> On Mon, Jan 15, 2018 at 10:06 AM, Jason De Silva  wrote:
>>
>>> Hi Rukshan,
>>>
>>> Thank you for the information. Since it currently shows only the
>>> cumulative information of the OAuth app stats, I have created a git issue
>>> [1] to consider support different client app specific analytics against
>>> a single API. This way we will be able to track different client apps
>>> invocations against one single application.
>>>
>>> [1] https://github.com/wso2/product-apim/issues/2414
>>>
>>> Regards,
>>> Jason
>>>
>>> Jason De Silva
>>> *Software Engineer - QA*
>>> Mobile: +94 (0) 772 097 678
>>> Email: jas...@wso2.com
>>> WSO2 Inc. www.wso2.com
>>> 
>>>
>>> On Fri, Jan 12, 2018 at 8:46 PM, Rukshan Premathunga 
>>> wrote:
>>>
 Hi Jason,

 APIM we have apps related stats. In your case your client app(PHP,
 android etc) use the app created using APIM store to invoke exposed APIs
 from APIM GW. Then your client application can be represent using oAuth App
 you created from store. So in APIM Store, you can see the oAuth app's stat
 and which can be used to represent actual client's app stat as well.

 API Usage Across Usage Agent graph, show the stat based on the
 User-Agent header. So this is diffrent to what i explain earlier. Anyway
 this graph is currently limited to show OS and Browser related stat. So
 show stat based on the other attribute in the User-Agent is not possible
 ATM.

 Thanks and Regards


 On Fri, Jan 12, 2018 at 6:15 PM, Jason De Silva 
 wrote:

> Hi Fazlan,
>
> Let me elaborate a bit more, what I basically need is to capture the
> language the API was invoked from e.g PHP app 20 calls, python app 50 
> calls
> etc. Currently what we provide by enabling analytics is something like
> below which is the OS version the API was called from. Since, we provide
> different SDKs to develop apps wanted to know the possibility of tracking
> the number of requests called via php app, python app etc.
>
>
> ​
>
> Regards,
> Jason
>
> Jason De Silva
> *Software Engineer - QA*
> Mobile: +94 (0) 772 097 678
> Email: jas...@wso2.com
> WSO2 Inc. www.wso2.com
> 
>
> On Fri, Jan 12, 2018 at 6:04 PM, Fazlan Nazeem 
> wrote:
>
>> Hi Jason,
>>
>> There is nothing special you have to configure to make this chart
>> work. Just enabling analytics will be enough.
>>
>> On Fri, Jan 12, 2018 at 5:55 PM, Jason De Silva 
>> wrote:
>>
>>> Hi All,
>>>
>>> In APIM we provide sdk's to develop client apps to consume the apis
>>> from a preferred language. Let's assume a scenario where I develop 
>>> several
>>> apps using php, android, java etc.  which consumes from the same API. In
>>> such scenario is there a possibility that I can differentiate the api
>>> invocations done app wise to be tracked from analytics. E.g 50 calls
>>> via php app, 25 calls via android app etc.?
>>>
>>> I was going through [1] and I found that we currently capture the
>>> "User-Agent" header and save the OS and Browser version in
>>> API_REQ_USER_BROW_SUMMARY table and we generate stats to show the 
>>> browser
>>> version under "API Usage Across Usage Agent" in analytics. But I could 
>>> not
>>> find any info on how to get the above configured. Any input on this is
>>> highly appreciated.
>>>
>>> [1] https://docs.wso2.com/display/AM2xx/Viewing+API+Statisti
>>> cs#ViewingAPIStatistics-APIUsageAcrossUserAgent
>>>
>>> Regards,
>>> Jason

Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Rasika Perera
​Hi All,

One other approach suggested to me was to use a *Siddhi Stream for both
> storage and retrieval* purposes. This would further allow for analytics
> to be performed on the data which not be very much possible with the
> earlier mentioned approaches.

​I am +1 for this. IMO, treating the image as an *event-stream* would be
beneficial for us to have better management of the images / binaries as it
grows. I am referring data purging, applying Machine Learning modeling and
most importantly AFAIU users will be having the flexibility of plugging-in
non-RDBMS event stores for persisting these events.

On the other-hand, having it on a RDBMS table field; we'd have the all
*headache* of purging & managing large binary streams and slowing down of
dbms.

WDYT?

Best Regards,
~Rasika

On Tue, Jan 16, 2018 at 11:41 AM, Ruwan Yatawara  wrote:

> I am +1 for the second option of retrieving the image as a binary stream.
>
> Given the fact that images can be of varying sizes (talking about
> high-resolution ones, here), and Sidhdhi not having any image processing
> capabilities as of this moment, I do not see a clear advantage in using a
> SIdhdhi stream for storage and retrieval.
>
> Thanks and Regards,
>
> Ruwan Yatawara
>
> Technical Lead,
> WSO2 Inc.
>
> email : ruw...@wso2.com
> mobile : +94 77 9110413
> http://ruwansrants.blogspot.com/
> https://500px.com/ruwan_ace
> https://medium.com/@ruwanyatawara
>
>
> On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene 
> wrote:
>
>> Hi all,
>>
>> I'm currently working on a project to add image storing and retrieval
>> capabilities to the WSO2 IoT Server.
>>
>> To achieve this I have implemented the following;
>> 1) Added a separate DAO Table with a field with LONGBLOB data type for
>> storing.
>> 2) Added storage capabilities in the database for an image sent as a *File
>> *in the form of a *BinaryStream*.
>>
>> As of now, I've written unit tests and the test images are getting stored
>> successfully in the database.
>>
>> The problem lies in how to successfully retrieve the stored data. For
>> this, I have come across 2 possible approaches.
>> 1) *Retrieve as a File - *The notable downside I realized with this
>> solution is that each time a new Image is retrieved, a new file will be
>> created. Therefore measures would have to be taken to persist new files
>> while purging older obsolete ones.
>> 2) *Retrieve as BinaryStream - *Although this requires no persistent
>> memory usage and the data will only be retrieved on call and issues may
>> come up when representing that data from a UI end. Further analysis is
>> required for this approach.
>> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
>> one recommended mostly in forums and tutorials.
>>
>> One other approach suggested to me was to use a *Siddhi Stream for both
>> storage and retrieval* purposes. This would further allow for analytics
>> to be performed on the data which not be very much possible with the
>> earlier mentioned approaches.
>>
>> Suggestions and Feedback are appreciated.
>> Thanks and regards!
>>
>> --
>> *Nuwan Jayawardene*
>> *Software Engineering Intern*
>> *WSO2, Inc.:http://wso2.com *
>> *lean.enterprise.middleware*
>> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>>
>>
>>- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>>**njaya/
>>*
>>- * *
>>
>>
>


-- 
With Regards,

*Rasika Perera*
Senior Software Engineer
LinkedIn: http://lk.linkedin.com/in/rasika90



WSO2 Inc. www.wso2.com
lean.enterprise.middleware
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Ruwan Abeykoon
Hi Nipuni,
some other comments
near line [1]

1. No need to compile. We can just distribute the compiled class.
2. java AppId | grep "some_key" | cut ..

Reason is that there is a particular way shell scripts supposed to work.
Each command takes "stdin" and produces "stdout".  Then using return value
to check for errors.



[1] https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/3
a17441469e8cd8f6ff104f62abf95cf51752f39/sample.sh#L321

Cheers,
Ruwan


On Tue, Jan 16, 2018 at 9:55 AM, Rushmin Fernando  wrote:

> +1 for this approach Nipuni.
>
> You have nicely solved the dependency problem.
>
> On Tue, Jan 16, 2018 at 9:43 AM, Nipuni Bhagya  wrote:
>
>> Hi Ruwan,
>>
>> Thank you so much for the quick feedback. I sure will add that to the
>> code.
>>
>> Kind regards,
>> Nipuni
>>
>> On Tue, Jan 16, 2018 at 9:33 AM, Ruwan Abeykoon  wrote:
>>
>>> Hi Nipuni,
>>> Excellent !
>>>
>>> You need to exit the main with non zero exit codes when there is an
>>> error.
>>>
>>> e.g.
>>> }catch (SAXParseException err) {
>>> System.out.println ("** Parsing error" + ", line "
>>> + err.getLineNumber () + ", uri " + err.getSystemId ());
>>> System.out.println(" " + err.getMessage ());
>>> System.exit(1)
>>> }catch
>>> Cheers,
>>> Ruwan
>>>
>>>
>>> On Tue, Jan 16, 2018 at 9:27 AM, Nipuni Bhagya  wrote:
>>>
 Hi Rushmin,

 Yes, the java program will be executed through the Shell script.

 Please refer the following links to my shell script and the Java file.

 Shell script - 
 *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/sample.sh
 *
 Java file - 
 *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/2/AppId.java
 *

 I would really appreciate if you could correct me if I have made any
 mistakes.

 Thank you

 On Mon, Jan 15, 2018 at 2:56 PM, Rushmin Fernando 
 wrote:

> So, does the shell script talk to a Java program to get this done?
>
> Could you please share the code.
>
> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya 
> wrote:
>
>> Hi all,
>>
>> I have overcome aforementioned problem by implementing my script in
>> such a way that it extracts the value of required XML tag using the Java
>> DOM parser. Since this approach is more straightforward and most
>> importantly doesn't require any extra dependencies, I believe this would 
>> be
>> a more appropriate solution for our requirement.
>>
>> Thank you all for the support.
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> *Best Regards*
>
> *Rushmin Fernando*
> *Technical Lead*
>
> WSO2 Inc.  - Lean . Enterprise . Middleware
>
> mobile : +94775615183
>
>
>


 --



 *Kind Regards,Nipuni Bhagya*

 *Software Engineering Intern*
 *WSO2*



 *Mobile : +94 0779028904 <+94%2077%20767%201807>*

>>>
>>>
>>>
>>> --
>>>
>>> *Ruwan Abeykoon*
>>> *Associate Director/Architect**,*
>>> *WSO2, Inc. http://wso2.com  *
>>> *lean.enterprise.middleware.*
>>>
>>>
>>
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> *Best Regards*
>
> *Rushmin Fernando*
> *Technical Lead*
>
> WSO2 Inc.  - Lean . Enterprise . Middleware
>
> mobile : +94775615183
>
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Kamidu Punchihewa
Hi Nuwan,

 am +1 for the second option of retrieving the image as a binary stream
too. There are approaches which can be used and at the moment in use also
to represent an image using the binary information. IMO your concern
regarding this option will not be an issue.

Thanks and Best Regards,


On Tue, Jan 16, 2018 at 11:41 AM, Ruwan Yatawara  wrote:

> I am +1 for the second option of retrieving the image as a binary stream.
>
> Given the fact that images can be of varying sizes (talking about
> high-resolution ones, here), and Sidhdhi not having any image processing
> capabilities as of this moment, I do not see a clear advantage in using a
> SIdhdhi stream for storage and retrieval.
>
> Thanks and Regards,
>
> Ruwan Yatawara
>
> Technical Lead,
> WSO2 Inc.
>
> email : ruw...@wso2.com
> mobile : +94 77 9110413
> http://ruwansrants.blogspot.com/
> https://500px.com/ruwan_ace
> https://medium.com/@ruwanyatawara
>
>
> On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene 
> wrote:
>
>> Hi all,
>>
>> I'm currently working on a project to add image storing and retrieval
>> capabilities to the WSO2 IoT Server.
>>
>> To achieve this I have implemented the following;
>> 1) Added a separate DAO Table with a field with LONGBLOB data type for
>> storing.
>> 2) Added storage capabilities in the database for an image sent as a *File
>> *in the form of a *BinaryStream*.
>>
>> As of now, I've written unit tests and the test images are getting stored
>> successfully in the database.
>>
>> The problem lies in how to successfully retrieve the stored data. For
>> this, I have come across 2 possible approaches.
>> 1) *Retrieve as a File - *The notable downside I realized with this
>> solution is that each time a new Image is retrieved, a new file will be
>> created. Therefore measures would have to be taken to persist new files
>> while purging older obsolete ones.
>> 2) *Retrieve as BinaryStream - *Although this requires no persistent
>> memory usage and the data will only be retrieved on call and issues may
>> come up when representing that data from a UI end. Further analysis is
>> required for this approach.
>> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
>> one recommended mostly in forums and tutorials.
>>
>> One other approach suggested to me was to use a *Siddhi Stream for both
>> storage and retrieval* purposes. This would further allow for analytics
>> to be performed on the data which not be very much possible with the
>> earlier mentioned approaches.
>>
>> Suggestions and Feedback are appreciated.
>> Thanks and regards!
>>
>> --
>> *Nuwan Jayawardene*
>> *Software Engineering Intern*
>> *WSO2, Inc.:http://wso2.com *
>> *lean.enterprise.middleware*
>> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>>
>>
>>- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>>**njaya/
>>*
>>- * *
>>
>>
> --
> You received this message because you are subscribed to the Google Groups
> "WSO2 IoT Team Group" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to iot-group+unsubscr...@wso2.com.
> For more options, visit https://groups.google.com/a/wso2.com/d/optout.
>



-- 
Kamidu Sachith Punchihewa
*Senior Software Engineer*
WSO2, Inc.
lean . enterprise . middleware
Mobile : +94 (0) 770566749 <%2B94%20%280%29%20773%20451194>

Disclaimer: This communication may contain privileged or other confidential
information and is intended exclusively for the addressee/s. If you are not
the intended recipient/s, or believe that you may have received this
communication in error, please reply to the sender indicating that fact and
delete the copy you received and in addition, you should not print, copy,
retransmit, disseminate, or otherwise use the information contained in this
communication. Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability for any
errors or omissions.
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Adding values to a field in request using enrich mediator

2018-01-15 Thread vikram nayak
Hi,
I have to add a random number to too many ids present in my request.
Actual request consists of thousands of lines and there are many ids in it.
some ids are within array , some are direct elements.
{  "id" : "1",   {    "id":"2"   }}
1. I can do this by first aceessing the id in a property say property1.2. Then 
generating the random Number in property2.3. Then creating third property, to 
where i assign value of property1 + property2 to  property3.5. Then assign 
property 3 to first id in request using enrich mediator.
But I think this is not ideal way to do it. Since I have to do it for many id's 
in request.There should be some way to enrich request directly using one enrich 
mediator
$body.Lookups.$id = $body.Lookups.$id +  get-property('randomNumber');
Thanks___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] Open API 3.0 support for API Publisher Resource definition UI

2018-01-15 Thread Malintha Amarasinghe
Hi Thilini,

Understood. Thanks for the detailed explanation.

And +1 for supporting requestBody definitions in APIM 2.2.0 UI as you
suggested.

Thank you!

On Tue, Jan 16, 2018 at 11:36 AM, Thilini Shanika  wrote:

> Hi Malintha,
>
> From what I understood from above, OpenAPI 3.0.0 is supporting specifying
> different response/request schemas based on the media type. In swagger 2.0
> we could define only one schema for request/response which is common for
> the specified produces and consumes elements under resources section. Is my
> understanding correct?
>
> Yes, we can define different schemas of responses and requests based on
> the content type.
>
> eg: Responses
>
>   responses:
> '200':
>   description: OK
>   content:
> application/xml:
>   schema:
> type: array
> items:
>   type: string
> application/json:
>   schema:
> type: array
> items:
>   type: string
>
>
>
> eg: RequestBody
>
>  requestBody:
> content:
>   application/json:
> schema:
>   type: object
>   properties:
> payload:
>   type: string
>   application/xml:
> schema:
>   type: object
>   properties:
> payload:
>   type: string
> description: Request Body
>
>
> If that so, if we are changing the UI based on swagger version, do we also
> support specifying different response/request schemas based on the media
> type?
>
> Since we have been providing the functionality of defining body and
> formData parameters in APIM 2.1.0, we have to at least support requestBody
> definitions in APIM 2.2.0 UI. Since we haven't supported responses
> definitions for Swagger 2.0, we can omit this functionality for OpenAPI
> 3.0.0 also, but if we are planning to add this as a new improvement, we
> have to implement this for both versions. Or else, we can allow the users
> to continue with complex definitions via embedded Swagger editor.
>
>
>
>
>
> On Tue, Jan 16, 2018 at 11:06 AM, Malintha Amarasinghe  > wrote:
>
>> Hi Thilini,
>>
>> From what I understood from above, OpenAPI 3.0.0 is supporting
>> specifying different response/request schemas based on the media type. In
>> swagger 2.0 we could define only one schema for request/response which is
>> common for the specified produces and consumes elements under resources
>> section. Is my understanding correct?
>>
>> If that so, if we are changing the UI based on swagger version, do we
>> also support specifying different response/request schemas based on the
>> media type?
>>
>> Thanks!
>> Malintha
>>
>> On Tue, Jan 16, 2018 at 10:54 AM, Thilini Shanika 
>> wrote:
>>
>>> Hi All,
>>>
>>> We are currently in the process of implementing Open API 3.0 support in
>>> API Manager and as per the design discussions, APIM 2.2.0 will be
>>> supporting both OpenAPI 3.0.0 and Swagger 2.0 specs. A resource definition
>>> of Open API 3.0.0 has some significant differences compared to a resource
>>> definition in Swagger 2.0. Following are some of the major differences of
>>> Swagger 2.0 and OpenAPI 3.0.0 spec based API resource definition.
>>>
>>>- '*body*' and '*formData*' parameter types are not available in
>>>OpenAPI 3.0.0. Instead, the *requestBody* element has been
>>>introduced.
>>>- According to Swagger 2.0 spec, one can define a list of MIME types
>>>which the API resource can produce and consume. These configs are
>>>defines under *consumes *and *produces *elements of the API
>>>resource. But this config is no longer available in OpenAPI 3.0.0. 
>>> Instead,
>>>MIME types are defined under *requestBody *and *response *elements.
>>>
>>> OpenAPI 3.0.0 based resource definition is given below
>>>
>>> paths:
>>>   /testpath:
>>> get:
>>>   responses:
>>> '200':
>>>   description: OK
>>>   parameters:
>>> - name: id
>>>   in: query
>>>   required: false
>>>   schema:
>>> type: string
>>> post:
>>>   responses:
>>> '200':
>>>   description: OK
>>>   content:
>>> *application/xml*:
>>>   schema:
>>> type: array
>>> items:
>>>   type: string
>>>   *requestBody*:
>>> content:
>>>   *application/json:*
>>> schema:
>>>   type: object
>>>   properties:
>>> payload:
>>>   type: string
>>> description: Request Body
>>>
>>> If we are implementing support for OpenAPI 3.0.0, we have to do some
>>> changes to resource definition UI. (Has to remove consumes: and produces:
>>> fields, has to remove body and formData from parameter types. 

Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Godwin Shrimal
Hi Heshitha,

If there is no any API level changes, it should work. The error I am
getting is not due wrong synapse version, its due to the corrupted jar
file. I am -1 to remove jar file link and only giving source code location.
Synapse API is not changing frequently. Users can easily try out the
scenario when there is an option to download the jar file.

Thanks
Godwin


On Tue, Jan 16, 2018 at 12:20 PM, Heshitha Hettihewa 
wrote:

> Hi All,
>
> It seems the sample jar added in the doc has used an older synapse
> version(2.1.1-wso2v2) when building. IMO In order to maintain this we have
> to update the sample jar with new synapse releases. So IMO its better if we
> give only the source build option instead of providing the jar OOB.
> Otherwise there is a possibility of getting this error with new synapse
> versions. WDYT?
>
> Thanks,
> Heshitha.
>
> On Tue, Jan 16, 2018 at 10:36 AM, Godwin Shrimal  wrote:
>
>> Issue resolved once build from source.
>>
>>
>> Thanks
>> Godwin
>>
>> On Tue, Jan 16, 2018 at 11:57 AM, Vinod Kavinda  wrote:
>>
>>> Hi Godwin,
>>> I'm sorry, missed that.
>>>
>>> Regards,
>>> Vinod
>>>
>>> On Tue, Jan 16, 2018 at 10:24 AM, Godwin Shrimal 
>>> wrote:
>>>
 *org.wso2.handler.SimpleOauthHandler *is for OAuth security and here I
 am referring to BasicAuth. So class name in the doc looks correct for me.

 Thanks
 Godwin

 On Tue, Jan 16, 2018 at 11:51 AM, Godwin Shrimal 
 wrote:

> Hi Vinod,
>
> I tried changing handler name and getting the same error. It looks
> something wrong with the jar file when I try the following command gives 
> an
> error as "Error: error reading 
> WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar;
> error in opening zip file". Let me compile the source and try.
>
> javap -classpath WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar
> org.wso2.handler.SimpleOauthHandler
>
> Thanks
> Godwin
>
> On Tue, Jan 16, 2018 at 11:35 AM, Vinod Kavinda 
> wrote:
>
>> Hi Godwin,
>> The jar in the given location has a different name than the doc.
>> Please try using the handler name "*org.wso2.handler.SimpleOauthHandler".
>> *Let's verify this. Then we need to correct the doc to align with
>> the sample. Thanks for reporting.
>>
>> Regards,
>> Vinod
>>
>> On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal 
>> wrote:
>>
>>> Hi Devs,
>>>
>>> When we add the BasicAuth handler to API and save it gives following
>>> error. (I followed the doc [1] and downloaded the jar file and put into
>>> /lib)
>>>
>>> [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error
>>> initializing API handler: org.wso2.rest.BasicAuthHandler
>>> java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler
>>> cannot be found by synapse-core_2.1.7.wso2v15
>>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter
>>> nal(BundleLoader.java:501)
>>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>>> leLoader.java:421)
>>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>>> leLoader.java:412)
>>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa
>>> dClass(DefaultClassLoader.java:107)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>> at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
>>> APIFactory.java:161)
>>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>>> actory.java:103)
>>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>>> actory.java:53)
>>> at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromS
>>> tring(RestApiAdmin.java:164)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>> ssorImpl.java:62)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>> thodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>> at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RP
>>> CUtil.java:212)
>>> at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusi
>>> nessLogic(RPCMessageReceiver.java:117)
>>> at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo
>>> keBusinessLogic(AbstractInOutMessageReceiver.java:40)
>>> at org.apache.axis2.receivers.AbstractMessageReceiver.receive(A
>>> bstractMessageReceiver.java:110)
>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:1
>>> 80)
>>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>>> essMessage(LocalTransportReceiver.java:169)
>>>  

Re: [Dev] Deletion of Faulty Proxy Services Not Supported

2018-01-15 Thread Thishani Lucas
Hi Isuru and All,

I tested the scenario in the windows environment and was able to reproduce
the issue. Apart from this, I have certain concerns regarding the deletion
of services.

When deleting a proxy deployed via a capp, the file in the temporary capp
folder is deleted and the relevant axis service is undeployed. But is it a
good practice to allow deleting an artifact deployed via a capp? Even if we
allow, shouldn't we remove the entire capp?

The deleting of faulty proxy deployed via a capp is anyway not happening
because of the above mentioned substring issue.

Now we have two things to do.

   - Fix the issue with deleting of faulty services by removing the
   substring method.
   - If we're allowing deletion of services from capp, then we should
   re-write the method [1] since it has an incorrect logic to remove capp
   faulty services.

Please provide your suggestions.

[1]
https://github.com/wso2/carbon-deployment/blob/4.7.x/components/service-mgt/axis2-service-mgt/org.wso2.carbon.service.mgt/src/main/java/org/wso2/carbon/service/mgt/ServiceAdmin.java#L777

Thanks,
Thishani


On Wed, Jan 10, 2018 at 2:27 PM, Isuru Udana  wrote:

> Hi Thishani,
>
> Shall we check on the windows environment as well. I think there are some
> issues in the logic written for windows.
> And I am not sure condition in L792 is correct. Can you please check that
> one also ?
>
> Thanks.
>
>
>
> On Wed, Jan 10, 2018 at 2:15 PM, Thishani Lucas  wrote:
>
>> Hi Vinod,
>>
>> Of course yes I can do that. But if there is no use with that substring,
>> I thought of simply removing it. But yes, for now I'll follow your
>> suggestion.
>>
>> Thanks,
>> Thishani
>>
>> On Wed, Jan 10, 2018 at 2:06 PM, Vinod Kavinda  wrote:
>>
>>> Hi Thishani,
>>> Why don't you just add the file separator (/) before appending the
>>> service name in line [1]? It won't break any requirement achieved by
>>> substring method.
>>>
>>> [1] - https://github.com/wso2/carbon-deployment/blob/4.7.x/compo
>>> nents/service-mgt/axis2-service-mgt/org.wso2.carbon.service.
>>> mgt/src/main/java/org/wso2/carbon/service/mgt/ServiceAdmin.java#L793
>>>
>>> Regards,
>>> Vinod
>>>
>>> On Wed, Jan 10, 2018 at 1:59 PM, Thishani Lucas 
>>> wrote:
>>>
 Hi All,

 Please find the link to the relevant code below [1].

 [1] https://github.com/wso2/carbon-deployment/blob/4.7.x/com
 ponents/service-mgt/axis2-service-mgt/org.wso2.carbon.servic
 e.mgt/src/main/java/org/wso2/carbon/service/mgt/ServiceAdmin.java#L777

 Thanks.

 On Wed, Jan 10, 2018 at 1:26 PM, Isuru Udana  wrote:

> Hi Thishani,
>
> Please discuss these type of topics in dev list. And please provide
> links to relevant sources in github as explaining the logics in words is
> not that useful to someone to understand the question.
>
> Thanks.
>
> On Wed, Jan 10, 2018 at 1:12 PM, Thishani Lucas 
> wrote:
>
>>
>>
>> On Wed, Jan 10, 2018 at 12:46 PM, Thishani Lucas 
>> wrote:
>>
>>> Hi All,
>>>
>>> It seems that the deletion of faulty proxy services being not
>>> supported is not because to disallow modifying capp.
>>>
>>> The class ServiceAdmin.java in the package
>>> org.wso2.carbon.service.mgt of carbon deployment, is having a method
>>> 'deleteFaultyServiceGroup'. In that method we're doing a substring of 
>>> the
>>> variable 'repository', which holds the path to the artifacts (eg : "
>>> */home/thishani/wso2ei-6.1.1/repository/deployment/server/*"). But
>>> the substring method is removing the ending slash. Because of this, when
>>> appending the service name that should be undeployed, the file path is
>>> derived as "
>>> */home/thishani/wso2ei-6.1.1/repository/deployment/serverFaultyProxy*".
>>> Since this file does not exist in the system, it's not getting removed 
>>> and
>>> the service is also not getting undeployed.
>>>
>>> Therefore, I'm planning to remove that substring function. But I
>>> want to make sure if there is any reason for doing that substring. Is 
>>> that
>>> needed for any other product's functionality? Other than EI? If so, 
>>> please
>>> let me know, so that I can come up with a different solution.
>>>
>>> Thanks,
>>> Thishani
>>>
>>>
>>>
>>> On Tue, Jan 9, 2018 at 6:12 PM, Thishani Lucas 
>>> wrote:
>>>
 Hi All,

 Currently, deleting faulty proxy services in the EI is not
 possible. This has been reported as an issue in [1]. This might be 
 because
 since we're allowing deployment of proxies through capp and that the
 configurations of the capp should not be modified, the deletion of 
 faulty
 proxy services is not supported. IMO, 

Re: [Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Ruwan Yatawara
I am +1 for the second option of retrieving the image as a binary stream.

Given the fact that images can be of varying sizes (talking about
high-resolution ones, here), and Sidhdhi not having any image processing
capabilities as of this moment, I do not see a clear advantage in using a
SIdhdhi stream for storage and retrieval.

Thanks and Regards,

Ruwan Yatawara

Technical Lead,
WSO2 Inc.

email : ruw...@wso2.com
mobile : +94 77 9110413
http://ruwansrants.blogspot.com/
https://500px.com/ruwan_ace
https://medium.com/@ruwanyatawara


On Tue, Jan 16, 2018 at 10:52 AM, Nuwan Jayawardene  wrote:

> Hi all,
>
> I'm currently working on a project to add image storing and retrieval
> capabilities to the WSO2 IoT Server.
>
> To achieve this I have implemented the following;
> 1) Added a separate DAO Table with a field with LONGBLOB data type for
> storing.
> 2) Added storage capabilities in the database for an image sent as a *File
> *in the form of a *BinaryStream*.
>
> As of now, I've written unit tests and the test images are getting stored
> successfully in the database.
>
> The problem lies in how to successfully retrieve the stored data. For
> this, I have come across 2 possible approaches.
> 1) *Retrieve as a File - *The notable downside I realized with this
> solution is that each time a new Image is retrieved, a new file will be
> created. Therefore measures would have to be taken to persist new files
> while purging older obsolete ones.
> 2) *Retrieve as BinaryStream - *Although this requires no persistent
> memory usage and the data will only be retrieved on call and issues may
> come up when representing that data from a UI end. Further analysis is
> required for this approach.
> 3) *Retrieve as FileOutputStream - *This is my preferred method and the
> one recommended mostly in forums and tutorials.
>
> One other approach suggested to me was to use a *Siddhi Stream for both
> storage and retrieval* purposes. This would further allow for analytics
> to be performed on the data which not be very much possible with the
> earlier mentioned approaches.
>
> Suggestions and Feedback are appreciated.
> Thanks and regards!
>
> --
> *Nuwan Jayawardene*
> *Software Engineering Intern*
> *WSO2, Inc.:http://wso2.com *
> *lean.enterprise.middleware*
> *Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*
>
>
>- *Linkedin* *:- **https://www.linkedin.com/in/nuwa
>**njaya/
>*
>- * *
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] Open API 3.0 support for API Publisher Resource definition UI

2018-01-15 Thread Thilini Shanika
Hi Malintha,

>From what I understood from above, OpenAPI 3.0.0 is supporting specifying
different response/request schemas based on the media type. In swagger 2.0
we could define only one schema for request/response which is common for
the specified produces and consumes elements under resources section. Is my
understanding correct?

Yes, we can define different schemas of responses and requests based on the
content type.

eg: Responses

  responses:
'200':
  description: OK
  content:
application/xml:
  schema:
type: array
items:
  type: string
application/json:
  schema:
type: array
items:
  type: string



eg: RequestBody

 requestBody:
content:
  application/json:
schema:
  type: object
  properties:
payload:
  type: string
  application/xml:
schema:
  type: object
  properties:
payload:
  type: string
description: Request Body


If that so, if we are changing the UI based on swagger version, do we also
support specifying different response/request schemas based on the media
type?

Since we have been providing the functionality of defining body and
formData parameters in APIM 2.1.0, we have to at least support requestBody
definitions in APIM 2.2.0 UI. Since we haven't supported responses
definitions for Swagger 2.0, we can omit this functionality for OpenAPI
3.0.0 also, but if we are planning to add this as a new improvement, we
have to implement this for both versions. Or else, we can allow the users
to continue with complex definitions via embedded Swagger editor.





On Tue, Jan 16, 2018 at 11:06 AM, Malintha Amarasinghe 
wrote:

> Hi Thilini,
>
> From what I understood from above, OpenAPI 3.0.0 is supporting specifying
> different response/request schemas based on the media type. In swagger 2.0
> we could define only one schema for request/response which is common for
> the specified produces and consumes elements under resources section. Is my
> understanding correct?
>
> If that so, if we are changing the UI based on swagger version, do we also
> support specifying different response/request schemas based on the media
> type?
>
> Thanks!
> Malintha
>
> On Tue, Jan 16, 2018 at 10:54 AM, Thilini Shanika 
> wrote:
>
>> Hi All,
>>
>> We are currently in the process of implementing Open API 3.0 support in
>> API Manager and as per the design discussions, APIM 2.2.0 will be
>> supporting both OpenAPI 3.0.0 and Swagger 2.0 specs. A resource definition
>> of Open API 3.0.0 has some significant differences compared to a resource
>> definition in Swagger 2.0. Following are some of the major differences of
>> Swagger 2.0 and OpenAPI 3.0.0 spec based API resource definition.
>>
>>- '*body*' and '*formData*' parameter types are not available in
>>OpenAPI 3.0.0. Instead, the *requestBody* element has been introduced.
>>- According to Swagger 2.0 spec, one can define a list of MIME types
>>which the API resource can produce and consume. These configs are
>>defines under *consumes *and *produces *elements of the API resource.
>>But this config is no longer available in OpenAPI 3.0.0. Instead, MIME
>>types are defined under *requestBody *and *response *elements.
>>
>> OpenAPI 3.0.0 based resource definition is given below
>>
>> paths:
>>   /testpath:
>> get:
>>   responses:
>> '200':
>>   description: OK
>>   parameters:
>> - name: id
>>   in: query
>>   required: false
>>   schema:
>> type: string
>> post:
>>   responses:
>> '200':
>>   description: OK
>>   content:
>> *application/xml*:
>>   schema:
>> type: array
>> items:
>>   type: string
>>   *requestBody*:
>> content:
>>   *application/json:*
>> schema:
>>   type: object
>>   properties:
>> payload:
>>   type: string
>> description: Request Body
>>
>> If we are implementing support for OpenAPI 3.0.0, we have to do some
>> changes to resource definition UI. (Has to remove consumes: and produces:
>> fields, has to remove body and formData from parameter types. Instead,
>> requestBody configuration functionality should be added). Since we have to
>> support both versions, we have to change the resource definition UI
>> rendering based on the swagger version. Shall we render a different UI with
>> above changes for OpenAPI 3.0.0 based API definitions? WDYT?
>>
>>
>>
>> --
>> Thilini Shanika
>> Senior Software Engineer
>> WSO2, Inc.; http://wso2.com
>> 20, Palmgrove Avenue, Colombo 3
>>
>> 

Re: [Dev] WSO2 Oxygen Tank > Manage endpoint text responses from proxy (Unexpected character 'some_character' code 45 in prolog expected '<')

2018-01-15 Thread Nadeeshaan Gunasinghe
Hi Marco,

According to the description, this what I understood. If the provided
response is a single response, then it is a multipart response as I
understood correctly. If that's the case you need to enable
BinaryRelayBuilder and the ExpandingMessageFormatter for that particular
multipart content type. Please correct me If I'm wrong. And in order to get
an idea about the full response payload can you enable wirelogs and share
the log information? You can enable wirelogs by uncommenting the following
entry in */repository/conf/log4j.properties*

*log4j.logger.org.apache.synapse.transport.http.headers=DEBUG*
*log4j.logger.org.apache.synapse.transport.http.wire=DEBUG*

Cheers,
*Nadeeshaan Gunasinghe*
Senior Software Engineer, WSO2 Inc. http://wso2.com
+94770596754 | nadeesh...@wso2.com | Skype: nadeeshaan.gunasinghe <#>

 

Get your own email signature


On Mon, Jan 15, 2018 at 8:08 PM, Marcos Tarín Esteve <
mta...@alfatecsistemas.es> wrote:

> Hello Nadeeshaan
>
>
>
> I have this simple proxy:
>
>
> http://ws.apache.org/
> ns/synapse" name="WsV2_Based_Proxy" startOnLoad="true"
> statistics="disable" trace="enable" transports="http,https">
> 
> 
>  value="true"/>
>  value="true"/>
>  value="true"/>
> 
> 
> 
> 
> 
> 
> 
>  uri="file:/var/www/html/WsV2.wsdl"/>
> 
> 
> 
> 
>
> The proxy receives this response from endpoint:
>
>
> --urn:uuid:ax7xx36-98xx9-4ex1-bxxc-ax1x8bxc
> Content-Type: text/xml; charset=utf-8
> Content-Transfer-Encoding: 8bit
> Content-ID: 
>
> 
> http://schemas.xmlsoap.org/soap/
> envelope/" xmlns:ns1="https://.es//ws/ws_v2/1.0/infoEnvioV2;>
> 
> 
> xa3x2x8xx7
> 
> 
> 
>
> --urn:uuid:a07xxx6-9xxx9-4xxa1-xx9c-a91dxxbcc
> Content-Type: application/octet-stream; charset=utf-8
> Content-Transfer-Encoding: binary
> Content-ID: 
> http://xx.x.x.xxx/Texto_de_prueba.txt
> --urn:uuid:a07xxx6-9xxx9-4ea1-bxxc-a9xxx0c8bcc-
>
>
>
> You can see that this response that comes with a coded file:
>
>
>
> Content-Type: application/octet-stream; charset=utf-8
> Content-Transfer-Encoding: binary
>
>
>
> The problem is proxy doesn’t return any response to SOAPUI. Also ESB log
> shows this error:
>
>
> TID: [-1234] [] [2017-12-21 17:15:38,305] ERROR
> {org.apache.synapse.transport.passthru.util.RelayUtils} -  Error while
> building Passthrough stream {org.apache.synapse.transport.
> passthru.util.RelayUtils}
> org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException:
> Unexpected character '-' (code 45) in prolog; expected '<'
>
>
>
> I just want to know which wso2 command/s should I add to the proxy
> configuration for bypassing this response so that it can be read by SOAPUI
>
>
>
> Thanks
>
>
>
> Marcos
>
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] Open API 3.0 support for API Publisher Resource definition UI

2018-01-15 Thread Malintha Amarasinghe
Hi Thilini,

>From what I understood from above, OpenAPI 3.0.0 is supporting specifying
different response/request schemas based on the media type. In swagger 2.0
we could define only one schema for request/response which is common for
the specified produces and consumes elements under resources section. Is my
understanding correct?

If that so, if we are changing the UI based on swagger version, do we also
support specifying different response/request schemas based on the media
type?

Thanks!
Malintha

On Tue, Jan 16, 2018 at 10:54 AM, Thilini Shanika  wrote:

> Hi All,
>
> We are currently in the process of implementing Open API 3.0 support in
> API Manager and as per the design discussions, APIM 2.2.0 will be
> supporting both OpenAPI 3.0.0 and Swagger 2.0 specs. A resource definition
> of Open API 3.0.0 has some significant differences compared to a resource
> definition in Swagger 2.0. Following are some of the major differences of
> Swagger 2.0 and OpenAPI 3.0.0 spec based API resource definition.
>
>- '*body*' and '*formData*' parameter types are not available in
>OpenAPI 3.0.0. Instead, the *requestBody* element has been introduced.
>- According to Swagger 2.0 spec, one can define a list of MIME types
>which the API resource can produce and consume. These configs are
>defines under *consumes *and *produces *elements of the API resource.
>But this config is no longer available in OpenAPI 3.0.0. Instead, MIME
>types are defined under *requestBody *and *response *elements.
>
> OpenAPI 3.0.0 based resource definition is given below
>
> paths:
>   /testpath:
> get:
>   responses:
> '200':
>   description: OK
>   parameters:
> - name: id
>   in: query
>   required: false
>   schema:
> type: string
> post:
>   responses:
> '200':
>   description: OK
>   content:
> *application/xml*:
>   schema:
> type: array
> items:
>   type: string
>   *requestBody*:
> content:
>   *application/json:*
> schema:
>   type: object
>   properties:
> payload:
>   type: string
> description: Request Body
>
> If we are implementing support for OpenAPI 3.0.0, we have to do some
> changes to resource definition UI. (Has to remove consumes: and produces:
> fields, has to remove body and formData from parameter types. Instead,
> requestBody configuration functionality should be added). Since we have to
> support both versions, we have to change the resource definition UI
> rendering based on the swagger version. Shall we render a different UI with
> above changes for OpenAPI 3.0.0 based API definitions? WDYT?
>
>
>
> --
> Thilini Shanika
> Senior Software Engineer
> WSO2, Inc.; http://wso2.com
> 20, Palmgrove Avenue, Colombo 3
>
> E-mail: tgtshan...@gmail.com
> o
>



-- 
Malintha Amarasinghe
*WSO2, Inc. - lean | enterprise | middleware*
http://wso2.com/

Mobile : +94 712383306
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [APIM] Open API 3.0 support for API Publisher Resource definition UI

2018-01-15 Thread Thilini Shanika
Hi All,

We are currently in the process of implementing Open API 3.0 support in API
Manager and as per the design discussions, APIM 2.2.0 will be supporting
both OpenAPI 3.0.0 and Swagger 2.0 specs. A resource definition of Open API
3.0.0 has some significant differences compared to a resource definition in
Swagger 2.0. Following are some of the major differences of Swagger 2.0 and
OpenAPI 3.0.0 spec based API resource definition.

   - '*body*' and '*formData*' parameter types are not available in OpenAPI
   3.0.0. Instead, the *requestBody* element has been introduced.
   - According to Swagger 2.0 spec, one can define a list of MIME types
   which the API resource can produce and consume. These configs are
   defines under *consumes *and *produces *elements of the API resource.
   But this config is no longer available in OpenAPI 3.0.0. Instead, MIME
   types are defined under *requestBody *and *response *elements.

OpenAPI 3.0.0 based resource definition is given below

paths:
  /testpath:
get:
  responses:
'200':
  description: OK
  parameters:
- name: id
  in: query
  required: false
  schema:
type: string
post:
  responses:
'200':
  description: OK
  content:
*application/xml*:
  schema:
type: array
items:
  type: string
  *requestBody*:
content:
  *application/json:*
schema:
  type: object
  properties:
payload:
  type: string
description: Request Body

If we are implementing support for OpenAPI 3.0.0, we have to do some
changes to resource definition UI. (Has to remove consumes: and produces:
fields, has to remove body and formData from parameter types. Instead,
requestBody configuration functionality should be added). Since we have to
support both versions, we have to change the resource definition UI
rendering based on the swagger version. Shall we render a different UI with
above changes for OpenAPI 3.0.0 based API definitions? WDYT?



-- 
Thilini Shanika
Senior Software Engineer
WSO2, Inc.; http://wso2.com
20, Palmgrove Avenue, Colombo 3

E-mail: tgtshan...@gmail.com
o
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Image persisting and retrieval mechanism for WSO2 IoT Server

2018-01-15 Thread Nuwan Jayawardene
Hi all,

I'm currently working on a project to add image storing and retrieval
capabilities to the WSO2 IoT Server.

To achieve this I have implemented the following;
1) Added a separate DAO Table with a field with LONGBLOB data type for
storing.
2) Added storage capabilities in the database for an image sent as a *File *in
the form of a *BinaryStream*.

As of now, I've written unit tests and the test images are getting stored
successfully in the database.

The problem lies in how to successfully retrieve the stored data. For this,
I have come across 2 possible approaches.
1) *Retrieve as a File - *The notable downside I realized with this
solution is that each time a new Image is retrieved, a new file will be
created. Therefore measures would have to be taken to persist new files
while purging older obsolete ones.
2) *Retrieve as BinaryStream - *Although this requires no persistent memory
usage and the data will only be retrieved on call and issues may come up
when representing that data from a UI end. Further analysis is required for
this approach.
3) *Retrieve as FileOutputStream - *This is my preferred method and the one
recommended mostly in forums and tutorials.

One other approach suggested to me was to use a *Siddhi Stream for both
storage and retrieval* purposes. This would further allow for analytics to
be performed on the data which not be very much possible with the earlier
mentioned approaches.

Suggestions and Feedback are appreciated.
Thanks and regards!

--
*Nuwan Jayawardene*
*Software Engineering Intern*
*WSO2, Inc.:http://wso2.com *
*lean.enterprise.middleware*
*Mobile  :- +94 71 1813299 <+94%2071%20181%203299>*


   - *Linkedin* *:- **https://www.linkedin.com/in/nuwa
   **njaya/
   *
   - * *
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Heshitha Hettihewa
Hi All,

It seems the sample jar added in the doc has used an older synapse
version(2.1.1-wso2v2) when building. IMO In order to maintain this we have
to update the sample jar with new synapse releases. So IMO its better if we
give only the source build option instead of providing the jar OOB.
Otherwise there is a possibility of getting this error with new synapse
versions. WDYT?

Thanks,
Heshitha.

On Tue, Jan 16, 2018 at 10:36 AM, Godwin Shrimal  wrote:

> Issue resolved once build from source.
>
>
> Thanks
> Godwin
>
> On Tue, Jan 16, 2018 at 11:57 AM, Vinod Kavinda  wrote:
>
>> Hi Godwin,
>> I'm sorry, missed that.
>>
>> Regards,
>> Vinod
>>
>> On Tue, Jan 16, 2018 at 10:24 AM, Godwin Shrimal  wrote:
>>
>>> *org.wso2.handler.SimpleOauthHandler *is for OAuth security and here I
>>> am referring to BasicAuth. So class name in the doc looks correct for me.
>>>
>>> Thanks
>>> Godwin
>>>
>>> On Tue, Jan 16, 2018 at 11:51 AM, Godwin Shrimal 
>>> wrote:
>>>
 Hi Vinod,

 I tried changing handler name and getting the same error. It looks
 something wrong with the jar file when I try the following command gives an
 error as "Error: error reading 
 WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar;
 error in opening zip file". Let me compile the source and try.

 javap -classpath WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar
 org.wso2.handler.SimpleOauthHandler

 Thanks
 Godwin

 On Tue, Jan 16, 2018 at 11:35 AM, Vinod Kavinda  wrote:

> Hi Godwin,
> The jar in the given location has a different name than the doc.
> Please try using the handler name "*org.wso2.handler.SimpleOauthHandler".
> *Let's verify this. Then we need to correct the doc to align with the
> sample. Thanks for reporting.
>
> Regards,
> Vinod
>
> On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal 
> wrote:
>
>> Hi Devs,
>>
>> When we add the BasicAuth handler to API and save it gives following
>> error. (I followed the doc [1] and downloaded the jar file and put into
>> /lib)
>>
>> [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error
>> initializing API handler: org.wso2.rest.BasicAuthHandler
>> java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler
>> cannot be found by synapse-core_2.1.7.wso2v15
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter
>> nal(BundleLoader.java:501)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>> leLoader.java:421)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>> leLoader.java:412)
>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa
>> dClass(DefaultClassLoader.java:107)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>> at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
>> APIFactory.java:161)
>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>> actory.java:103)
>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>> actory.java:53)
>> at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromS
>> tring(RestApiAdmin.java:164)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>> ssorImpl.java:62)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:483)
>> at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RP
>> CUtil.java:212)
>> at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusi
>> nessLogic(RPCMessageReceiver.java:117)
>> at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo
>> keBusinessLogic(AbstractInOutMessageReceiver.java:40)
>> at org.apache.axis2.receivers.AbstractMessageReceiver.receive(A
>> bstractMessageReceiver.java:110)
>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:1
>> 80)
>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>> essMessage(LocalTransportReceiver.java:169)
>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>> essMessage(LocalTransportReceiver.java:82)
>> at org.wso2.carbon.core.transports.local.CarbonLocalTransportSe
>> nder.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
>> at org.apache.axis2.transport.local.LocalTransportSender.invoke
>> (LocalTransportSender.java:77)
>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>> at org.apache.axis2.description.OutInAxisOperationClient.send(O
>> utInAxisOperation.java:430)
>> at 

Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Godwin Shrimal
Issue resolved once build from source.


Thanks
Godwin

On Tue, Jan 16, 2018 at 11:57 AM, Vinod Kavinda  wrote:

> Hi Godwin,
> I'm sorry, missed that.
>
> Regards,
> Vinod
>
> On Tue, Jan 16, 2018 at 10:24 AM, Godwin Shrimal  wrote:
>
>> *org.wso2.handler.SimpleOauthHandler *is for OAuth security and here I
>> am referring to BasicAuth. So class name in the doc looks correct for me.
>>
>> Thanks
>> Godwin
>>
>> On Tue, Jan 16, 2018 at 11:51 AM, Godwin Shrimal  wrote:
>>
>>> Hi Vinod,
>>>
>>> I tried changing handler name and getting the same error. It looks
>>> something wrong with the jar file when I try the following command gives an
>>> error as "Error: error reading WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar;
>>> error in opening zip file". Let me compile the source and try.
>>>
>>> javap -classpath WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar
>>> org.wso2.handler.SimpleOauthHandler
>>>
>>> Thanks
>>> Godwin
>>>
>>> On Tue, Jan 16, 2018 at 11:35 AM, Vinod Kavinda  wrote:
>>>
 Hi Godwin,
 The jar in the given location has a different name than the doc. Please
 try using the handler name "*org.wso2.handler.SimpleOauthHandler". *Let's
 verify this. Then we need to correct the doc to align with the sample.
 Thanks for reporting.

 Regards,
 Vinod

 On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal 
 wrote:

> Hi Devs,
>
> When we add the BasicAuth handler to API and save it gives following
> error. (I followed the doc [1] and downloaded the jar file and put into
> /lib)
>
> [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error
> initializing API handler: org.wso2.rest.BasicAuthHandler
> java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler
> cannot be found by synapse-core_2.1.7.wso2v15
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter
> nal(BundleLoader.java:501)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
> leLoader.java:421)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
> leLoader.java:412)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa
> dClass(DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
> APIFactory.java:161)
> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
> actory.java:103)
> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
> actory.java:53)
> at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromS
> tring(RestApiAdmin.java:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
> ssorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
> thodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:483)
> at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RP
> CUtil.java:212)
> at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusi
> nessLogic(RPCMessageReceiver.java:117)
> at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo
> keBusinessLogic(AbstractInOutMessageReceiver.java:40)
> at org.apache.axis2.receivers.AbstractMessageReceiver.receive(A
> bstractMessageReceiver.java:110)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
> essMessage(LocalTransportReceiver.java:169)
> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
> essMessage(LocalTransportReceiver.java:82)
> at org.wso2.carbon.core.transports.local.CarbonLocalTransportSe
> nder.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
> at org.apache.axis2.transport.local.LocalTransportSender.invoke
> (LocalTransportSender.java:77)
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
> at org.apache.axis2.description.OutInAxisOperationClient.send(O
> utInAxisOperation.java:430)
> at org.apache.axis2.description.OutInAxisOperationClient.execut
> eImpl(OutInAxisOperation.java:225)
> at org.apache.axis2.client.OperationClient.execute(OperationCli
> ent.java:149)
> at org.wso2.carbon.rest.api.stub.RestApiAdminStub.updateApiFrom
> String(RestApiAdminStub.java:4280)
> at org.wso2.carbon.rest.api.ui.client.RestApiAdminClient.update
> ApiFromString(RestApiAdminClient.java:226)
> at org.apache.jsp.api.savesource_002dajaxprocessor_jsp._jspServ
> ice(savesource_002dajaxprocessor_jsp.java:177)
> at 

Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Vinod Kavinda
Hi Godwin,
I'm sorry, missed that.

Regards,
Vinod

On Tue, Jan 16, 2018 at 10:24 AM, Godwin Shrimal  wrote:

> *org.wso2.handler.SimpleOauthHandler *is for OAuth security and here I am
> referring to BasicAuth. So class name in the doc looks correct for me.
>
> Thanks
> Godwin
>
> On Tue, Jan 16, 2018 at 11:51 AM, Godwin Shrimal  wrote:
>
>> Hi Vinod,
>>
>> I tried changing handler name and getting the same error. It looks
>> something wrong with the jar file when I try the following command gives an
>> error as "Error: error reading WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar;
>> error in opening zip file". Let me compile the source and try.
>>
>> javap -classpath WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar
>> org.wso2.handler.SimpleOauthHandler
>>
>> Thanks
>> Godwin
>>
>> On Tue, Jan 16, 2018 at 11:35 AM, Vinod Kavinda  wrote:
>>
>>> Hi Godwin,
>>> The jar in the given location has a different name than the doc. Please
>>> try using the handler name "*org.wso2.handler.SimpleOauthHandler". *Let's
>>> verify this. Then we need to correct the doc to align with the sample.
>>> Thanks for reporting.
>>>
>>> Regards,
>>> Vinod
>>>
>>> On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal  wrote:
>>>
 Hi Devs,

 When we add the BasicAuth handler to API and save it gives following
 error. (I followed the doc [1] and downloaded the jar file and put into
 /lib)

 [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error
 initializing API handler: org.wso2.rest.BasicAuthHandler
 java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler
 cannot be found by synapse-core_2.1.7.wso2v15
 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter
 nal(BundleLoader.java:501)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
 leLoader.java:421)
 at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
 leLoader.java:412)
 at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa
 dClass(DefaultClassLoader.java:107)
 at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
 APIFactory.java:161)
 at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
 actory.java:103)
 at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
 actory.java:53)
 at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromS
 tring(RestApiAdmin.java:164)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
 ssorImpl.java:62)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
 thodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:483)
 at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RP
 CUtil.java:212)
 at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusi
 nessLogic(RPCMessageReceiver.java:117)
 at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo
 keBusinessLogic(AbstractInOutMessageReceiver.java:40)
 at org.apache.axis2.receivers.AbstractMessageReceiver.receive(A
 bstractMessageReceiver.java:110)
 at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
 at org.apache.axis2.transport.local.LocalTransportReceiver.proc
 essMessage(LocalTransportReceiver.java:169)
 at org.apache.axis2.transport.local.LocalTransportReceiver.proc
 essMessage(LocalTransportReceiver.java:82)
 at org.wso2.carbon.core.transports.local.CarbonLocalTransportSe
 nder.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
 at org.apache.axis2.transport.local.LocalTransportSender.invoke
 (LocalTransportSender.java:77)
 at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
 at org.apache.axis2.description.OutInAxisOperationClient.send(O
 utInAxisOperation.java:430)
 at org.apache.axis2.description.OutInAxisOperationClient.execut
 eImpl(OutInAxisOperation.java:225)
 at org.apache.axis2.client.OperationClient.execute(OperationCli
 ent.java:149)
 at org.wso2.carbon.rest.api.stub.RestApiAdminStub.updateApiFrom
 String(RestApiAdminStub.java:4280)
 at org.wso2.carbon.rest.api.ui.client.RestApiAdminClient.update
 ApiFromString(RestApiAdminClient.java:226)
 at org.apache.jsp.api.savesource_002dajaxprocessor_jsp._jspServ
 ice(savesource_002dajaxprocessor_jsp.java:177)
 at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja
 va:70)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
 at org.apache.jasper.servlet.JspServletWrapper.service(JspServl
 etWrapper.java:439)
 at 

Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Godwin Shrimal
*org.wso2.handler.SimpleOauthHandler *is for OAuth security and here I am
referring to BasicAuth. So class name in the doc looks correct for me.

Thanks
Godwin

On Tue, Jan 16, 2018 at 11:51 AM, Godwin Shrimal  wrote:

> Hi Vinod,
>
> I tried changing handler name and getting the same error. It looks
> something wrong with the jar file when I try the following command gives an
> error as "Error: error reading WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar;
> error in opening zip file". Let me compile the source and try.
>
> javap -classpath WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar
> org.wso2.handler.SimpleOauthHandler
>
> Thanks
> Godwin
>
> On Tue, Jan 16, 2018 at 11:35 AM, Vinod Kavinda  wrote:
>
>> Hi Godwin,
>> The jar in the given location has a different name than the doc. Please
>> try using the handler name "*org.wso2.handler.SimpleOauthHandler". *Let's
>> verify this. Then we need to correct the doc to align with the sample.
>> Thanks for reporting.
>>
>> Regards,
>> Vinod
>>
>> On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal  wrote:
>>
>>> Hi Devs,
>>>
>>> When we add the BasicAuth handler to API and save it gives following
>>> error. (I followed the doc [1] and downloaded the jar file and put into
>>> /lib)
>>>
>>> [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error
>>> initializing API handler: org.wso2.rest.BasicAuthHandler
>>> java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler cannot
>>> be found by synapse-core_2.1.7.wso2v15
>>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter
>>> nal(BundleLoader.java:501)
>>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>>> leLoader.java:421)
>>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>>> leLoader.java:412)
>>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loa
>>> dClass(DefaultClassLoader.java:107)
>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>>> at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
>>> APIFactory.java:161)
>>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>>> actory.java:103)
>>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>>> actory.java:53)
>>> at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromS
>>> tring(RestApiAdmin.java:164)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>>> ssorImpl.java:62)
>>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>>> thodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:483)
>>> at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RP
>>> CUtil.java:212)
>>> at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusi
>>> nessLogic(RPCMessageReceiver.java:117)
>>> at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo
>>> keBusinessLogic(AbstractInOutMessageReceiver.java:40)
>>> at org.apache.axis2.receivers.AbstractMessageReceiver.receive(A
>>> bstractMessageReceiver.java:110)
>>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>>> essMessage(LocalTransportReceiver.java:169)
>>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>>> essMessage(LocalTransportReceiver.java:82)
>>> at org.wso2.carbon.core.transports.local.CarbonLocalTransportSe
>>> nder.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
>>> at org.apache.axis2.transport.local.LocalTransportSender.invoke
>>> (LocalTransportSender.java:77)
>>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>>> at org.apache.axis2.description.OutInAxisOperationClient.send(O
>>> utInAxisOperation.java:430)
>>> at org.apache.axis2.description.OutInAxisOperationClient.execut
>>> eImpl(OutInAxisOperation.java:225)
>>> at org.apache.axis2.client.OperationClient.execute(OperationCli
>>> ent.java:149)
>>> at org.wso2.carbon.rest.api.stub.RestApiAdminStub.updateApiFrom
>>> String(RestApiAdminStub.java:4280)
>>> at org.wso2.carbon.rest.api.ui.client.RestApiAdminClient.update
>>> ApiFromString(RestApiAdminClient.java:226)
>>> at org.apache.jsp.api.savesource_002dajaxprocessor_jsp._jspServ
>>> ice(savesource_002dajaxprocessor_jsp.java:177)
>>> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.ja
>>> va:70)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
>>> at org.apache.jasper.servlet.JspServletWrapper.service(JspServl
>>> etWrapper.java:439)
>>> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl
>>> et.java:395)
>>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
>>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
>>> at 

Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Godwin Shrimal
Hi Vinod,

I tried changing handler name and getting the same error. It looks
something wrong with the jar file when I try the following command gives an
error as "Error: error reading
WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar; error in opening zip file".
Let me compile the source and try.

javap -classpath WSO2-REST-BasicAuth-Handler-1.0-SNAPSHOT.jar
org.wso2.handler.SimpleOauthHandler

Thanks
Godwin

On Tue, Jan 16, 2018 at 11:35 AM, Vinod Kavinda  wrote:

> Hi Godwin,
> The jar in the given location has a different name than the doc. Please
> try using the handler name "*org.wso2.handler.SimpleOauthHandler". *Let's
> verify this. Then we need to correct the doc to align with the sample.
> Thanks for reporting.
>
> Regards,
> Vinod
>
> On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal  wrote:
>
>> Hi Devs,
>>
>> When we add the BasicAuth handler to API and save it gives following
>> error. (I followed the doc [1] and downloaded the jar file and put into
>> /lib)
>>
>> [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error initializing
>> API handler: org.wso2.rest.BasicAuthHandler
>> java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler cannot
>> be found by synapse-core_2.1.7.wso2v15
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInter
>> nal(BundleLoader.java:501)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>> leLoader.java:421)
>> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(Bund
>> leLoader.java:412)
>> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.
>> loadClass(DefaultClassLoader.java:107)
>> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
>> at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
>> APIFactory.java:161)
>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>> actory.java:103)
>> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIF
>> actory.java:53)
>> at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromS
>> tring(RestApiAdmin.java:164)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcce
>> ssorImpl.java:62)
>> at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMe
>> thodAccessorImpl.java:43)
>> at java.lang.reflect.Method.invoke(Method.java:483)
>> at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(
>> RPCUtil.java:212)
>> at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusi
>> nessLogic(RPCMessageReceiver.java:117)
>> at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invo
>> keBusinessLogic(AbstractInOutMessageReceiver.java:40)
>> at org.apache.axis2.receivers.AbstractMessageReceiver.receive(A
>> bstractMessageReceiver.java:110)
>> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>> essMessage(LocalTransportReceiver.java:169)
>> at org.apache.axis2.transport.local.LocalTransportReceiver.proc
>> essMessage(LocalTransportReceiver.java:82)
>> at org.wso2.carbon.core.transports.local.CarbonLocalTransportSe
>> nder.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
>> at org.apache.axis2.transport.local.LocalTransportSender.invoke
>> (LocalTransportSender.java:77)
>> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
>> at org.apache.axis2.description.OutInAxisOperationClient.send(O
>> utInAxisOperation.java:430)
>> at org.apache.axis2.description.OutInAxisOperationClient.execut
>> eImpl(OutInAxisOperation.java:225)
>> at org.apache.axis2.client.OperationClient.execute(OperationCli
>> ent.java:149)
>> at org.wso2.carbon.rest.api.stub.RestApiAdminStub.updateApiFrom
>> String(RestApiAdminStub.java:4280)
>> at org.wso2.carbon.rest.api.ui.client.RestApiAdminClient.update
>> ApiFromString(RestApiAdminClient.java:226)
>> at org.apache.jsp.api.savesource_002dajaxprocessor_jsp._jspServ
>> ice(savesource_002dajaxprocessor_jsp.java:177)
>> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
>> at org.apache.jasper.servlet.JspServletWrapper.service(JspServl
>> etWrapper.java:439)
>> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServl
>> et.java:395)
>> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
>> at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
>> at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.
>> java:80)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
>> at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.se
>> rvice(ContextPathServletAdaptor.java:37)
>> at 

Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Nipuni Bhagya
Hi Rushmin,

Thank you so much for your feedback.



On Tue, Jan 16, 2018 at 9:55 AM, Rushmin Fernando  wrote:

> +1 for this approach Nipuni.
>
> You have nicely solved the dependency problem.
>
> On Tue, Jan 16, 2018 at 9:43 AM, Nipuni Bhagya  wrote:
>
>> Hi Ruwan,
>>
>> Thank you so much for the quick feedback. I sure will add that to the
>> code.
>>
>> Kind regards,
>> Nipuni
>>
>> On Tue, Jan 16, 2018 at 9:33 AM, Ruwan Abeykoon  wrote:
>>
>>> Hi Nipuni,
>>> Excellent !
>>>
>>> You need to exit the main with non zero exit codes when there is an
>>> error.
>>>
>>> e.g.
>>> }catch (SAXParseException err) {
>>> System.out.println ("** Parsing error" + ", line "
>>> + err.getLineNumber () + ", uri " + err.getSystemId ());
>>> System.out.println(" " + err.getMessage ());
>>> System.exit(1)
>>> }catch
>>> Cheers,
>>> Ruwan
>>>
>>>
>>> On Tue, Jan 16, 2018 at 9:27 AM, Nipuni Bhagya  wrote:
>>>
 Hi Rushmin,

 Yes, the java program will be executed through the Shell script.

 Please refer the following links to my shell script and the Java file.

 Shell script - 
 *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/sample.sh
 *
 Java file - 
 *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/2/AppId.java
 *

 I would really appreciate if you could correct me if I have made any
 mistakes.

 Thank you

 On Mon, Jan 15, 2018 at 2:56 PM, Rushmin Fernando 
 wrote:

> So, does the shell script talk to a Java program to get this done?
>
> Could you please share the code.
>
> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya 
> wrote:
>
>> Hi all,
>>
>> I have overcome aforementioned problem by implementing my script in
>> such a way that it extracts the value of required XML tag using the Java
>> DOM parser. Since this approach is more straightforward and most
>> importantly doesn't require any extra dependencies, I believe this would 
>> be
>> a more appropriate solution for our requirement.
>>
>> Thank you all for the support.
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> *Best Regards*
>
> *Rushmin Fernando*
> *Technical Lead*
>
> WSO2 Inc.  - Lean . Enterprise . Middleware
>
> mobile : +94775615183
>
>
>


 --



 *Kind Regards,Nipuni Bhagya*

 *Software Engineering Intern*
 *WSO2*



 *Mobile : +94 0779028904 <+94%2077%20767%201807>*

>>>
>>>
>>>
>>> --
>>>
>>> *Ruwan Abeykoon*
>>> *Associate Director/Architect**,*
>>> *WSO2, Inc. http://wso2.com  *
>>> *lean.enterprise.middleware.*
>>>
>>>
>>
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> *Best Regards*
>
> *Rushmin Fernando*
> *Technical Lead*
>
> WSO2 Inc.  - Lean . Enterprise . Middleware
>
> mobile : +94775615183
>
>
>


-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Vinod Kavinda
Hi Godwin,
The jar in the given location has a different name than the doc. Please try
using the handler name "*org.wso2.handler.SimpleOauthHandler". *Let's
verify this. Then we need to correct the doc to align with the sample.
Thanks for reporting.

Regards,
Vinod

On Tue, Jan 16, 2018 at 7:56 AM, Godwin Shrimal  wrote:

> Hi Devs,
>
> When we add the BasicAuth handler to API and save it gives following
> error. (I followed the doc [1] and downloaded the jar file and put into
> /lib)
>
> [2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error initializing
> API handler: org.wso2.rest.BasicAuthHandler
> java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler cannot
> be found by synapse-core_2.1.7.wso2v15
> at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(
> BundleLoader.java:501)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
> BundleLoader.java:421)
> at org.eclipse.osgi.internal.loader.BundleLoader.findClass(
> BundleLoader.java:412)
> at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(
> DefaultClassLoader.java:107)
> at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
> at org.apache.synapse.config.xml.rest.APIFactory.defineHandler(
> APIFactory.java:161)
> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(
> APIFactory.java:103)
> at org.apache.synapse.config.xml.rest.APIFactory.createAPI(
> APIFactory.java:53)
> at org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromString(
> RestApiAdmin.java:164)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(
> NativeMethodAccessorImpl.java:62)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(
> DelegatingMethodAccessorImpl.java:43)
> at java.lang.reflect.Method.invoke(Method.java:483)
> at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.
> java:212)
> at org.apache.axis2.rpc.receivers.RPCMessageReceiver.
> invokeBusinessLogic(RPCMessageReceiver.java:117)
> at org.apache.axis2.receivers.AbstractInOutMessageReceiver.
> invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
> at org.apache.axis2.receivers.AbstractMessageReceiver.receive(
> AbstractMessageReceiver.java:110)
> at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
> at org.apache.axis2.transport.local.LocalTransportReceiver.
> processMessage(LocalTransportReceiver.java:169)
> at org.apache.axis2.transport.local.LocalTransportReceiver.
> processMessage(LocalTransportReceiver.java:82)
> at org.wso2.carbon.core.transports.local.CarbonLocalTransportSender.
> finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
> at org.apache.axis2.transport.local.LocalTransportSender.
> invoke(LocalTransportSender.java:77)
> at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
> at org.apache.axis2.description.OutInAxisOperationClient.send(
> OutInAxisOperation.java:430)
> at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(
> OutInAxisOperation.java:225)
> at org.apache.axis2.client.OperationClient.execute(
> OperationClient.java:149)
> at org.wso2.carbon.rest.api.stub.RestApiAdminStub.updateApiFromString(
> RestApiAdminStub.java:4280)
> at org.wso2.carbon.rest.api.ui.client.RestApiAdminClient.
> updateApiFromString(RestApiAdminClient.java:226)
> at org.apache.jsp.api.savesource_002dajaxprocessor_jsp._
> jspService(savesource_002dajaxprocessor_jsp.java:177)
> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> at org.apache.jasper.servlet.JspServletWrapper.service(
> JspServletWrapper.java:439)
> at org.apache.jasper.servlet.JspServlet.serviceJspFile(
> JspServlet.java:395)
> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
> at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> at org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(
> ContextPathServletAdaptor.java:37)
> at org.eclipse.equinox.http.servlet.internal.
> ServletRegistration.service(ServletRegistration.java:61)
> at org.eclipse.equinox.http.servlet.internal.ProxyServlet.
> processAlias(ProxyServlet.java:128)
> at org.eclipse.equinox.http.servlet.internal.ProxyServlet.
> service(ProxyServlet.java:68)
> at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
> at org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.
> service(DelegationServlet.java:68)
> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:303)
> at 

Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Nipuni Bhagya
Hi Sagara,

I think we can't compare the two and say which one is better. But using the
DOM parser we can solve our main concern, which is having to install a
dependency while the script is running. Since the user will be using the
wso2 IS pack, we can assume that Java will be already installed on user's
machine and therefore no extra installations will be required for
the implementation using the DOM parser. Also, this implementation will be
reusable in anywhere we need to extract a value of an XML tag.

Most importantly in my previous approach, I had to pretty-print the SOAP
response to another file as the grep command couldn't extract the value
from an unformatted file. But using the DOM parser I was able to extract
the value directly from the unformatted file. So I think using the DOM
parser would be a more suitable solution for our requirement.

Thank you


On Mon, Jan 15, 2018 at 2:45 PM, Sagara Gunathunga  wrote:

>
>
> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:
>
>> Hi all,
>>
>> I have overcome aforementioned problem by implementing my script in such
>> a way that it extracts the value of required XML tag using the Java DOM
>> parser. Since this approach is more straightforward and most importantly
>> doesn't require any extra dependencies, I believe this would be a more
>> appropriate solution for our requirement.
>>
>
> Do you think is it better than xmllint, can you explain ?
>
> Thanks !
>
>>
>> Thank you all for the support.
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> Sagara Gunathunga
>
> Director; WSO2, Inc.;  http://wso2.com
> Linkedin; http://www.linkedin.com/in/ssagara
> Blog ;  http://ssagara.blogspot.com
> Mobile : +9471 <+94%2071%20565%209887>2149951
>
>


-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Rushmin Fernando
+1 for this approach Nipuni.

You have nicely solved the dependency problem.

On Tue, Jan 16, 2018 at 9:43 AM, Nipuni Bhagya  wrote:

> Hi Ruwan,
>
> Thank you so much for the quick feedback. I sure will add that to the code.
>
> Kind regards,
> Nipuni
>
> On Tue, Jan 16, 2018 at 9:33 AM, Ruwan Abeykoon  wrote:
>
>> Hi Nipuni,
>> Excellent !
>>
>> You need to exit the main with non zero exit codes when there is an error.
>>
>> e.g.
>> }catch (SAXParseException err) {
>> System.out.println ("** Parsing error" + ", line "
>> + err.getLineNumber () + ", uri " + err.getSystemId ());
>> System.out.println(" " + err.getMessage ());
>> System.exit(1)
>> }catch
>> Cheers,
>> Ruwan
>>
>>
>> On Tue, Jan 16, 2018 at 9:27 AM, Nipuni Bhagya  wrote:
>>
>>> Hi Rushmin,
>>>
>>> Yes, the java program will be executed through the Shell script.
>>>
>>> Please refer the following links to my shell script and the Java file.
>>>
>>> Shell script - 
>>> *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/sample.sh
>>> *
>>> Java file - 
>>> *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/2/AppId.java
>>> *
>>>
>>> I would really appreciate if you could correct me if I have made any
>>> mistakes.
>>>
>>> Thank you
>>>
>>> On Mon, Jan 15, 2018 at 2:56 PM, Rushmin Fernando 
>>> wrote:
>>>
 So, does the shell script talk to a Java program to get this done?

 Could you please share the code.

 On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya 
 wrote:

> Hi all,
>
> I have overcome aforementioned problem by implementing my script in
> such a way that it extracts the value of required XML tag using the Java
> DOM parser. Since this approach is more straightforward and most
> importantly doesn't require any extra dependencies, I believe this would 
> be
> a more appropriate solution for our requirement.
>
> Thank you all for the support.
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



 --
 *Best Regards*

 *Rushmin Fernando*
 *Technical Lead*

 WSO2 Inc.  - Lean . Enterprise . Middleware

 mobile : +94775615183



>>>
>>>
>>> --
>>>
>>>
>>>
>>> *Kind Regards,Nipuni Bhagya*
>>>
>>> *Software Engineering Intern*
>>> *WSO2*
>>>
>>>
>>>
>>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>>
>>
>>
>>
>> --
>>
>> *Ruwan Abeykoon*
>> *Associate Director/Architect**,*
>> *WSO2, Inc. http://wso2.com  *
>> *lean.enterprise.middleware.*
>>
>>
>
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



-- 
*Best Regards*

*Rushmin Fernando*
*Technical Lead*

WSO2 Inc.  - Lean . Enterprise . Middleware

mobile : +94775615183
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Nipuni Bhagya
Hi Ruwan,

Thank you so much for the quick feedback. I sure will add that to the code.

Kind regards,
Nipuni

On Tue, Jan 16, 2018 at 9:33 AM, Ruwan Abeykoon  wrote:

> Hi Nipuni,
> Excellent !
>
> You need to exit the main with non zero exit codes when there is an error.
>
> e.g.
> }catch (SAXParseException err) {
> System.out.println ("** Parsing error" + ", line "
> + err.getLineNumber () + ", uri " + err.getSystemId ());
> System.out.println(" " + err.getMessage ());
> System.exit(1)
> }catch
> Cheers,
> Ruwan
>
>
> On Tue, Jan 16, 2018 at 9:27 AM, Nipuni Bhagya  wrote:
>
>> Hi Rushmin,
>>
>> Yes, the java program will be executed through the Shell script.
>>
>> Please refer the following links to my shell script and the Java file.
>>
>> Shell script - 
>> *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/sample.sh
>> *
>> Java file - 
>> *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/2/AppId.java
>> *
>>
>> I would really appreciate if you could correct me if I have made any
>> mistakes.
>>
>> Thank you
>>
>> On Mon, Jan 15, 2018 at 2:56 PM, Rushmin Fernando 
>> wrote:
>>
>>> So, does the shell script talk to a Java program to get this done?
>>>
>>> Could you please share the code.
>>>
>>> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:
>>>
 Hi all,

 I have overcome aforementioned problem by implementing my script in
 such a way that it extracts the value of required XML tag using the Java
 DOM parser. Since this approach is more straightforward and most
 importantly doesn't require any extra dependencies, I believe this would be
 a more appropriate solution for our requirement.

 Thank you all for the support.

 --



 *Kind Regards,Nipuni Bhagya*

 *Software Engineering Intern*
 *WSO2*



 *Mobile : +94 0779028904 <+94%2077%20767%201807>*

>>>
>>>
>>>
>>> --
>>> *Best Regards*
>>>
>>> *Rushmin Fernando*
>>> *Technical Lead*
>>>
>>> WSO2 Inc.  - Lean . Enterprise . Middleware
>>>
>>> mobile : +94775615183
>>>
>>>
>>>
>>
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
>
> *Ruwan Abeykoon*
> *Associate Director/Architect**,*
> *WSO2, Inc. http://wso2.com  *
> *lean.enterprise.middleware.*
>
>


-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Ruwan Abeykoon
Hi Nipuni,
Excellent !

You need to exit the main with non zero exit codes when there is an error.

e.g.
}catch (SAXParseException err) {
System.out.println ("** Parsing error" + ", line "
+ err.getLineNumber () + ", uri " + err.getSystemId ());
System.out.println(" " + err.getMessage ());
System.exit(1)
}catch
Cheers,
Ruwan


On Tue, Jan 16, 2018 at 9:27 AM, Nipuni Bhagya  wrote:

> Hi Rushmin,
>
> Yes, the java program will be executed through the Shell script.
>
> Please refer the following links to my shell script and the Java file.
>
> Shell script - 
> *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/sample.sh
> *
> Java file - 
> *https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/2/AppId.java
> *
>
> I would really appreciate if you could correct me if I have made any
> mistakes.
>
> Thank you
>
> On Mon, Jan 15, 2018 at 2:56 PM, Rushmin Fernando 
> wrote:
>
>> So, does the shell script talk to a Java program to get this done?
>>
>> Could you please share the code.
>>
>> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:
>>
>>> Hi all,
>>>
>>> I have overcome aforementioned problem by implementing my script in such
>>> a way that it extracts the value of required XML tag using the Java DOM
>>> parser. Since this approach is more straightforward and most importantly
>>> doesn't require any extra dependencies, I believe this would be a more
>>> appropriate solution for our requirement.
>>>
>>> Thank you all for the support.
>>>
>>> --
>>>
>>>
>>>
>>> *Kind Regards,Nipuni Bhagya*
>>>
>>> *Software Engineering Intern*
>>> *WSO2*
>>>
>>>
>>>
>>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>>
>>
>>
>>
>> --
>> *Best Regards*
>>
>> *Rushmin Fernando*
>> *Technical Lead*
>>
>> WSO2 Inc.  - Lean . Enterprise . Middleware
>>
>> mobile : +94775615183
>>
>>
>>
>
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



-- 

*Ruwan Abeykoon*
*Associate Director/Architect**,*
*WSO2, Inc. http://wso2.com  *
*lean.enterprise.middleware.*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Nipuni Bhagya
Hi Rushmin,

Yes, the java program will be executed through the Shell script.

Please refer the following links to my shell script and the Java file.

Shell script - 
*https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/sample.sh
*
Java file - 
*https://github.com/NipuniBhagya/QSG-Shell-Scripts/blob/master/2/AppId.java
*

I would really appreciate if you could correct me if I have made any
mistakes.

Thank you

On Mon, Jan 15, 2018 at 2:56 PM, Rushmin Fernando  wrote:

> So, does the shell script talk to a Java program to get this done?
>
> Could you please share the code.
>
> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:
>
>> Hi all,
>>
>> I have overcome aforementioned problem by implementing my script in such
>> a way that it extracts the value of required XML tag using the Java DOM
>> parser. Since this approach is more straightforward and most importantly
>> doesn't require any extra dependencies, I believe this would be a more
>> appropriate solution for our requirement.
>>
>> Thank you all for the support.
>>
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> *Best Regards*
>
> *Rushmin Fernando*
> *Technical Lead*
>
> WSO2 Inc.  - Lean . Enterprise . Middleware
>
> mobile : +94775615183
>
>
>


-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Sagara Gunathunga
On Tue, Jan 16, 2018 at 9:04 AM, Nipuni Bhagya  wrote:

> Hi Sagara,
>
> I think we can't compare the two and say which one is better. But using
> the DOM parser we can solve our main concern, which is having to install a
> dependency while the script is running. Since the user will be using the
> wso2 IS pack, we can assume that Java will be already installed on user's
> machine and therefore no extra installations will be required for
> the implementation using the DOM parser. Also, this implementation will be
> reusable in anywhere we need to extract a value of an XML tag.
>
> Most importantly in my previous approach, I had to pretty-print the SOAP
> response to another file as the grep command couldn't extract the value
> from an unformatted file. But using the DOM parser I was able to extract
> the value directly from the unformatted file. So I think using the DOM
> parser would be a more suitable solution for our requirement.
>

+1 make sense.

Thnaks !

>
> Thank you
>
>
> On Mon, Jan 15, 2018 at 2:45 PM, Sagara Gunathunga 
> wrote:
>
>>
>>
>> On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:
>>
>>> Hi all,
>>>
>>> I have overcome aforementioned problem by implementing my script in such
>>> a way that it extracts the value of required XML tag using the Java DOM
>>> parser. Since this approach is more straightforward and most importantly
>>> doesn't require any extra dependencies, I believe this would be a more
>>> appropriate solution for our requirement.
>>>
>>
>> Do you think is it better than xmllint, can you explain ?
>>
>> Thanks !
>>
>>>
>>> Thank you all for the support.
>>>
>>> --
>>>
>>>
>>>
>>> *Kind Regards,Nipuni Bhagya*
>>>
>>> *Software Engineering Intern*
>>> *WSO2*
>>>
>>>
>>>
>>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>>
>>
>>
>>
>> --
>> Sagara Gunathunga
>>
>> Director; WSO2, Inc.;  http://wso2.com
>> Linkedin; http://www.linkedin.com/in/ssagara
>> Blog ;  http://ssagara.blogspot.com
>> Mobile : +9471 <+94%2071%20565%209887>2149951
>>
>>
>
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



-- 
Sagara Gunathunga

Director; WSO2, Inc.;  http://wso2.com
Linkedin; http://www.linkedin.com/in/ssagara
Blog ;  http://ssagara.blogspot.com
Mobile : +9471 <+94%2071%20565%209887>2149951
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] [EI] Securing API using Basic Auth Handler

2018-01-15 Thread Godwin Shrimal
Hi Devs,

When we add the BasicAuth handler to API and save it gives following error.
(I followed the doc [1] and downloaded the jar file and put into
/lib)

[2018-01-16 09:24:57,235] [EI-Core] ERROR - APIFactory Error initializing
API handler: org.wso2.rest.BasicAuthHandler
java.lang.ClassNotFoundException: org.wso2.rest.BasicAuthHandler cannot be
found by synapse-core_2.1.7.wso2v15
at
org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at
org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at
org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at
org.apache.synapse.config.xml.rest.APIFactory.defineHandler(APIFactory.java:161)
at
org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIFactory.java:103)
at
org.apache.synapse.config.xml.rest.APIFactory.createAPI(APIFactory.java:53)
at
org.wso2.carbon.rest.api.service.RestApiAdmin.updateApiFromString(RestApiAdmin.java:164)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:483)
at
org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass(RPCUtil.java:212)
at
org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic(RPCMessageReceiver.java:117)
at
org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic(AbstractInOutMessageReceiver.java:40)
at
org.apache.axis2.receivers.AbstractMessageReceiver.receive(AbstractMessageReceiver.java:110)
at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:180)
at
org.apache.axis2.transport.local.LocalTransportReceiver.processMessage(LocalTransportReceiver.java:169)
at
org.apache.axis2.transport.local.LocalTransportReceiver.processMessage(LocalTransportReceiver.java:82)
at
org.wso2.carbon.core.transports.local.CarbonLocalTransportSender.finalizeSendWithToAddress(CarbonLocalTransportSender.java:45)
at
org.apache.axis2.transport.local.LocalTransportSender.invoke(LocalTransportSender.java:77)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:442)
at
org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:430)
at
org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at
org.apache.axis2.client.OperationClient.execute(OperationClient.java:149)
at
org.wso2.carbon.rest.api.stub.RestApiAdminStub.updateApiFromString(RestApiAdminStub.java:4280)
at
org.wso2.carbon.rest.api.ui.client.RestApiAdminClient.updateApiFromString(RestApiAdminClient.java:226)
at
org.apache.jsp.api.savesource_002dajaxprocessor_jsp._jspService(savesource_002dajaxprocessor_jsp.java:177)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:439)
at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:395)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at org.wso2.carbon.ui.JspServlet.service(JspServlet.java:155)
at org.wso2.carbon.ui.TilesJspServlet.service(TilesJspServlet.java:80)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at
org.eclipse.equinox.http.helper.ContextPathServletAdaptor.service(ContextPathServletAdaptor.java:37)
at
org.eclipse.equinox.http.servlet.internal.ServletRegistration.service(ServletRegistration.java:61)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.processAlias(ProxyServlet.java:128)
at
org.eclipse.equinox.http.servlet.internal.ProxyServlet.service(ProxyServlet.java:68)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:731)
at
org.wso2.carbon.tomcat.ext.servlet.DelegationServlet.service(DelegationServlet.java:68)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at
org.wso2.carbon.ui.filters.cache.URLBasedCachePreventionFilter.doFilter(URLBasedCachePreventionFilter.java:57)
at

[Dev] IE - Information about what proxy services are being executed

2018-01-15 Thread Norberto Fernandes
Hi Devs,

I am trying to create a service that provides information about what is 
currently on execution on the WSO2 Integrator.
Do you know if there is any API or service that provides information about what 
proxy-services are currently being executed? Or how many threads are executing 
a proxy service? 

Cheers,
Norberto
 
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] CAS dropin and expired sessionDataKey 500 error

2018-01-15 Thread John Wynstra
We are seeing 500 server error when the an expired sessionDataKey comes back in 
the following format.

[wso2identityserver5.3.0]/cas/login?sessionDataKey=1d6f6984-43a2-4cd8-880b-dfc92e881743

We are using org.wso2.carbon.extension.identity.sso.cas-1.0.4 as a dropin to 
accommodate some legacy apps. The issue does not happen with our SAML service 
providers.

I would expect to be redirected to fresh login page rather than have the server 
choke on the request.  Please advise if there is a work around or any tips to 
troubleshoot this to get at the root cause and solve it.

---
John Wynstra
Database Administrator
Dordt College
Sioux Center, IA 51250
Email: john.wyns...@dordt.edu
Phone: 712.722.6065
---

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Defining a constant json in a property(variable).

2018-01-15 Thread Vinod Kavinda
Hi Aditya,
Since the JSON string is a constant, you can directly set it as the text of
a property mediator. Please refer below property mediator. You need to
properly escape the characters.




Regards,
Vinod

On Mon, Jan 15, 2018 at 3:51 PM, aditya shivankar <
shivankar.adit...@gmail.com> wrote:

> Respected sir,
>
> I want to assign a constant json to property without distrubing my payload
> how could I do this.
> So I cannot use payload factory to generate json as it will vanish my
> payload.
>
> I could achieve this by
> 1. assign payload to a property1
> 2. create new json in payload factory
> 3. assign new payload to property 2
> 4. assign old payload in property1 to current payload.
>
> But is there a direct way ?
>
> Could I do this without using payload factory.
>
> example of canstant json
> {
> "Items": {
> "Book": {
> "Type": "System.Int32"
> },
> "Pencil": {
> "Type": "System.Int32",
> "Value": "10",
> "Original": "10"
> },
> "Table": {
> "Type": "System.Int32",
> "Value": "110",
> "Original": "110"
> }
> }
> }
>
> I want to create a property  in between the flow , with a initial value as
> above json like this.
>
>
> With Regards,
> Aditya
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
Vinod Kavinda
Senior Software Engineer
*WSO2 Inc. - lean . enterprise . middleware .*
Mobile : +94 (0) 712 415544
Blog : http://soatechflicks.blogspot.com/
[image: http://wso2.com/signature]

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] WSO2 Oxygen Tank > Manage endpoint text responses from proxy (Unexpected character 'some_character' code 45 in prolog expected '<')

2018-01-15 Thread Marcos Tarín Esteve
Hello Nadeeshaan

I have this simple proxy:

http://ws.apache.org/ns/synapse; 
name="WsV2_Based_Proxy" startOnLoad="true" statistics="disable" 
trace="enable" transports="http,https">


















The proxy receives this response from endpoint:

--urn:uuid:ax7xx36-98xx9-4ex1-bxxc-ax1x8bxc
Content-Type: text/xml; charset=utf-8
Content-Transfer-Encoding: 8bit
Content-ID: 


http://schemas.xmlsoap.org/soap/envelope/;
 
xmlns:ns1="https://.es//ws/ws_v2/1.0/infoEnvioV2;>


xa3x2x8xx7




--urn:uuid:a07xxx6-9xxx9-4xxa1-xx9c-a91dxxbcc
Content-Type: application/octet-stream; charset=utf-8
Content-Transfer-Encoding: binary
Content-ID: 
http://xx.x.x.xxx/Texto_de_prueba.txt
--urn:uuid:a07xxx6-9xxx9-4ea1-bxxc-a9xxx0c8bcc-

You can see that this response that comes with a coded file:

Content-Type: application/octet-stream; charset=utf-8
Content-Transfer-Encoding: binary

The problem is proxy doesn’t return any response to SOAPUI. Also ESB log shows 
this error:

TID: [-1234] [] [2017-12-21 17:15:38,305] ERROR 
{org.apache.synapse.transport.passthru.util.RelayUtils} -  Error while building 
Passthrough stream {org.apache.synapse.transport.passthru.util.RelayUtils}
org.apache.axiom.om.OMException: com.ctc.wstx.exc.WstxUnexpectedCharException: 
Unexpected character '-' (code 45) in prolog; expected '<'

I just want to know which wso2 command/s should I add to the proxy 
configuration for bypassing this response so that it can be read by SOAPUI

Thanks

Marcos

___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] GReg530: Governance REST API: Adding Associations to an Asset

2018-01-15 Thread Prasanna Dangalla
Hi Saneth,

We only have {mediaType}/{id}/associations for GET associations.

POST is not implemented in current governance REST API[1] which uses asset
ID's to add Associations.

[1] -
https://github.com/wso2/carbon-governance/blob/master/components/governance/org.wso2.carbon.governance.rest.api/src/main/java/org/wso2/carbon/governance/rest/api/Asset.java#L400

Thanks
Prasanna

*Prasanna Dangalla*
Senior Software Engineer, WSO2, Inc.; http://wso2.com/
lean.enterprise.middleware


*cell: +94 718 11 27 51*
*twitter: @prasa77*

On Mon, Jan 15, 2018 at 3:31 PM, Saneth Dharmakeerthi 
wrote:

> Hi Rajith,
>
> For  Registry API we need to use the registry path; but is there a way to
> create an association using asset ids of two assets?
>
> Thanks and Best Regards,
>
> Saneth Dharmakeerthi
> *Associate Technical Lead*
> WSO2, Inc.
> Mobile: +94772325511 <+94%2077%20232%205511>
>
> 
>
> On Fri, Jan 12, 2018 at 6:02 PM, Saneth Dharmakeerthi 
> wrote:
>
>> Thanks Rajith for the information.
>>
>> Thanks and Best Regards,
>>
>> Saneth Dharmakeerthi
>> *Associate Technical Lead*
>> WSO2, Inc.
>> Mobile: +94772325511 <+94%2077%20232%205511>
>>
>> 
>>
>> On Fri, Jan 12, 2018 at 3:27 PM, Rajith Roshan  wrote:
>>
>>> Hi Saneth,
>>>
>>> Can you try this with the Registry Rest API[1]
>>>
>>> [1] - https://docs.wso2.com/display/Governance530/Associations+w
>>> ith+REST+API
>>>
>>>
>>> Thanks!
>>> Rajith
>>>
>>> On Fri, Jan 12, 2018 at 3:19 PM, Saneth Dharmakeerthi 
>>> wrote:
>>>
 Hi,

 Is there a way that I can create an association among 2 assets
 using  Governance REST API?

 Thanks and Best Regards,

 Saneth Dharmakeerthi
 *Associate Technical Lead*
 WSO2, Inc.
 Mobile: +94772325511 <+94%2077%20232%205511>

 

>>>
>>>
>>>
>>> --
>>> Rajith Roshan
>>> Senior Software Engineer, WSO2 Inc.
>>> Mobile: +94-7 <%2B94-71-554-8430>17-064-214
>>>
>>
>>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [MSF4J] Running multiple MicroserviceRunners in a single JVM.

2018-01-15 Thread Afkham Azeez
Oh :) Please make sure that you always use the latest MSF4J version.

On Mon, Jan 15, 2018 at 3:34 PM, Irshad Nilam  wrote:

> Hi Azeez
>
> The code you shared does not work as expected in MSF4J 2.0.0. This is an
> issue in MSF4J 2.0.0. [1]
>
> I was using MSF4J 2.0.0 version for my initial implementation.
>
> It is working fine with the latest version.
>
> Thanks
>
> https://github.com/wso2/msf4j/issues/483
>
> On Wed, Jan 10, 2018 at 9:57 AM, Irshad Nilam  wrote:
>
>> Hi Azeez and Thusitha,
>>
>> I must have had problems because of starting separate threads. Thanks for
>> pointing that out, I'll follow this approach and will update this thread.
>>
>> Thanks and Regards.
>>
>> On Wed, Jan 10, 2018 at 1:27 AM, Thusitha Thilina Dayaratne <
>> thusithathil...@gmail.com> wrote:
>>
>>> Hi Irshad,
>>>
>>> As Azeez mentioned this should work out of the box. We are doing same
>>> thing in our test cases as well[1]. You don't have to create a separate
>>> thread since MicroserveRunner internals will do that for you.
>>>
>>> [1] - https://github.com/wso2/msf4j/blob/master/core/src/test/java
>>> /org/wso2/msf4j/HttpServerTest.java#L125
>>>
>>> Thanks
>>> Thusitha
>>>
>>> On Tue, Jan 9, 2018 at 8:40 PM, Afkham Azeez  wrote:
>>>
 I tried the following and things worked as expected.

 @Path("/hello")
 public class HelloService {

 private String id;

 public HelloService(String id) {
 this.id = id;
 }

 @GET
 @Path("/{name}")
 public String hello(@PathParam("name") String name) {
 System.out.println("Hello");
 return "Hello " + name + " from " + id;
 }
 }

 -

 public class Application {
 public static void main(String[] args) {
 new MicroservicesRunner(8080)
 .deploy(new HelloService("1"))
 .start();
 new MicroservicesRunner(8081)
 .deploy(new HelloService("2"))
 .start();
 new MicroservicesRunner(8082)
 .deploy(new HelloService("3"))
 .start();
 new MicroservicesRunner(8083)
 .deploy(new HelloService("4"))
 .start();
}
 }
 ---

 Is that not working for you as expected?

 On Tue, Jan 9, 2018 at 12:26 PM, Irshad Nilam  wrote:

> Hi all,
>
> I am working on integration test for 4 microservices written in MSF4J.
>
> 1 - A Microservice
> 2 - B Microservice
> 3 - C Microservice
> 4 - D Microservice
>
> These are implemented in a way to deploy them separately.
>
> Application code (where we deploy the microservice using microservice
> runner) will look similar to this.
>
>
> public class Application {
>
>
> public static void main(String[] args) {
>
> Application application = new Application();
> application.runMS(8081);
>
> }
>
> public void runMS(int port) {
>
> MicroservicesRunner msRunner = new MicroservicesRunner(port);
>
> msRunner.deploy(new AService())
>
> .addExceptionMapper(
> new AKeyExceptionMapper(),
> new AExceptionMapper(),
> new NotFoundExceptionMapper())
> .start();
>
> }
> }
>
>
> For the integration test, I want to start these four microservices
> with the exception mappers. To achieve this, I tried to start this
> microservice in separate threads as bellow. (in TestNG Suite)
>
> //Run A microservice
> new Thread(() -> new pathtoA.Application().runMS(8081)).start();
>
> //Run B microservice
> new Thread(() -> new pathtoB.Application().runMs(8082)).start();
>
> //Run C microservice
> new Thread(() -> new pathtoC.Application().runMs(8083)).start();
>
> //Run D microservice
> new Thread(() -> new pathtoD.Application().runMs(8084)).start();
>
>
> *But I'm having a problem wherein all the four ports, only DService is
> getting deployed.   AFAIU this is because having multiple *
> org.wso2.msf4j.MicroserviceRunner* classes in the same JVM and only
> one getting loaded. *
>
> *I have a requirement where I need to run all 4 microservice in one
> JVM because of resource issues. ** Is there a way to achieve this
> without going to separate JVM for each service?*
>
>
> Please note those Exception mappers belong to each of the microservice
> packages. And should also be tested with integration test. So that I 
> cannot
> run these service like this.
>
> MicroservicesRunner msRunner = new 

[Dev] Defining a constant json in a property(variable).

2018-01-15 Thread aditya shivankar
Respected sir,

I want to assign a constant json to property without distrubing my payload
how could I do this.
So I cannot use payload factory to generate json as it will vanish my
payload.

I could achieve this by
1. assign payload to a property1
2. create new json in payload factory
3. assign new payload to property 2
4. assign old payload in property1 to current payload.

But is there a direct way ?

Could I do this without using payload factory.

example of canstant json
{
"Items": {
"Book": {
"Type": "System.Int32"
},
"Pencil": {
"Type": "System.Int32",
"Value": "10",
"Original": "10"
},
"Table": {
"Type": "System.Int32",
"Value": "110",
"Original": "110"
}
}
}

I want to create a property  in between the flow , with a initial value as
above json like this.


With Regards,
Aditya
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [MSF4J] Running multiple MicroserviceRunners in a single JVM.

2018-01-15 Thread Irshad Nilam
Hi Azeez

The code you shared does not work as expected in MSF4J 2.0.0. This is an
issue in MSF4J 2.0.0. [1]

I was using MSF4J 2.0.0 version for my initial implementation.

It is working fine with the latest version.

Thanks

https://github.com/wso2/msf4j/issues/483

On Wed, Jan 10, 2018 at 9:57 AM, Irshad Nilam  wrote:

> Hi Azeez and Thusitha,
>
> I must have had problems because of starting separate threads. Thanks for
> pointing that out, I'll follow this approach and will update this thread.
>
> Thanks and Regards.
>
> On Wed, Jan 10, 2018 at 1:27 AM, Thusitha Thilina Dayaratne <
> thusithathil...@gmail.com> wrote:
>
>> Hi Irshad,
>>
>> As Azeez mentioned this should work out of the box. We are doing same
>> thing in our test cases as well[1]. You don't have to create a separate
>> thread since MicroserveRunner internals will do that for you.
>>
>> [1] - https://github.com/wso2/msf4j/blob/master/core/src/test/java
>> /org/wso2/msf4j/HttpServerTest.java#L125
>>
>> Thanks
>> Thusitha
>>
>> On Tue, Jan 9, 2018 at 8:40 PM, Afkham Azeez  wrote:
>>
>>> I tried the following and things worked as expected.
>>>
>>> @Path("/hello")
>>> public class HelloService {
>>>
>>> private String id;
>>>
>>> public HelloService(String id) {
>>> this.id = id;
>>> }
>>>
>>> @GET
>>> @Path("/{name}")
>>> public String hello(@PathParam("name") String name) {
>>> System.out.println("Hello");
>>> return "Hello " + name + " from " + id;
>>> }
>>> }
>>>
>>> -
>>>
>>> public class Application {
>>> public static void main(String[] args) {
>>> new MicroservicesRunner(8080)
>>> .deploy(new HelloService("1"))
>>> .start();
>>> new MicroservicesRunner(8081)
>>> .deploy(new HelloService("2"))
>>> .start();
>>> new MicroservicesRunner(8082)
>>> .deploy(new HelloService("3"))
>>> .start();
>>> new MicroservicesRunner(8083)
>>> .deploy(new HelloService("4"))
>>> .start();
>>>}
>>> }
>>> ---
>>>
>>> Is that not working for you as expected?
>>>
>>> On Tue, Jan 9, 2018 at 12:26 PM, Irshad Nilam  wrote:
>>>
 Hi all,

 I am working on integration test for 4 microservices written in MSF4J.

 1 - A Microservice
 2 - B Microservice
 3 - C Microservice
 4 - D Microservice

 These are implemented in a way to deploy them separately.

 Application code (where we deploy the microservice using microservice
 runner) will look similar to this.


 public class Application {


 public static void main(String[] args) {

 Application application = new Application();
 application.runMS(8081);

 }

 public void runMS(int port) {

 MicroservicesRunner msRunner = new MicroservicesRunner(port);

 msRunner.deploy(new AService())

 .addExceptionMapper(
 new AKeyExceptionMapper(),
 new AExceptionMapper(),
 new NotFoundExceptionMapper())
 .start();

 }
 }


 For the integration test, I want to start these four microservices with
 the exception mappers. To achieve this, I tried to start this microservice
 in separate threads as bellow. (in TestNG Suite)

 //Run A microservice
 new Thread(() -> new pathtoA.Application().runMS(8081)).start();

 //Run B microservice
 new Thread(() -> new pathtoB.Application().runMs(8082)).start();

 //Run C microservice
 new Thread(() -> new pathtoC.Application().runMs(8083)).start();

 //Run D microservice
 new Thread(() -> new pathtoD.Application().runMs(8084)).start();


 *But I'm having a problem wherein all the four ports, only DService is
 getting deployed.   AFAIU this is because having multiple *
 org.wso2.msf4j.MicroserviceRunner* classes in the same JVM and only
 one getting loaded. *

 *I have a requirement where I need to run all 4 microservice in one JVM
 because of resource issues. ** Is there a way to achieve this without
 going to separate JVM for each service?*


 Please note those Exception mappers belong to each of the microservice
 packages. And should also be tested with integration test. So that I cannot
 run these service like this.

 MicroservicesRunner msRunner = new MicroservicesRunner(port1,port2, port3);
 microservicesRunner.deploy(serviceA, serviceB, 
 serivice3).addExceptionMapper(Amapper, Bmapper, cMapper).start();


 Thanks and regards.
 --
 Irshad Nilam
 Software Engineering Intern
 WSO2

 Email  : irsh...@wso2.com
 Mobile :  +94 77 3669262 

Re: [Dev] GReg530: Governance REST API: Adding Associations to an Asset

2018-01-15 Thread Saneth Dharmakeerthi
Hi Rajith,

For  Registry API we need to use the registry path; but is there a way to
create an association using asset ids of two assets?

Thanks and Best Regards,

Saneth Dharmakeerthi
*Associate Technical Lead*
WSO2, Inc.
Mobile: +94772325511



On Fri, Jan 12, 2018 at 6:02 PM, Saneth Dharmakeerthi 
wrote:

> Thanks Rajith for the information.
>
> Thanks and Best Regards,
>
> Saneth Dharmakeerthi
> *Associate Technical Lead*
> WSO2, Inc.
> Mobile: +94772325511 <+94%2077%20232%205511>
>
> 
>
> On Fri, Jan 12, 2018 at 3:27 PM, Rajith Roshan  wrote:
>
>> Hi Saneth,
>>
>> Can you try this with the Registry Rest API[1]
>>
>> [1] - https://docs.wso2.com/display/Governance530/Associations+
>> with+REST+API
>>
>>
>> Thanks!
>> Rajith
>>
>> On Fri, Jan 12, 2018 at 3:19 PM, Saneth Dharmakeerthi 
>> wrote:
>>
>>> Hi,
>>>
>>> Is there a way that I can create an association among 2 assets
>>> using  Governance REST API?
>>>
>>> Thanks and Best Regards,
>>>
>>> Saneth Dharmakeerthi
>>> *Associate Technical Lead*
>>> WSO2, Inc.
>>> Mobile: +94772325511 <+94%2077%20232%205511>
>>>
>>> 
>>>
>>
>>
>>
>> --
>> Rajith Roshan
>> Senior Software Engineer, WSO2 Inc.
>> Mobile: +94-7 <%2B94-71-554-8430>17-064-214
>>
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Rushmin Fernando
So, does the shell script talk to a Java program to get this done?

Could you please share the code.

On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:

> Hi all,
>
> I have overcome aforementioned problem by implementing my script in such a
> way that it extracts the value of required XML tag using the Java DOM
> parser. Since this approach is more straightforward and most importantly
> doesn't require any extra dependencies, I believe this would be a more
> appropriate solution for our requirement.
>
> Thank you all for the support.
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



-- 
*Best Regards*

*Rushmin Fernando*
*Technical Lead*

WSO2 Inc.  - Lean . Enterprise . Middleware

mobile : +94775615183
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Sagara Gunathunga
On Mon, Jan 15, 2018 at 2:43 PM, Nipuni Bhagya  wrote:

> Hi all,
>
> I have overcome aforementioned problem by implementing my script in such a
> way that it extracts the value of required XML tag using the Java DOM
> parser. Since this approach is more straightforward and most importantly
> doesn't require any extra dependencies, I believe this would be a more
> appropriate solution for our requirement.
>

Do you think is it better than xmllint, can you explain ?

Thanks !

>
> Thank you all for the support.
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



-- 
Sagara Gunathunga

Director; WSO2, Inc.;  http://wso2.com
Linkedin; http://www.linkedin.com/in/ssagara
Blog ;  http://ssagara.blogspot.com
Mobile : +9471 <+94%2071%20565%209887>2149951
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Problem with extracting a value in a SOAP response through a shell script

2018-01-15 Thread Nipuni Bhagya
Hi all,

I have overcome aforementioned problem by implementing my script in such a
way that it extracts the value of required XML tag using the Java DOM
parser. Since this approach is more straightforward and most importantly
doesn't require any extra dependencies, I believe this would be a more
appropriate solution for our requirement.

Thank you all for the support.

-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



*Mobile : +94 0779028904 <+94%2077%20767%201807>*
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] [APIM] [Analytics] Can we analyze api invocations against the app language

2018-01-15 Thread Jason De Silva
Hi Praminda,

As I understood even if the client app sends the User-Agent header with the
information of which type of client invoked the API, the
API_REQ_USER_BROW_SUMMARY table currently records only the OS and browser
version. So, still we will need improve that aspect to record the client
type which invoked the API to cater this scenario.

Regards,
Jason

Jason De Silva
*Software Engineer - QA*
Mobile: +94 (0) 772 097 678
Email: jas...@wso2.com
WSO2 Inc. www.wso2.com


On Mon, Jan 15, 2018 at 12:38 PM, Praminda Jayawardana 
wrote:

> Hi Jason,
>
> This is still possible if the client application is configured (or
> implemented) to send the User-Agent header which specify the specific
> client used to invoke the API. If some information regarding who invoked
> the API is not sent by the client, I don't see a clear way to distinguish
> requests among different clients.
>
> Thanks,
> Praminda
>
> On Mon, Jan 15, 2018 at 10:06 AM, Jason De Silva  wrote:
>
>> Hi Rukshan,
>>
>> Thank you for the information. Since it currently shows only the
>> cumulative information of the OAuth app stats, I have created a git issue
>> [1] to consider support different client app specific analytics against
>> a single API. This way we will be able to track different client apps
>> invocations against one single application.
>>
>> [1] https://github.com/wso2/product-apim/issues/2414
>>
>> Regards,
>> Jason
>>
>> Jason De Silva
>> *Software Engineer - QA*
>> Mobile: +94 (0) 772 097 678
>> Email: jas...@wso2.com
>> WSO2 Inc. www.wso2.com
>> 
>>
>> On Fri, Jan 12, 2018 at 8:46 PM, Rukshan Premathunga 
>> wrote:
>>
>>> Hi Jason,
>>>
>>> APIM we have apps related stats. In your case your client app(PHP,
>>> android etc) use the app created using APIM store to invoke exposed APIs
>>> from APIM GW. Then your client application can be represent using oAuth App
>>> you created from store. So in APIM Store, you can see the oAuth app's stat
>>> and which can be used to represent actual client's app stat as well.
>>>
>>> API Usage Across Usage Agent graph, show the stat based on the
>>> User-Agent header. So this is diffrent to what i explain earlier. Anyway
>>> this graph is currently limited to show OS and Browser related stat. So
>>> show stat based on the other attribute in the User-Agent is not possible
>>> ATM.
>>>
>>> Thanks and Regards
>>>
>>>
>>> On Fri, Jan 12, 2018 at 6:15 PM, Jason De Silva  wrote:
>>>
 Hi Fazlan,

 Let me elaborate a bit more, what I basically need is to capture the
 language the API was invoked from e.g PHP app 20 calls, python app 50 calls
 etc. Currently what we provide by enabling analytics is something like
 below which is the OS version the API was called from. Since, we provide
 different SDKs to develop apps wanted to know the possibility of tracking
 the number of requests called via php app, python app etc.


 ​

 Regards,
 Jason

 Jason De Silva
 *Software Engineer - QA*
 Mobile: +94 (0) 772 097 678
 Email: jas...@wso2.com
 WSO2 Inc. www.wso2.com
 

 On Fri, Jan 12, 2018 at 6:04 PM, Fazlan Nazeem 
 wrote:

> Hi Jason,
>
> There is nothing special you have to configure to make this chart
> work. Just enabling analytics will be enough.
>
> On Fri, Jan 12, 2018 at 5:55 PM, Jason De Silva 
> wrote:
>
>> Hi All,
>>
>> In APIM we provide sdk's to develop client apps to consume the apis
>> from a preferred language. Let's assume a scenario where I develop 
>> several
>> apps using php, android, java etc.  which consumes from the same API. In
>> such scenario is there a possibility that I can differentiate the api
>> invocations done app wise to be tracked from analytics. E.g 50 calls
>> via php app, 25 calls via android app etc.?
>>
>> I was going through [1] and I found that we currently capture the
>> "User-Agent" header and save the OS and Browser version in
>> API_REQ_USER_BROW_SUMMARY table and we generate stats to show the browser
>> version under "API Usage Across Usage Agent" in analytics. But I could 
>> not
>> find any info on how to get the above configured. Any input on this is
>> highly appreciated.
>>
>> [1] https://docs.wso2.com/display/AM2xx/Viewing+API+Statisti
>> cs#ViewingAPIStatistics-APIUsageAcrossUserAgent
>>
>> Regards,
>> Jason
>>
>> Jason De Silva
>> *Software Engineer - QA*
>> Mobile: +94 (0) 772 097 678
>> Email: jas...@wso2.com
>> WSO2 Inc. www.wso2.com
>> 
>>
>
>
>
> --
> Thanks & Regards,
>
> *Fazlan Nazeem*
> Senior Software Engineer
> WSO2 Inc
> Mobile : +94772338839