我正在尝试查询休息服务,我需要提供一些数据。
我想用来拨打电话的代码如下:
WebResource resource = this.client.resource(url);
DocumentIndexFields myDocumentIndexFields = (DocumentIndexFields) resource.type(MediaType.APPLICATION_XML_TYPE).put(DocumentIndexFields.class, documentIndexFields);
我的资源代表如下:
package myPackage;
import java.util.ArrayList;
import java.util.List;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for DocumentIndexFields complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="DocumentIndexFields">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="Field" type="{http://dev.docuware.com/schema/public/services/platform}DocumentIndexField" maxOccurs="unbounded" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "DocumentIndexFields", propOrder = {
"field"
})
@XmlSeeAlso({
UpdateIndexFieldsInfo.class
})
public class DocumentIndexFields {
@XmlElement(name = "Field")
protected List<DocumentIndexField> field;
public List<DocumentIndexField> getField() {
if (field == null) {
field = new ArrayList<DocumentIndexField>();
}
return this.field;
}
}
当我执行调用时,出现以下错误:
oct. 13, 2014 4:33:58 PM com.sun.jersey.api.client.RequestWriter$RequestEntityWriterImpl <init>
Grave: The registered message body writers compatible with the MIME media type are:
application/xml ->
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$App
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$App
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$App
*/* ->
com.sun.jersey.core.impl.provider.entity.FormProvider
com.sun.jersey.core.impl.provider.entity.StringProvider
com.sun.jersey.core.impl.provider.entity.ByteArrayProvider
com.sun.jersey.core.impl.provider.entity.FileProvider
com.sun.jersey.core.impl.provider.entity.InputStreamProvider
com.sun.jersey.core.impl.provider.entity.DataSourceProvider
com.sun.jersey.core.impl.provider.entity.XMLJAXBElementProvider$General
com.sun.jersey.core.impl.provider.entity.ReaderProvider
com.sun.jersey.core.impl.provider.entity.DocumentProvider
com.sun.jersey.core.impl.provider.entity.StreamingOutputProvider
com.sun.jersey.core.impl.provider.entity.SourceProvider$SourceWriter
com.sun.jersey.core.impl.provider.entity.XMLRootElementProvider$General
com.sun.jersey.core.impl.provider.entity.XMLListElementProvider$General
Exception: A message body writer for Java class myPackage.platform.DocumentIndexFields, and Java type class myPackage.platform.DocumentIndexFields, and MIME media type application/xml was not found
我哪里错了? 谢谢