Ibm mobilefirst Worklight-SOAP适配器无法分析<;soapenv:信封>;要求

Ibm mobilefirst Worklight-SOAP适配器无法分析<;soapenv:信封>;要求,ibm-mobilefirst,Ibm Mobilefirst,我正在尝试创建一个使用soapenv:Envelope请求的SOAP适配器。但当我调用适配器时,eclipse会产生以下错误- { “错误”:[ “Ecma错误:TypeError:无法从未定义中读取属性\“Body\” (C%3A%5c开发%5Cmywork%5CWorklight%5CWorklightApp 应用程序%5Cadapters%5CSOAPAdapter/SOAPAdapter impl.js#40)” ], “信息”:[ ], “isSuccessful”:错误, “警告”:

我正在尝试创建一个使用soapenv:Envelope请求的SOAP适配器。但当我调用适配器时,eclipse会产生以下错误- { “错误”:[ “Ecma错误:TypeError:无法从未定义中读取属性\“Body\” (C%3A%5c开发%5Cmywork%5CWorklight%5CWorklightApp 应用程序%5Cadapters%5CSOAPAdapter/SOAPAdapter impl.js#40)” ], “信息”:[ ], “isSuccessful”:错误, “警告”:[ ] }

这似乎是一个SAXParser问题,因此我在谷歌上搜索了它,并从IBM开发者论坛()获得了一个解决方案 在eclipse.ini中的-vmargs行之后,添加以下内容 行,然后重新启动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>";
“”+
""+
""+
""+

“不应将SOAP请求创建为字符串,而应将其创建为XML文本(E4X)

意思是,你应该做
var-request={myJSVar}
,而不是
var-request=“”+myJSVar+”


请参见中的幻灯片5和6以获取示例

非常感谢Aviram的快速响应,但问题不在于引号。我使用了一个简单的soap请求的字符串格式-soap:Envelope,它工作得很好。这里的问题在于soapenv元素。有些问题是如何对其进行正确解析的。您在属性中使用了双引号不要转义它们,我相信创建的字符串不是您所期望的。请尝试我的建议或转义那些引号。另外,记录您创建的字符串,看看它是否符合您的需要。
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;
}
            <?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>