I was doing that, but I get this response <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><soapenv:Body><axis2ns12:binary xmlns:axis2ns12="http://ws.apache.org/commons/ns/payload "></axis2ns12:binary></soapenv:Body></soapenv:Envelope>
what can I do? On Fri, Jan 8, 2016 at 2:45 PM, Harsha Kumara <[email protected]> wrote: > Hi John, > > Previous configuration I just sent for your reference. Please use below. > Replace values matching to your configurations. > > <api xmlns="http://ws.apache.org/ns/synapse" name="token" context="/test"> > <resource methods="GET" uri-template="/*"> > <inSequence> > <property xmlns:ns="http://org.apache.synapse/xsd" > name="Authorization" expression="fn:concat('Basic > ','UEhKS1VaSjJWMUlHTU16QTYyUHpWSXppdUhFYTpfZklMQkxKMDhLQXFENmNFV3k5Y29WekE4cklh')" > scope="transport"/> > <payloadFactory media-type="json"> > <format>{"grant_type":"password", "username":"admin", > "password":"admin"} </format> > <args/> > </payloadFactory> > <property name="messageType" > value="application/x-www-form-urlencoded" scope="axis2"/> > <send> > <endpoint> > <http method="POST" uri-template=" > https://localhost:8243/token"/> > </endpoint> > </send> > </inSequence> > <outSequence> > <send/> > </outSequence> > </resource> > </api> > > Thanks, > Harsha > > On Sat, Jan 9, 2016 at 12:43 AM, John Q <[email protected]> wrote: > >> Hello Harsha, Thanks for your answer. >> I'm having problems with the code you provided me, this is what I have >> now: >> >> <property xmlns:ns="http://org.apache.synapse/xsd" name="Authorization" >> expression="fn:concat('Basic >> ','SW9Mb0ZCQ3lkaE9yVXhjQUtiTGpEVmloMU9RYTpWakhITjR2RXl5REFXVTBlbmdqZWxYeFp5M2th')" >> >> scope="transport" /> >> >> <payloadFactory media-type="json"> >> >> <format> >> >> {grant_type=password&username=admin&password=admin} >> >> </format> >> >> </payloadFactory> >> >> <property name="messageType" value="application/x-www-form-urlencoded" >> scope="axis2" /> >> >> <call> >> >> <endpoint> >> >> <http method="post" uri-template="https://localhost:8243/token" >> /> >> >> </endpoint> >> >> </call> >> >> >> The developer studio doesn't allow me to save the file, it says the >> username element should end with a ; >> >> could you help me with this? >> >> also, once I get the token, how can I save it to a property? >> >> I have worked with soap before, but it's my first time with rest from the >> ESB, >> >> >> Thanks again, >> >> On Fri, Jan 8, 2016 at 1:22 PM, Harsha Kumara <[email protected]> wrote: >> >>> Hi John, >>> >>> First you have to build token request within sequence and then call the >>> token APIs. Details about token APIs can be found in [1]. Let's say you >>> need to request a token with password grant type, then you have to build a >>> request as format specified in [2]. Below I have specified the >>> configuration you should write within a sequence. I haven't tested. But >>> format should be same. You may use call mediator instead send mediator. >>> >>> <property xmlns:ns="http://org.apache.synapse/xsd" >>> name="Authorization" expression="fn:concat('Basic ','Base64 encoded >>> consumerKey:consumerSecret')" scope="transport" /> >>> <payloadFactory media-type="json"> >>> >>> <format>{"grant_type=password&username=<username>&password=<password>"} >>> </format> >>> </payloadFactory> >>> <property name="messageType" >>> value="application/x-www-form-urlencoded" scope="axis2" /> >>> <send> >>> <endpoint> >>> <http method="post" uri-template="https://localhost:8243/token" >>> /> >>> </endpoint> >>> </send> >>> >>> [1] - https://docs.wso2.com/display/AM1100/Token+API >>> [2] - >>> https://docs.wso2.com/display/AM1100/Generating+Access+Tokens+with+User+Credentials+-+Password+Grant+Type >>> >>> Please use dev mailing list for these type of conversations. >>> >>> Thanks, >>> Harsha >>> >>> On Fri, Jan 8, 2016 at 11:28 PM, John Q <[email protected]> wrote: >>> >>>> Hello, >>>> Can any body tell me how can I get a an Api Manager Token from a >>>> sequence in the ESB? >>>> >>>> I know how to do it from a rest client but I don't know how to do the >>>> same thing from the esb using a payload mediator or whatever, >>>> >>>> thanks, >>>> johnq >>>> >>>> _______________________________________________ >>>> Architecture mailing list >>>> [email protected] >>>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>>> >>>> >>> >>> >>> -- >>> Harsha Kumara >>> Software Engineer, WSO2 Inc. >>> Mobile: +94775505618 >>> Blog:harshcreationz.blogspot.com >>> >>> _______________________________________________ >>> Architecture mailing list >>> [email protected] >>> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >>> >>> >> >> _______________________________________________ >> Architecture mailing list >> [email protected] >> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture >> >> > > > -- > Harsha Kumara > Software Engineer, WSO2 Inc. > Mobile: +94775505618 > Blog:harshcreationz.blogspot.com > > _______________________________________________ > Architecture mailing list > [email protected] > https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture > >
_______________________________________________ Architecture mailing list [email protected] https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
