2013-06-18 21 views
0

我正在爲基於HTTP soap的調用製作一個適配器,調用代碼如下,同時調用適配器,出現如下錯誤:「Can not read property」Body 「來自未定義」。Soap Adder Isssue:無法從undefined讀取屬性「Body」:WORKLIGHT

SOAPAdapter.xml是:

<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>*.*.com</domain> 
     <port>80</port>   
    </connectionPolicy> 
    <loadConstraints maxConcurrentConnectionsPerNode="2"/> 
</connectivity> 

<procedure name="get_soap_req_list"/> 

SOAPAdapter-impl.js是:

功能get_soap_req_list(){

var request = 
    '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">' 
     +'<soap:Body>' 
      +'<AddList xmlns="http://schemas.microsoft.com/sharepoint/soap/">' 
       +'<listName>tiu</listName>' 
       +'<description>uyt</description>' 
       +'<templateID>6</templateID>' 
      +'</AddList>' 
     +'</soap:Body>' 
    +'</soap:Envelope>'; 
WL.Logger.debug("@@@"+request); 

      var input = { 
       method : 'post', 
       returnedContentType : 'xml', 
       path : '/_vti_bin/Lists.asmx', 
       body : { 
        content: request.toString(),     
        contentType: 'text/xml; charset=utf-8'     
       }    

      }; 
**27**   var result = WL.Server.invokeHttp(input);    
**28**   return result; 
} 

控制檯錯誤是:

E:發生錯誤而調用程序SOAPAdapter/get_soap_req_listFWLSE0100E:參數:{ 「ARR」:[] } 類型錯誤:無法讀取屬性 「正文」 從不確定的(d %3A%5CWorklightworkSpace%5Cmodule_05_2_HTTP_Adapter%5Cadapters%5CSOAPAdapter/SOAPAdapter- impl.js#42) FWLSE0101E:空

結果輸出:

致{ 「錯誤」: ], 「信息」: ], 「isSuccessful」:真實, 「responseHeaders響應」:{ 「內容長度」: 「0」, 「日期」:「星期四,2013年六月20日11時08分03秒「, 」MicrosoftSharePointTeamServices「:」14.0.0.6123「, 」SPRequestGuid「:」7a89adce-9ede-4197-bfc4-aff18e85e763「, 」Server「:」Microsoft-IIS/7.5「, 」WWW-Authenticate「:」NTLM「, 」X-MS-InvokeApp「:」1; RequireReadOnly」, 「X供電,經」: 「ASP.NET」 }, 「RESPONSETIME」:156, 「的StatusCode」:401, 「statusReason」: 「未授權」, 「文」: 「」 , 「TOTALTIME」:172, 「警告」: ] }

+0

請看看這個問題的回答可以幫助你? http://stackoverflow.com/questions/15428615/worklight-adapter-invoke-web-ser副錯誤 - 不能讀取屬性體 –

回答

0

更改爲 「返回結果;」

什麼是輸出

+0

執行沒有去結果,錯誤是在調用HTTP過程中。錯誤:: E:調用過程SOAPAdapter/get_soap_req_listFWLSE0100E時發生錯誤:參數:{ 「arr」:[ ] } TypeError:找不到對象的默認值。 (D%3A%5CWorklightworkSpace%5Cmodule_05_2_HTTP_Adapter%5Cadapters%5CSOAPAdapter/SOAPAdapter-impl.js#28) FWLSE0101E:原因:null – SRam

+0

您可以使用行號粘貼適配器代碼嗎?另外,將returnedContentType更改爲「普通」並重試。 – Anton

+0

我試着'平原',但同樣的問題,第28行是'返回結果',意思是在invokehttp方法後,如果我寫'WL.Logger。調試( 「#######」 +結果+ 「$ %%%%」);」那麼錯誤發生在那行/請參考我編輯的適配器代碼 – SRam

相關問題