适配器部署失败:HTTP 415 - 不支持的媒体类型

时间:2014-12-09 14:38:34

标签: ibm-mobilefirst worklight-adapters

我正在使用eclipse Kepler SR2在Worklight上开发一个小应用程序。 我开发了一个适配器,它功能齐全。然后没有做任何更改,我收到此错误: “适配器部署失败:HTTP 415 - 不支持的媒体类型”

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>

1 个答案:

答案 0 :(得分:1)

来自评论:

你可以做一些事情&#34;极端&#34;和

  1. 关闭eclipse
  2. 导航到Eclipse工作区并删除worklightServerConfig文件夹,然后删除
  3. 重启Eclipse。
  4. 我怀疑某些东西在某种程度上混淆了服务器。也许这&#34;硬重置&#34; (重新创建,真的)会有所帮助。你的项目仍然很好。