所以我想请求LYo 2.1的RTC 3.X工作项目,但是我不能从流中提取它们:
客户端是OslcOAuthClient。


  ClientResponse响应= client.getResource(resultsUrl,CT_RDF);
  ChangeRequest req = response.getEntity(ChangeRequest.class);


我想知道正确的资源对象是ChangeRequest还是另一个?我的流中有(当我使用String.class时):

  <rdf:RDF
    xmlns:dcterms="http://purl.org/dc/terms/"
    xmlns:oslc_cm="http://open-services.net/ns/cm#"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:rtc_ext="http://jazz.net/xmlns/prod/jazz/rtc/ext/1.0/"
    xmlns:oslc_cmx="http://open-services.net/ns/cm-x#"
    xmlns:process="http://jazz.net/ns/process#"
    xmlns:acp="http://jazz.net/ns/acp#"
    xmlns:acc="http://open-services.net/ns/core/acc#"
    xmlns:rtc_cm="http://jazz.net/xmlns/prod/jazz/rtc/cm/1.0/"
    xmlns:oslc="http://open-services.net/ns/core#"
    xmlns:oslc_pl="http://open-services.net/ns/pl#" >
  <rdf:Description rdf:about="https://10.0.2.79:9443/ccm/resource/itemName/com.ibm.team.workitem.WorkItem/27?useEnumLabel=true">
    <oslc_cmx:severity rdf:resource="https://10.0.2.79:9443/ccm/oslc/enumerations/_moQdkFrdEeWQIIEAtKgWEg/severity/severity.literal.l3"/>
    <oslc:instanceShape rdf:resource="https://10.0.2.79:9443/ccm/oslc/shapes/workitems/_oFcxBlxhEeWQIIEAtKgWEg"/>
    <rtc_cm:modifiedBy rdf:resource="https://10.0.2.79:9443/jts/users/Admin"/>
    <rtc_ext:archived rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</rtc_ext:archived>
    <rtc_cm:type rdf:resource="https://10.0.2.79:9443/ccm/oslc/types/_moQdkFrdEeWQIIEAtKgWEg/myId"/>
    <acc:accessContext rdf:resource="https://10.0.2.79:9443/ccm/acclist#_moQdkFrdEeWQIIEAtKgWEg"/>
    <rtc_cm:timeSheet rdf:resource="https://10.0.2.79:9443/ccm/oslc/workitems/_oFcxBlxhEeWQIIEAtKgWEg/rtc_cm:timeSheet"/>
    <oslc:shortId rdf:datatype="http://www.w3.org/2001/XMLSchema#string">27</oslc:shortId>
    <oslc_cm:status rdf:datatype="http://www.w3.org/2001/XMLSchema#string">In Progress</oslc_cm:status>
    <dcterms:identifier rdf:datatype="http://www.w3.org/2001/XMLSchema#string">27</dcterms:identifier>
    <process:projectArea rdf:resource="https://10.0.2.79:9443/ccm/process/project-areas/_moQdkFrdEeWQIIEAtKgWEg"/>
    <acp:accessControl rdf:resource="https://10.0.2.79:9443/ccm/oslc/access-control/_moQdkFrdEeWQIIEAtKgWEg"/>
    <oslc:discussedBy rdf:resource="https://10.0.2.79:9443/ccm/oslc/workitems/_oFcxBlxhEeWQIIEAtKgWEg/rtc_cm:comments"/>
    <oslc_cm:inprogress rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">true</oslc_cm:inprogress>
    <dcterms:modified rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2015-09-16T10:57:56.600Z</dcterms:modified>
    <rtc_cm:state rdf:resource="https://10.0.2.79:9443/ccm/oslc/workflows/_moQdkFrdEeWQIIEAtKgWEg/states/bugzillaWorkflow/2"/>
    <dcterms:description rdf:parseType="Literal">text</dcterms:description>
    <oslc_cm:fixed rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:fixed>
    <rdf:type rdf:resource="http://open-services.net/ns/cm#ChangeRequest"/>
    <dcterms:contributor rdf:resource="https://10.0.2.79:9443/jts/users/unassigned"/>
    <rtc_cm:repository rdf:resource="https://10.0.2.79:9443/ccm/oslc/repository"/>
    <rtc_cm:filedAgainst rdf:resource="https://10.0.2.79:9443/ccm/resource/itemOid/com.ibm.team.workitem.Category/_ns_RCFrdEeWQIIEAtKgWEg"/>
    <oslc_cm:closed rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:closed>
    <dcterms:type rdf:datatype="http://www.w3.org/2001/XMLSchema#string">MyType</dcterms:type>
    <dcterms:title rdf:parseType="Literal">WorkItemFromCustomEnumerationType</dcterms:title>
    <oslc_cm:approved rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:approved>
    <oslc_cmx:project rdf:resource="https://10.0.2.79:9443/ccm/oslc/projectareas/_moQdkFrdEeWQIIEAtKgWEg"/>
    <oslc_cm:verified rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:verified>
    <rtc_cm:progressTracking rdf:resource="https://10.0.2.79:9443/ccm/oslc/workitems/_oFcxBlxhEeWQIIEAtKgWEg/progressTracking"/>
    <oslc_pl:schedule rdf:resource="https://10.0.2.79:9443/ccm/oslc/workitems/_oFcxBlxhEeWQIIEAtKgWEg/schedule"/>
    <dcterms:subject rdf:datatype="http://www.w3.org/2001/XMLSchema#string">mytype</dcterms:subject>
    <oslc_cm:reviewed rdf:datatype="http://www.w3.org/2001/XMLSchema#boolean">false</oslc_cm:reviewed>
    <rtc_ext:contextId>_moQdkFrdEeWQIIEAtKgWEg</rtc_ext:contextId>
    <dcterms:created rdf:datatype="http://www.w3.org/2001/XMLSchema#dateTime">2015-09-16T10:57:24.636Z</dcterms:created>
    <oslc:serviceProvider rdf:resource="https://10.0.2.79:9443/ccm/oslc/contexts/_moQdkFrdEeWQIIEAtKgWEg/workitems/services"/>
    <process:teamArea rdf:resource="https://10.0.2.79:9443/ccm/process/team-areas/_moQdkFrdEeWQIIEAtKgWEg"/>
    <oslc:shortTitle rdf:parseType="Literal">MyType 27</oslc:shortTitle>
    <rtc_cm:subscribers rdf:resource="https://10.0.2.79:9443/jts/users/Admin"/>
    <rtc_cm:resolvedBy rdf:resource="https://10.0.2.79:9443/jts/users/unassigned"/>
    <dcterms:creator rdf:resource="https://10.0.2.79:9443/jts/users/Admin"/>
    <oslc_cmx:priority rdf:resource="https://10.0.2.79:9443/ccm/oslc/enumerations/_moQdkFrdEeWQIIEAtKgWEg/priority/priority.literal.l1"/>
  </rdf:Description>
</rdf:RDF>

最佳答案

RTC3是支持OSLC2的RTC的第一个版本,因此它同时支持OSLC1和OSLC2。默认情况下,RTC3返回OSLC1中指定的结果。因此,您的问题可能是OSLC4J期望得到OSLC2结果,但得到OSLC1结果。

发送请求时,应将OSLC-Core-Version标头设置为2.0。这将导致RTC3响应与OSLC2规范兼容的结果。

10-08 03:59