2013-04-01 45 views
0

我正在使用IBM Worklight我需要从工作灯适配器发送一个发布请求到服务器我以这种方式调用我应该得到xml内容作为响应服务器,但我得到的HTML,它是失败的好心帮我 同一职位的要求正通过REST客户端的XML输出发送完美来我需要从工作灯适配器发送发布请求

我的适配器代码是

function showAttributes() 
    { 
     var truevar ="True"; 
     var pubvar ="public"; 
     var gridvar = "GridView"; 
     var gvar ="Grid View 1 "; 

     var request = '<rdf:RDF xmlns:dcterms="http://purl.org/dc/terms/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rs="http://www.w3.org/2001/sw/DataAccess/tests/result-set#" xmlns:rrmNav="http://com.ibm.rdm/navigation#" xmlns:rrmViewdata="http://com.rdm/viewdata#" xmlns:rt="https://crizz.net/qw/views" xmlns:rm="http://www.crizz.com/xmlns/rdm/rdf/" xmlns:xsd="http://www.w3.org/2001/XMLSchema#" xmlns:rql="http://www.crizz.com/xmlns/rdm/rql/" xmlns:owl="http://www.w3.org/2002/07/owl#">' + 
     '<rtm:View rdf:about="">' + 
     '<rtm:rowquery rdf:parseType="Resource"> ' + 

         ' <rdf:Seq>' + 
          '<rdf:li rdf:resource="https://jazz.net/rtm/folders/_maPswFcdEeCVbIiWC7_0yA"/>'+ 
         '</rdf:Seq>' + 
        ' </rql:e2>' + 
        '<rql:op>' + invar + '</rql:op>' + 
       '</rdf:_1>' + 
      '</rql:where>' + 
     '</rtm:rowquery>' + 
     '<rtm:displayBaseProperties rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">' + truevar + '</rtm:displayBaseProperties>' + 
     '<rrmNav:scope>' + pubvar + '</rrmNav:scope>'+ 
     '<rtm:ofType>' + gridvar + '</rtm:ofType>' + 
     '<dcterms:description> </dcterms:description>' + 
     '<dcterms:title>' + gvar +'</dcterms:title>' + 
    '</rtm:View>' + 
    '</rdf:RDF>'; 
     var input = { 
      method : 'post', 
      returnedContentType : 'application/xml', 
      path : lpath, 
      headers : { 
       'RP-Request-Type' : 'private', 

         }, 

         body : { 
          contentType: 'text/plain; charset=utf-8', 
          content: request.toString() 
         }, 
         parameters : { 
          'oslc.query' : 'execute=true&fullObject=false&size=20&count=true&page=1&reuse=false&' 
         } 

     }; 

     return WL.Server.invokeHttp(input); 

} 

是否有发送任何错误POST请求..请帮助

在此先感谢

+0

谁能帮助我解决这个问题 – anilgontla

回答

1

是的工作灯5.0.5升级到5.0.6解决了我的问题,感谢伊詹亚达很多

0

我会建议从一个非常简单的程序开始小,做POST。 Follow the HTTP adapter module

+0

非常感谢IDAN亚达。在文件u必须提到我正文内容存储在一个变量,因为它是。如果做同样的事情,它不允许我给它的错误也我已经从这个网址下载了示例代码http://www.ibm.com/developerworks/mobile/worklight /getting-started.html与HTTP后端系统进行通信,并且我刚刚导入到了eclipse中,即使这也给了我相同的错误。请帮我 – anilgontla

+0

有工作灯适配器的任何调试器 – anilgontla