Адаптер JS
function getCitiesByCountry(countryName)
{
var request =
var request=
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webserviceX.NET">
<soapenv:Header/>
<soapenv:Body>
<web:GetCitiesByCountry>
<!--Optional:-->
<web:CountryName>INDIA</web:CountryName>
</web:GetCitiesByCountry>
</soapenv:Body>
</soapenv:Envelope>;
var input =
{
method: 'post',
returnedContentType: 'xml',
path: '/globalweather.asmx',
body: {
content: request.toString(),
contentType: 'text/json; charset=utf-8'
}
};
var result = MFP.Server.invokeHttp(input);
return result.Envelope.Body;
};
XML адаптера
<displayName>JavaScriptSOAP</displayName>
<description>JavaScriptSOAP</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>www.webservicex.net</domain>
<port>80</port>
</connectionPolicy>
</connectivity>
<procedure name="getCitiesByCountry" secured ="false"/>
Index.js
function submitRequest()
{
var resourceRequest = new WLResourceRequest("adapters/JavaScriptSOAP/getCitiesByCountry", WLResourceRequest.POST);
resourceRequest.setQueryParameter("params", "['India']");
resourceRequest.send().then(
function(response) {
alert('response '+JSON.stringify(response.responseText));
},
function(response) {
alert("HTTP Failure "+JSON.stringify(response));
}
);
}
Мне нужно передать параметры в http-адаптеры. Он содержит название страны. Я включил название страны в сам файл Index js. При предварительном просмотре приложения я получаю код ошибки 415,
И в консоли я получил как
[AUDIT ] CWWKS1100A: Authentication did not succeed for user ID test. An invalid user ID or password was specified.
[AUDIT ] CWWKS1100A: Authentication did not succeed for user ID test. An invalid user ID or password was specified.
[AUDIT ] CWWKS1100A: Authentication did not succeed for user ID test. An invalid user ID or password was specified.
У меня есть:
Eclipse Java EE IDE для веб-разработчиков. Версия: Mars.2 Release (4.5.2) Идентификатор сборки: 20160218-0600 Windows 7
Какую аутентификацию я должен предоставить. Как преодолеть ошибку??