WebService:Class <classname>没有名称{Package} propertyName的属性

时间:2016-08-22 15:45:15

标签: java web-services

我目前正在使用网络服务技术开发基于主机/客户端的应用程序。

调用WebService时遇到问题。这是例外:

Exception in thread "main" javax.xml.ws.WebServiceException: class org.nema.dicom.wg23.NotifyDataAvailable do not have a property of the name {http://wg23.dicom.nema.org/}availableData
    at com.sun.xml.internal.ws.client.sei.BodyBuilder$DocLit.<init>(Unknown Source)
    at com.sun.xml.internal.ws.client.sei.StubHandler.<init>(Unknown Source)
    at com.sun.xml.internal.ws.db.DatabindingImpl.initStubHandlers(Unknown Source)
    at com.sun.xml.internal.ws.db.DatabindingImpl.<init>(Unknown Source)
    at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(Unknown Source)
    at com.sun.xml.internal.ws.db.DatabindingProviderImpl.create(Unknown Source)
    at com.sun.xml.internal.ws.db.DatabindingFactoryImpl.createRuntime(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.buildRuntimeModel(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(Unknown Source)
    at javax.xml.ws.Service.getPort(Unknown Source)
    at org.nema.dicom.wg23.HostService.getHostPort(HostService.java:61)
    at edu.wustl.xipApplication.wg23.ClientToHost.<init>(ClientToHost.java:52)
    at edu.wustl.xipApplication.application.WG23Application.<init>(WG23Application.java:38)
    at edu.wustl.xipApplication.samples.XIPAppLazyRetrieveTest.<init>(XIPAppLazyRetrieveTest.java:63)
    at edu.wustl.xipApplication.samples.XIPAppLazyRetrieveTest.main(XIPAppLazyRetrieveTest.java:117)
Caused by: javax.xml.bind.JAXBException: {http://wg23.dicom.nema.org/}availableData is not a valid property on class org.nema.dicom.wg23.NotifyDataAvailable
    at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getElementPropertyAccessor(Unknown Source)
    at com.sun.xml.internal.ws.db.glassfish.JAXBRIContextWrapper.getElementPropertyAccessor(Unknown Source)
    ... 19 more

我已经在很多网页上搜索过,但与人合作的解决方案对我不起作用。特别是我已多次阅读过WebMethod或SoapOperation可能与我的类名相同(NotifiyDataAvailable),但我已经修改了所有名称并且它没有改变任何内容。

以下是Host Web Service的代码:

package org.nema.dicom.wg23;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;

/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.1 in JDK 6
 * Generated source version: 2.1
 * 
 */
@WebService(name = "Host", targetNamespace = "http://wg23.dicom.nema.org/")
@XmlSeeAlso({
ObjectFactoryHost.class
})
public interface Host {


/**
 * 
 * @return
 *     returns org.nema.dicom.wg23.Uid
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "generateUID", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GenerateUID")
@ResponseWrapper(localName = "generateUIDResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GenerateUIDResponse")
public Uid generateUID();

/**
 * 
 * @param appPreferredScreen
 * @return
 *     returns org.nema.dicom.wg23.Rectangle
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getAvailableScreenHost", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetAvailableScreen")
@ResponseWrapper(localName = "getAvailableScreenHostResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetAvailableScreenResponse")
public Rectangle getAvailableScreenHost(
    @WebParam(name = "appPreferredScreen", targetNamespace = "http://wg23.dicom.nema.org/")
    Rectangle appPreferredScreen);

/**
 * 
 * @return
 *     returns java.lang.String
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getOutputDir", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetOutputDir")
@ResponseWrapper(localName = "getOutputDirResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetOutputDirResponse")
public String getOutputDir();

/**
 * 
 * @return
 *     returns java.lang.String
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getTmpDir", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetTmpDir")
@ResponseWrapper(localName = "getTmpDirResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetTmpDirResponse")
public String getTmpDir();

/**
 * 
 * @param newState
 */
@WebMethod
@RequestWrapper(localName = "notifyStateChanged", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyStateChanged")
@ResponseWrapper(localName = "notifyStateChangedResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyStateChangedResponse")
public void notifyStateChanged(
    @WebParam(name = "newState", targetNamespace = "http://wg23.dicom.nema.org/")
    State newState);

/**
 * 
 * @param newStatus
 */
@WebMethod
@RequestWrapper(localName = "notifyStatus", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyStatus")
@ResponseWrapper(localName = "notifyStatusResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyStatusResponse")
public void notifyStatus(
    @WebParam(name = "newStatus", targetNamespace = "http://wg23.dicom.nema.org/")
    Status newStatus);

/**
 * 
 * @param transferSyntaxUID
 * @param uuids
 * @param classUID
 * @return
 *     returns org.nema.dicom.wg23.ModelSetDescriptor
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getAsModelsHost", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetAsModels")
@ResponseWrapper(localName = "getAsModelsHostResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetAsModelsResponse")
public ModelSetDescriptor getAsModelsHost(
    @WebParam(name = "uuids", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID uuids,
    @WebParam(name = "classUID", targetNamespace = "http://wg23.dicom.nema.org/")
    Uid classUID,
    @WebParam(name = "transferSyntaxUID", targetNamespace = "http://wg23.dicom.nema.org/")
    Uid transferSyntaxUID);

/**
 * 
 * @param includeBulkData
 * @param uuids
 * @return
 *     returns org.nema.dicom.wg23.ArrayOfObjectLocator
 */
@WebMethod
@WebResult(name = "objectLocators", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getDataAsFileHost", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsFile")
@ResponseWrapper(localName = "getDataAsFileHostResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsFileResponse")
public ArrayOfObjectLocator getDataAsFileHost(
    @WebParam(name = "uuids", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID uuids,
    @WebParam(name = "includeBulkData", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean includeBulkData);

/**
 * 
 * @param includeBulkData
 * @param transferSyntaxUID
 * @param objectUUIDs
 * @param mimeType
 * @return
 *     returns org.nema.dicom.wg23.ArrayOfObjectLocator
 */
@WebMethod
@WebResult(name = "objectLocators", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getDataAsSpecificTypeFileHost", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsSpecificTypeFile")
@ResponseWrapper(localName = "getDataAsSpecificTypeFileHostResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsSpecificTypeFileResponse")
public ArrayOfObjectLocator getDataAsSpecificTypeFileHost(
    @WebParam(name = "objectUUIDs", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID objectUUIDs,
    @WebParam(name = "mimeType", targetNamespace = "http://wg23.dicom.nema.org/")
    String mimeType,
    @WebParam(name = "transferSyntaxUID", targetNamespace = "http://wg23.dicom.nema.org/")
    Uid transferSyntaxUID,
    @WebParam(name = "includeBulkData", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean includeBulkData);

/**
 * 
 * @param availableData
 * @param lastData
 * @return
 *     returns boolean
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "notifyDataAvailableHost", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyDataAvailable")
@ResponseWrapper(localName = "notifyDataAvailableHostResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyDataAvailableResponse")
public boolean notifyDataAvailableHost(
    @WebParam(name = "availableData", targetNamespace = "http://wg23.dicom.nema.org/")
    AvailableData availableData,
    @WebParam(name = "lastData", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean lastData);

/**
 * 
 * @param modelXpaths
 * @param objUUIDs
 * @param includeBulkDataPointers
 * @return
 *     returns org.nema.dicom.wg23.ArrayOfQueryResult
 */
@WebMethod
@WebResult(name = "queryResults", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "queryModelHost", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.QueryModel")
@ResponseWrapper(localName = "queryModelHostResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.QueryModelResponse")
public ArrayOfQueryResult queryModelHost(
    @WebParam(name = "objUUIDs", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID objUUIDs,
    @WebParam(name = "modelXpaths", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfString modelXpaths,
    @WebParam(name = "includeBulkDataPointers", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean includeBulkDataPointers);

}

客户端Web服务的代码:

package org.nema.dicom.wg23;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.xml.bind.annotation.XmlSeeAlso;
import javax.xml.ws.RequestWrapper;
import javax.xml.ws.ResponseWrapper;


/**
 * This class was generated by the JAX-WS RI.
 * JAX-WS RI 2.1.1 in JDK 6
 * Generated source version: 2.1
 * 
 */
@WebService(name = "Application", targetNamespace = "http://wg23.dicom.nema.org/")
@XmlSeeAlso({
ObjectFactoryApplication.class
})
public interface Application {


/**
 * 
 * @return
 *     returns boolean
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "bringToFront", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.BringToFront")
@ResponseWrapper(localName = "bringToFrontResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.BringToFrontResponse")
public boolean bringToFront();

/**
 * 
 * @param transferSyntaxUID
 * @param uuids
 * @param classUID
 * @return
 *     returns org.nema.dicom.wg23.ModelSetDescriptor
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getAsModelsApp", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetAsModels")
@ResponseWrapper(localName = "getAsModelsAppResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetAsModelsResponse")
public ModelSetDescriptor getAsModelsApp(
    @WebParam(name = "uuids", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID uuids,
    @WebParam(name = "classUID", targetNamespace = "http://wg23.dicom.nema.org/")
    Uid classUID,
    @WebParam(name = "transferSyntaxUID", targetNamespace = "http://wg23.dicom.nema.org/")
    Uid transferSyntaxUID);

/**
 * 
 * @param includeBulkData
 * @param uuids
 * @return
 *     returns org.nema.dicom.wg23.ArrayOfObjectLocator
 */
@WebMethod
@WebResult(name = "objectLocators", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getDataAsFileApp", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsFile")
@ResponseWrapper(localName = "getDataAsFileAppResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsFileResponse")
public ArrayOfObjectLocator getDataAsFileApp(
    @WebParam(name = "uuids", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID uuids,
    @WebParam(name = "includeBulkData", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean includeBulkData);

/**
 * 
 * @param includeBulkData
 * @param transferSyntaxUID
 * @param objectUUIDs
 * @param mimeType
 * @return
 *     returns org.nema.dicom.wg23.ArrayOfObjectLocator
 */
@WebMethod
@WebResult(name = "objectLocators", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getDataAsSpecificTypeFileApp", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsSpecificTypeFile")
@ResponseWrapper(localName = "getDataAsSpecificTypeFileAppResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetDataAsSpecificTypeFileResponse")
public ArrayOfObjectLocator getDataAsSpecificTypeFileApp(
    @WebParam(name = "objectUUIDs", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID objectUUIDs,
    @WebParam(name = "mimeType", targetNamespace = "http://wg23.dicom.nema.org/")
    String mimeType,
    @WebParam(name = "transferSyntaxUID", targetNamespace = "http://wg23.dicom.nema.org/")
    Uid transferSyntaxUID,
    @WebParam(name = "includeBulkData", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean includeBulkData);

/**
 * 
 * @param availableData
 * @param lastData
 * @return
 *     returns boolean
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "notifyDataAvailableApp", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyDataAvailable")
@ResponseWrapper(localName = "notifyDataAvailableAppResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.NotifyDataAvailableResponse")
public boolean notifyDataAvailableApp(
    @WebParam(name = "availableData", targetNamespace = "http://wg23.dicom.nema.org/")
    AvailableData availableData,
    @WebParam(name = "lastData", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean lastData);

/**
 * 
 * @param modelXpaths
 * @param objUUIDs
 * @param includeBulkDataPointers
 * @return
 *     returns org.nema.dicom.wg23.ArrayOfQueryResult
 */
@WebMethod
@WebResult(name = "queryResults", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "queryModelApp", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.QueryModel")
@ResponseWrapper(localName = "queryModelAppResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.QueryModelResponse")
public ArrayOfQueryResult queryModelApp(
    @WebParam(name = "objUUIDs", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfUUID objUUIDs,
    @WebParam(name = "modelXpaths", targetNamespace = "http://wg23.dicom.nema.org/")
    ArrayOfString modelXpaths,
    @WebParam(name = "includeBulkDataPointers", targetNamespace = "http://wg23.dicom.nema.org/")
    boolean includeBulkDataPointers);

/**
 * 
 * @return
 *     returns org.nema.dicom.wg23.State
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "getState", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetState")
@ResponseWrapper(localName = "getStateResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.GetStateResponse")
public State getState();

/**
 * 
 * @param newState
 * @return
 *     returns boolean
 */
@WebMethod
@WebResult(name = "retval", targetNamespace = "http://wg23.dicom.nema.org/")
@RequestWrapper(localName = "setState", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.SetState")
@ResponseWrapper(localName = "setStateResponse", targetNamespace = "http://wg23.dicom.nema.org/", className = "org.nema.dicom.wg23.SetStateResponse")
public boolean setState(
    @WebParam(name = "newState", targetNamespace = "http://wg23.dicom.nema.org/")
    State newState);

}

最后这是我的类NotifyAvailableData.java的代码:

package org.nema.dicom.wg23;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;


/**
 * <p>Java class for notifyDataAvailable complex type.
 * 
 * <p>The following schema fragment specifies the expected content contained within this class.
 * 
 * <pre>
 * &lt;complexType name="notifyDataAvailable">
 *   &lt;complexContent>
 *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
 *       &lt;sequence>
 *         &lt;element name="availableData" type="{http://wg23.dicom.nema.org/}availableData"/>
 *         &lt;element name="lastData" type="{http://www.w3.org/2001/XMLSchema}boolean"/>
 *       &lt;/sequence>
 *     &lt;/restriction>
 *   &lt;/complexContent>
 * &lt;/complexType>
 * </pre>
 * 
 * 
 */
 @XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "notifyDataAvailable", propOrder = {
"availableData",
"lastData"
})
public class NotifyDataAvailable {

@XmlElement(required = true)
protected AvailableData availableData;
protected boolean lastData;

/**
 * Gets the value of the availableData property.
 * 
 * @return
 *     possible object is
 *     {@link AvailableData }
 *     
 */

public AvailableData getAvailableData() {
    return availableData;
}

/**
 * Sets the value of the availableData property.
 * 
 * @param value
 *     allowed object is
 *     {@link AvailableData }
 *     
 */

public void setAvailableData(AvailableData value) {
    this.availableData = value;
}

/**
 * Gets the value of the lastData property.
 * 
 */

public boolean isLastData() {
    return lastData;
}

/**
 * Sets the value of the lastData property.
 * 
 */

public void setLastData(boolean value) {
    this.lastData = value;
}

}

你可以给我任何提示来解决这个例外吗?

提前多多感谢。

0 个答案:

没有答案