Sami
Sami

Reputation: 564

Adapter deployment failed: HTTP 415 - Unsupported Media Type

I'm developing a small app on Worklight using eclipse Kepler SR2. I have developed an adapter and it was functional. then without doing any changes, I'm getting this error: "Adapter deployment failed: HTTP 415 - Unsupported Media Type"

Adapter.js:

var data;
function onAuthRequired(headers, errorMessage){
errorMessage = errorMessage ? errorMessage : null;

return {
    authRequired: true,
    errorMessage: errorMessage
};
}

function StoreData(Data)
{
var activeUser = WL.Server.getActiveUser('mySecurityRealm');

activeUser.attributes = {
        data : Data
};
WL.Logger.info("Data stored");
WL.Logger.info(activeUser);
}

function RetrieveData()
{

var activeUser = WL.Server.getActiveUser();
WL.Logger.info(activeUser);
WL.Logger.info(activeUser.attributes['data']);
return {
    data : activeUser.attributes.data
};
}

Adapter.xml:

<wl:adapter name="DataManagementAdapter"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:wl="http://www.worklight.com/integration"
xmlns:http="http://www.worklight.com/integration/http">

<displayName>DataManagementAdapter</displayName>
<description>DataManagementAdapter</description>
<connectivity>
    <connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
        <protocol>http</protocol>
        <domain>rss.cnn.com</domain>
        <port>80</port> 
        <!-- Following properties used by adapter's key manager for choosing specific            certificate from key store  
        <sslCertificateAlias></sslCertificateAlias> 
        <sslCertificatePassword></sslCertificatePassword>
        -->     
    </connectionPolicy>
    <loadConstraints maxConcurrentConnectionsPerNode="2" />
</connectivity>

<procedure name="StoreData" securityTest="mySecurityTest"/>

<procedure name="RetrieveData" securityTest="mySecurityTest"/>

</wl:adapter>

Upvotes: 0

Views: 548

Answers (1)

Idan Adar
Idan Adar

Reputation: 44516

From the comments:

You could do something a bit "extreme" and:

  1. Close eclipse
  2. Navigate to the Eclipse workspace and delete the worklightServerConfig folder, then
  3. Restart Eclipse.

I suspect something got confused in the server somehow. Maybe this "hard reset" (recreate, really) will help. Your project remains in tact.

Upvotes: 1

Related Questions