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*

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsd="http://org.apache.axis2/xsd";>
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:getApplication>
         <!--Optional:-->
         <xsd:applicationName>SERVICE_PROVIDER_NAME</xsd:applicationName>
      </xsd:getApplication>
   </soapenv:Body>
</soapenv:Envelope>

On Fri, Jan 5, 2018 at 5:08 PM, Nipuni Bhagya <[email protected]> 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 <ax2140:applicationID>
>
> 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: [email protected]
Mobile: +94 (71) 8020933
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to