soapenv:Envelopeリクエストを使用するSOAPアダプターを作成しようとしています。しかし、アダプターを呼び出すと、eclipseは次のエラーを生成します-{"errors":["Ecma Error:TypeError:Cannot read property \" Body \ from undefined(C%3A%5Cdevelopment%5Cmywork%5CWorklight%5CWorklightApp lications%5Cadapters%5CSOAPAdapter /SOAPAdapter-impl.js#40) "]、" info ":[]、" isSuccessful ":false、" warnings ":[]}
これはSAXParserの問題のようです。そのため、私はそれをグーグルで検索し、IBM Developers Forum (http://www.ibm.com/developerworks/forums/thread.jspa?threadID=454988)から解決策を入手しました-eclipseの-vmargs行の後.ini、次の行を追加してからEclipseを再始動します。 -Dorg.xml.sax.driver= com.sun.org.apache.xerces.internal.parsers.SAXParser
私はそれをしましたが、それでも同じエラーが発生します。これが私のSOAPリクエストです-
"<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"+
"xmlns:xsd="http://www.w3.org/2001/XMLSchema"+
"xmlns:soapenv="http://schemas.xmlsoap.org"+
"/soap/envelope/" xmlns:soap="http://soap.amazon.com">"+
"<soapenv:Header/>"+
"<soapenv:Body>"+
"<soap:ActorSearchRequest soapenv:encodingStyle="http://schemas.xmlsoap.org"+
"/soap/encoding/">"+
"<ActorSearchRequest xsi:type="soap:ActorRequest" xs:type="type:ActorRequest"+
"xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">"+
"<actor xsi:type="xsd:string" xs:type="type:string">abc</actor>"+
"<page xsi:type="xsd:string" xs:type="type:string">1</page>"+
"<mode xsi:type="xsd:string" xs:type="type:string">a</mode>"+
"<tag xsi:type="xsd:string" xs:type="type:string">a</tag>"+
"<type xsi:type="xsd:string" xs:type="type:string">a</type>"+
"<devtag xsi:type="xsd:string" xs:type="type:string">a</devtag>"+
"</ActorSearchRequest>"+
"</soap:ActorSearchRequest>"+
"</soapenv:Body>"+
"</soapenv:Envelope>";
更新された機能-
function temperatureConvertor(celsiusTemp) {
var request = '<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soap="http://soap.amazon.com">'+
'<soapenv:Header/>'+
'<soapenv:Body>'+
'<soap:ActorSearchRequest soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">'+
'<ActorSearchRequest xsi:type="soap:ActorRequest" xs:type="type:ActorRequest" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance">'+
'<actor xsi:type="xsd:string" xs:type="type:string">abc</actor>'+
'<page xsi:type="xsd:string" xs:type="type:string">1</page>'+
'<mode xsi:type="xsd:string" xs:type="type:string">a</mode>'+
'<tag xsi:type="xsd:string" xs:type="type:string">a</tag>'+
'<type xsi:type="xsd:string" xs:type="type:string">a</type>'+
'<devtag xsi:type="xsd:string" xs:type="type:string">a</devtag>'+
'</ActorSearchRequest>'+
'</soap:ActorSearchRequest>'+
'</soapenv:Body>'+
'</soapenv:Envelope>';
var input = {
method : 'post',
returnedContentType : 'plain',
path : '/schemas2/AmazonWebServices.wsdl',
body: {
content: request.toString(),
contentType: 'text/xml; charset=utf-8'
}
};
var result = WL.Server.invokeHttp(input);
return result.Envelope.Body;
}
更新されたadapter.xml
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wl:adapter xmlns:wl="http://www.worklight.com/integration" xmlns:http="http://www.worklight.com/integration/http" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" name="SOAPAdapter">
<displayName>SOAPAdapter</displayName>
<description>SOAPAdapter</description>
<connectivity>
<connectionPolicy xsi:type="http:HTTPConnectionPolicyType">
<protocol>http</protocol>
<domain>soap.amazon.com</domain>
<port></port>
</connectionPolicy>
<loadConstraints maxConcurrentConnectionsPerNode="2"/>
</connectivity>
<procedure name="temperatureConvertor"/>
</wl:adapter>