【问题标题】:403 forbidden error worklight403禁止错误工作灯
【发布时间】:2013-05-17 10:49:49
【问题描述】:

我已经完成了一个 worklight 移动应用程序。我必须在我空间的 jazz.net 服务器中创建一个工件。 我在其余客户端中使用了一些链接,然后我可以在我的项目空间中的 jazz 服务器中创建一个工件。

现在我在哪里使用 worklight 并发送相同的请求,它给了我禁止 错误

{"responseID":"74","statusCode":403,"errors":[],"isSuccessful":true,"statusReason":"Forbidden","re​​sponseHeaders":{"Content-Language": "en-US","Date":"2013 年 5 月 22 日星期三 11:37:18 GMT","Content-Length":"571","X-jazzweb1":"D=780029 t=1369222638020906"," Keep-Alive":"timeout=5, max=100","Connection":"Keep-Alive","Content-Type":"application/rdf+xml; charset=UTF-8","Server":" IBM_HTTP_Server","X-Powered-By":"Servlet/3.0","Proxy-Connection":"Keep-Alive"},"RDF":{"Description":{"errorMessage":{"CDATA":" Forbidden","datatype":"http://www.w3.org/2001/XMLSchema#string"},"detailedMessage":{"CDATA":"CRRRS6401E 解析内容时出错。内容必须是有效的 rdf+xml。" “数据类型”:“http://www.w3.org/2001/XMLSchema#string”},“错误状态”:{“CDATA”:“403”,“数据类型”:“http://www.w3. org/2001/XMLSchema#long"}},"err":"http://jazz.net/xmlns/prod/jazz/foundation/1.0/","rdf":"http://www.w3.org /1999/02/22-rdf-syntax-ns#"},"warnings":[],"totalTime":2584,"responseTime":2583,"info":[]}

我的代码如下

function create(folderId)
 { var Request = '<rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/terms/""xmlns:oslc_rm="http://open-services.net/ns/rm#" ><rdf:Description rdf:about=""><rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/><dc:description rdf:parseType="Literal">OSLC artifact created</dc:description><dc:title rdf:parseType="Literal">OSLC Created Requirement anil</dc:title><oslc:instanceShape rdf:resource="https://jazz.net/rm/types/_0kMQplV1EeC7_0yA"/><nav:parent rdf:resource="https://jazz.net/rm/folders/_cYBT0WSxEe5ZruQ"/></rdf:Description></rdf:RDF>'; var path ='rm/requirementFactory?projectURL=https://jazz.net/jts/process/project-areas/_xKDFBlV1EeC7_0yA';
 var winput = 
{ method : 'post', 
//returnedContentType : 'none',
 path : path,
 headers : { 'accept' : 'application/xml', 
'OSLC-Core-Version' : '2.0' },
 body:{ content: Request,
 contentType: 'application/rdf+xml;
 charset=utf-8' }
 };
 return WL.Server.invokeHttp(winput);
 }

【问题讨论】:

    标签: javascript ibm-mobilefirst http-status-code-403


    【解决方案1】:

    这一行的间距不对,

     { var Request = '<rdf:RDFxmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"xmlns:dc="http://purl.org/dc/terms/""xmlns:oslc_rm="http://open-services.net/ns/rm#" ><rdf:Description rdf:about=""><rdf:type rdf:resource="http://open-services.net/ns/rm#Requirement"/><dc:description rdf:parseType="Literal">OSLC artifact created</dc:description><dc:title rdf:parseType="Literal">OSLC Created Requirement anil</dc:title><oslc:instanceShape rdf:resource="https://jazz.net/rm/types/_0kMQplV1EeC7_0yA"/><nav:parent rdf:resource="https://jazz.net/rm/folders/_cYBT0WSxEe5ZruQ"/></rdf:Description></rdf:RDF>'; var path ='rm/requirementFactory?projectURL=https://jazz.net/jts/process/project-areas/_xKDFBlV1EeC7_0yA';
    

    由于缺少空格,您似乎没有发送有效的文档。 rdf:RDF xmlns...

     { var Request = '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/terms/"
    

    【讨论】:

    • 嗨 @rooftop 感谢您的重播。但我发送的 rdf 是正确的。相同的 rdf 在其余客户端中工作。我可以知道它失败的任何其他原因跨度>
    猜你喜欢
    • 1970-01-01
    • 2016-06-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-02-20
    • 2012-06-17
    相关资源
    最近更新 更多