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] 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] 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


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] Problem with extracting a value in a SOAP response through a shell script

2018-01-08 Thread Ruwan Abeykoon
Hi Nipuni,
+1 on asking to install xmlint as pre-requisites.

Please add a check on the shell script and prompt the user to install the
package if the xmlint is not present on the OS.

Cheers,
Ruwan

On Mon, Jan 8, 2018 at 11:50 AM, Nipuni Bhagya  wrote:

> Adding Sagara and Ruwan.
> Can you please share some thoughts on this?
>
> Thanks,
>
> On Sun, Jan 7, 2018 at 1:52 PM, Farasath Ahamed 
> wrote:
>
>>
>>
>> On Sunday, January 7, 2018, Rushmin Fernando  wrote:
>>
>>> IMO we can ask to install xmllint as a pre-requisite.
>>>
>>
>> I too think its fine to install xmllint as a pre-requisite. Otherwise we
>> are overcomplicating our QSG impl by going for complex and error prone
>> alternatives rather than doing it in a straight forward manner using
>> xmllint.
>>
>>>
>>>
>>> Using a regular expression to extract the values from an XML might be
>>> error prone since the regular expression is vulnerable to spaces or lines
>>> breaks which can be added in future releases.
>>>
>>> But xmllint is a proper XML parser. So it will work as long the schema
>>> is the same.
>>>
>>>
>>>
>>
>>> On Sat, Jan 6, 2018 at 8:48 PM, Gayan Gunawardana 
>>> wrote:
>>>
 Please check below approach if it works for your requirement.

 cmd=$(curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -H
 "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction:urn:getApplication"
 -d @get_sp.xml "https://$IP_ADDRESS:$HTTPS_PO
 RT_IS/services/IdentityApplicationManagementService?wsdl")
 cp /dev/null get_sp_reponse.xml
 echo $cmd >> get_sp_reponse.xml
 applicationID=$(grep -oP '(?<=ax2199:applicationID>)[^<]+'
 "get_sp_reponse.xml")
 echo "Service Provider Application ID: $applicationID"

 *get_sp.xml*

 http://schemas.
 xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd;>


   
  
  SERVICE_PROVIDER_NAME>>> Name>
   

 

 On Fri, Jan 5, 2018 at 5:08 PM, Nipuni Bhagya  wrote:

> Hi all,
>
> I'm writing shell scripts for the IAM Quick Start Guide and currently,
> I'm working on the shell script which automates the configuration of SSO
> with SAML2. I have encountered a problem while trying to get the
> application Id of a service provider in order to perform an update
> operation.
>
> The method I'm using to overcome this at the moment is,
>
> 1. I call the getApplication function in the Identity Application
> Management API
> 2. Write the response to a text file.
> 3. Convert that text file into an XML file.
> 4. grep the value of 
>
> But the problem with this approach is that I'm using a tool called 
> xmllint to
> convert the text to XML format. Since xmllint is not a default Unix 
> command
> the users will have to install it on their machines first. As it is not
> appropriate to ask for the user's password while running a script, I can't
> use xmllint and also most of the other approaches available.
>
> So I would really appreciate if someone of you could help me to find a
> better way to achieve this task.
>
> Thank you in advance,
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



 --
 Gayan Gunawardana
 Senior Software Engineer; WSO2 Inc.; http://wso2.com/
 Email: ga...@wso2.com
 Mobile: +94 (71) 8020933

>>>
>>>
>>>
>>> --
>>> *Best Regards*
>>>
>>> *Rushmin Fernando*
>>> *Technical Lead*
>>>
>>> WSO2 Inc.  - Lean . Enterprise . Middleware
>>>
>>> mobile : +94775615183
>>>
>>>
>>>
>>
>> --
>> Farasath Ahamed
>> Senior Software Engineer, WSO2 Inc.; http://wso2.com
>> Mobile: +94777603866
>> Blog: blog.farazath.com
>> Twitter: @farazath619 
>> 
>>
>>
>>
>>
>>
>
>
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>
> *WSO2Con EU 2017  / WSO2 New York Summit 2017
> *
>



-- 

*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-07 Thread Nipuni Bhagya
Adding Sagara and Ruwan.
Can you please share some thoughts on this?

Thanks,

On Sun, Jan 7, 2018 at 1:52 PM, Farasath Ahamed  wrote:

>
>
> On Sunday, January 7, 2018, Rushmin Fernando  wrote:
>
>> IMO we can ask to install xmllint as a pre-requisite.
>>
>
> I too think its fine to install xmllint as a pre-requisite. Otherwise we
> are overcomplicating our QSG impl by going for complex and error prone
> alternatives rather than doing it in a straight forward manner using
> xmllint.
>
>>
>>
>> Using a regular expression to extract the values from an XML might be
>> error prone since the regular expression is vulnerable to spaces or lines
>> breaks which can be added in future releases.
>>
>> But xmllint is a proper XML parser. So it will work as long the schema is
>> the same.
>>
>>
>>
>
>> On Sat, Jan 6, 2018 at 8:48 PM, Gayan Gunawardana  wrote:
>>
>>> Please check below approach if it works for your requirement.
>>>
>>> cmd=$(curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -H
>>> "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction:urn:getApplication"
>>> -d @get_sp.xml "https://$IP_ADDRESS:$HTTPS_PO
>>> RT_IS/services/IdentityApplicationManagementService?wsdl")
>>> cp /dev/null get_sp_reponse.xml
>>> echo $cmd >> get_sp_reponse.xml
>>> applicationID=$(grep -oP '(?<=ax2199:applicationID>)[^<]+'
>>> "get_sp_reponse.xml")
>>> echo "Service Provider Application ID: $applicationID"
>>>
>>> *get_sp.xml*
>>>
>>> http://schemas.
>>> xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd;>
>>>
>>>
>>>   
>>>  
>>>  SERVICE_PROVIDER_NAME>> Name>
>>>   
>>>
>>> 
>>>
>>> On Fri, Jan 5, 2018 at 5:08 PM, Nipuni Bhagya  wrote:
>>>
 Hi all,

 I'm writing shell scripts for the IAM Quick Start Guide and currently,
 I'm working on the shell script which automates the configuration of SSO
 with SAML2. I have encountered a problem while trying to get the
 application Id of a service provider in order to perform an update
 operation.

 The method I'm using to overcome this at the moment is,

 1. I call the getApplication function in the Identity Application
 Management API
 2. Write the response to a text file.
 3. Convert that text file into an XML file.
 4. grep the value of 

 But the problem with this approach is that I'm using a tool called xmllint 
 to
 convert the text to XML format. Since xmllint is not a default Unix command
 the users will have to install it on their machines first. As it is not
 appropriate to ask for the user's password while running a script, I can't
 use xmllint and also most of the other approaches available.

 So I would really appreciate if someone of you could help me to find a
 better way to achieve this task.

 Thank you in advance,
 --



 *Kind Regards,Nipuni Bhagya*

 *Software Engineering Intern*
 *WSO2*



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

>>>
>>>
>>>
>>> --
>>> Gayan Gunawardana
>>> Senior Software Engineer; WSO2 Inc.; http://wso2.com/
>>> Email: ga...@wso2.com
>>> Mobile: +94 (71) 8020933
>>>
>>
>>
>>
>> --
>> *Best Regards*
>>
>> *Rushmin Fernando*
>> *Technical Lead*
>>
>> WSO2 Inc.  - Lean . Enterprise . Middleware
>>
>> mobile : +94775615183
>>
>>
>>
>
> --
> Farasath Ahamed
> Senior Software Engineer, WSO2 Inc.; http://wso2.com
> Mobile: +94777603866
> Blog: blog.farazath.com
> Twitter: @farazath619 
> 
>
>
>
>
>


-- 



*Kind Regards,Nipuni Bhagya*

*Software Engineering Intern*
*WSO2*



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

*WSO2Con EU 2017  / WSO2 New York Summit 2017
*
___
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-07 Thread Farasath Ahamed
On Sunday, January 7, 2018, Rushmin Fernando  wrote:

> IMO we can ask to install xmllint as a pre-requisite.
>

I too think its fine to install xmllint as a pre-requisite. Otherwise we
are overcomplicating our QSG impl by going for complex and error prone
alternatives rather than doing it in a straight forward manner using
xmllint.

>
>
> Using a regular expression to extract the values from an XML might be
> error prone since the regular expression is vulnerable to spaces or lines
> breaks which can be added in future releases.
>
> But xmllint is a proper XML parser. So it will work as long the schema is
> the same.
>
>
>

> On Sat, Jan 6, 2018 at 8:48 PM, Gayan Gunawardana  wrote:
>
>> Please check below approach if it works for your requirement.
>>
>> cmd=$(curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -H
>> "Content-Type: text/xml;charset=UTF-8" -H "SOAPAction:urn:getApplication"
>> -d @get_sp.xml "https://$IP_ADDRESS:$HTTPS_PO
>> RT_IS/services/IdentityApplicationManagementService?wsdl")
>> cp /dev/null get_sp_reponse.xml
>> echo $cmd >> get_sp_reponse.xml
>> applicationID=$(grep -oP '(?<=ax2199:applicationID>)[^<]+'
>> "get_sp_reponse.xml")
>> echo "Service Provider Application ID: $applicationID"
>>
>> *get_sp.xml*
>>
>> http://schemas.
>> xmlsoap.org/soap/envelope/" xmlns:xsd="http://org.apache.axis2/xsd;>
>>
>>
>>   
>>  
>>  SERVICE_PROVIDER_NAME
>>   
>>
>> 
>>
>> On Fri, Jan 5, 2018 at 5:08 PM, Nipuni Bhagya  wrote:
>>
>>> Hi all,
>>>
>>> I'm writing shell scripts for the IAM Quick Start Guide and currently,
>>> I'm working on the shell script which automates the configuration of SSO
>>> with SAML2. I have encountered a problem while trying to get the
>>> application Id of a service provider in order to perform an update
>>> operation.
>>>
>>> The method I'm using to overcome this at the moment is,
>>>
>>> 1. I call the getApplication function in the Identity Application
>>> Management API
>>> 2. Write the response to a text file.
>>> 3. Convert that text file into an XML file.
>>> 4. grep the value of 
>>>
>>> But the problem with this approach is that I'm using a tool called xmllint 
>>> to
>>> convert the text to XML format. Since xmllint is not a default Unix command
>>> the users will have to install it on their machines first. As it is not
>>> appropriate to ask for the user's password while running a script, I can't
>>> use xmllint and also most of the other approaches available.
>>>
>>> So I would really appreciate if someone of you could help me to find a
>>> better way to achieve this task.
>>>
>>> Thank you in advance,
>>> --
>>>
>>>
>>>
>>> *Kind Regards,Nipuni Bhagya*
>>>
>>> *Software Engineering Intern*
>>> *WSO2*
>>>
>>>
>>>
>>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>>
>>
>>
>>
>> --
>> Gayan Gunawardana
>> Senior Software Engineer; WSO2 Inc.; http://wso2.com/
>> Email: ga...@wso2.com
>> Mobile: +94 (71) 8020933
>>
>
>
>
> --
> *Best Regards*
>
> *Rushmin Fernando*
> *Technical Lead*
>
> WSO2 Inc.  - Lean . Enterprise . Middleware
>
> mobile : +94775615183
>
>
>

-- 
Farasath Ahamed
Senior Software Engineer, WSO2 Inc.; http://wso2.com
Mobile: +94777603866
Blog: blog.farazath.com
Twitter: @farazath619 

___
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-06 Thread Rushmin Fernando
IMO we can ask to install xmllint as a pre-requisite.

Using a regular expression to extract the values from an XML might be error
prone since the regular expression is vulnerable to spaces or lines breaks
which can be added in future releases.

But xmllint is a proper XML parser. So it will work as long the schema is
the same.



On Sat, Jan 6, 2018 at 8:48 PM, Gayan Gunawardana  wrote:

> Please check below approach if it works for your requirement.
>
> cmd=$(curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type:
> text/xml;charset=UTF-8" -H "SOAPAction:urn:getApplication" -d @get_sp.xml
> "https://$IP_ADDRESS:$HTTPS_PORT_IS/services/
> IdentityApplicationManagementService?wsdl")
> cp /dev/null get_sp_reponse.xml
> echo $cmd >> get_sp_reponse.xml
> applicationID=$(grep -oP '(?<=ax2199:applicationID>)[^<]+'
> "get_sp_reponse.xml")
> echo "Service Provider Application ID: $applicationID"
>
> *get_sp.xml*
>
> http://schemas.xmlsoap.org/soap/envelope/;
> xmlns:xsd="http://org.apache.axis2/xsd;>
>
>
>   
>  
>  SERVICE_PROVIDER_NAME
>   
>
> 
>
> On Fri, Jan 5, 2018 at 5:08 PM, Nipuni Bhagya  wrote:
>
>> Hi all,
>>
>> I'm writing shell scripts for the IAM Quick Start Guide and currently,
>> I'm working on the shell script which automates the configuration of SSO
>> with SAML2. I have encountered a problem while trying to get the
>> application Id of a service provider in order to perform an update
>> operation.
>>
>> The method I'm using to overcome this at the moment is,
>>
>> 1. I call the getApplication function in the Identity Application
>> Management API
>> 2. Write the response to a text file.
>> 3. Convert that text file into an XML file.
>> 4. grep the value of 
>>
>> But the problem with this approach is that I'm using a tool called xmllint to
>> convert the text to XML format. Since xmllint is not a default Unix command
>> the users will have to install it on their machines first. As it is not
>> appropriate to ask for the user's password while running a script, I can't
>> use xmllint and also most of the other approaches available.
>>
>> So I would really appreciate if someone of you could help me to find a
>> better way to achieve this task.
>>
>> Thank you in advance,
>> --
>>
>>
>>
>> *Kind Regards,Nipuni Bhagya*
>>
>> *Software Engineering Intern*
>> *WSO2*
>>
>>
>>
>> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>>
>
>
>
> --
> Gayan Gunawardana
> Senior Software Engineer; WSO2 Inc.; http://wso2.com/
> Email: ga...@wso2.com
> Mobile: +94 (71) 8020933
>



-- 
*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-06 Thread Gayan Gunawardana
Please check below approach if it works for your requirement.

cmd=$(curl -k -H "Authorization: Basic YWRtaW46YWRtaW4=" -H "Content-Type:
text/xml;charset=UTF-8" -H "SOAPAction:urn:getApplication" -d @get_sp.xml
"https://
$IP_ADDRESS:$HTTPS_PORT_IS/services/IdentityApplicationManagementService?wsdl")
cp /dev/null get_sp_reponse.xml
echo $cmd >> get_sp_reponse.xml
applicationID=$(grep -oP '(?<=ax2199:applicationID>)[^<]+'
"get_sp_reponse.xml")
echo "Service Provider Application ID: $applicationID"

*get_sp.xml*

http://schemas.xmlsoap.org/soap/envelope/;
xmlns:xsd="http://org.apache.axis2/xsd;>
   
   
  
 
 SERVICE_PROVIDER_NAME
  
   


On Fri, Jan 5, 2018 at 5:08 PM, Nipuni Bhagya  wrote:

> Hi all,
>
> I'm writing shell scripts for the IAM Quick Start Guide and currently, I'm
> working on the shell script which automates the configuration of SSO with
> SAML2. I have encountered a problem while trying to get the application Id
> of a service provider in order to perform an update operation.
>
> The method I'm using to overcome this at the moment is,
>
> 1. I call the getApplication function in the Identity Application
> Management API
> 2. Write the response to a text file.
> 3. Convert that text file into an XML file.
> 4. grep the value of 
>
> But the problem with this approach is that I'm using a tool called xmllint to
> convert the text to XML format. Since xmllint is not a default Unix command
> the users will have to install it on their machines first. As it is not
> appropriate to ask for the user's password while running a script, I can't
> use xmllint and also most of the other approaches available.
>
> So I would really appreciate if someone of you could help me to find a
> better way to achieve this task.
>
> Thank you in advance,
> --
>
>
>
> *Kind Regards,Nipuni Bhagya*
>
> *Software Engineering Intern*
> *WSO2*
>
>
>
> *Mobile : +94 0779028904 <+94%2077%20767%201807>*
>



-- 
Gayan Gunawardana
Senior Software Engineer; WSO2 Inc.; http://wso2.com/
Email: ga...@wso2.com
Mobile: +94 (71) 8020933
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev