SOAP Webサービス経由でデータを取得するためにjavascriptのHttpアダプタを使用しています。ここでは、MFP8.0でイオンを使用しています。MobileFirst 8のJS HTTPアダプタでJSONオブジェクトを動的に渡す方法
マイアダプタ実装ファイルは、クライアントで
function getFeed(method, data) {
var sr =
"<soapenv:Envelope " +
"xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" " + "xmlns:len=\"targetNamespace HERE" >" +
"<soapenv:Header/>"+
"<soapenv:Body>" +
"<len:authentication>" +
"<method>"+method+"</method>"+ data +
"</authentication></soapenv:Body></soapenv:Envelope>";
var input = {
method : 'post',
returnedContentType : 'xml',
path : 'PATH HERE',
body: {
content: sr,
contentType: 'text/xml; charset=utf-8',
},
};
return MFP.Server.invokeHttp(input);
}
ですが、私はJsonObjectを動的に渡す必要があり
var resourceRequest = new WLResourceRequest("adapters/http/getFeed", WLResourceRequest.GET);
var dataList={
username:data.uname,
password:data.pswd
};
resourceRequest.setQueryParameter("params", "['myMethod', 'dataList']");
resourceRequest.send().then(
function(response) {
alert('response '+JSON.stringify(response.responseText));
},
function(response) {
alert("HTTP Failure "+JSON.stringify(response));
}
);
あり、それはユーザ名とパスワードが含まれています。私はパラメータを介してオブジェクトを送信しています。
しかし、私はXMLでデータを取得することができません。 JSONオブジェクトをXML形式で使用する方法を教えてもらえますか?
実は私の要件は、それは、のようなアダプタファイルで動的にXMLの内側+ –
XML「 『+データを 』」+方法+をそのデータを渡すためにタグは、データを渡すために動的である必要があります。それをどうやるか教えてくれますか? –