Hi  John,

Did you enable json message builders and formatters in axis2?

Thank You,

On Mon, Jan 11, 2016 at 8:39 PM, John Q <[email protected]> wrote:

> Can anybody tell me what do I need in order to call a rest service from
> the ESB?
> I'm trying to call the service of the API Manager that returns the token
> and every time I get
>
> HTTP/1.1 415 Unsupported Media Type
>
> please, note in the logs that it seems like the request is not well
> formed, it looks like I'm doing a soap request, with soap actions...
>
> can any body help me with this?
>
> Thanks,
>
>
> This is my sequence into the ESB
>
> payloadFactory media-type="json">
>
> <format>
>
> {"grant_type":"password","username":"admin","password":"admin"}
>
> </format>
>
> <args />
>
> </payloadFactory>
>
> <header
>
> expression="fn:concat('Basic
> ','SW9Mb0ZCQ3lkaE9yVXhjQUtiTGpEVmloMU9RYTpWakhITjR2RXl5REFXVTBlbmdqZWxYeFp5M2th')"
>
> name="Authorization" scope="transport" />
>
> <header name="Content-Type" scope="transport"
>
> value="application/x-www-form-urlencoded; US-ASCII" />
>
> <call>
>
> <endpoint>
>
> <address uri="https://localhost:8243/token";></address>
>
> </endpoint>
>
> </call>
>
>
> this is the log into the ESB
>
> [2016-01-11 09:57:56,154] DEBUG - wire << "POST /token HTTP/1.1[\r][\n]"
>
> [2016-01-11 09:57:56,154] DEBUG - wire << "Authorization: Basic
> SW9Mb0ZCQ3lkaE9yVXhjQUtiTGpEVmloMU9RYTpWakhITjR2RXl5REFXVTBlbmdqZWxYeFp5M2th[\r][\n]"
>
> [2016-01-11 09:57:56,154] DEBUG - wire << "Content-Type: application/json;
> charset=UTF-8[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "SOAPAction: urn:mediate[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "Transfer-Encoding:
> chunked[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "Host: localhost:8243[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "Connection: Keep-Alive[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "User-Agent:
> Synapse-PT-HttpComponents-NIO[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "[\r][\n]"
>
> [2016-01-11 09:57:56,155] DEBUG - wire << "6e[\r][\n]"
>
> [2016-01-11 09:57:56,156] DEBUG - wire <<
> "<jsonObject><grant_type>password</grant_type><username>admin</username><password>admin</password></jsonObject>[\r][\n]"
>
> [2016-01-11 09:57:56,156] DEBUG - wire << "0[\r][\n]"
>
> [2016-01-11 09:57:56,156] DEBUG - wire << "[\r][\n]"
>
>
> [2016-01-11 09:57:56,200] DEBUG - wire >> "HTTP/1.1 415 Unsupported Media
> Type[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "Content-Type:
> application/octet-stream[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "Date: Mon, 11 Jan 2016 14:57:56
> GMT[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "Server:
> WSO2-PassThrough-HTTP[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "Transfer-Encoding:
> chunked[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "Connection: Keep-Alive[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "0[\r][\n]"
>
> [2016-01-11 09:57:56,201] DEBUG - wire >> "[\r][\n]"
>
> _______________________________________________
> Architecture mailing list
> [email protected]
> https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture
>
>


-- 
Viraj Senevirathne
Software Engineer; WSO2, Inc.

Mobile : +94 71 958 0269
Email : [email protected]
_______________________________________________
Architecture mailing list
[email protected]
https://mail.wso2.org/cgi-bin/mailman/listinfo/architecture

Reply via email to