簡體   English   中英

Web服務響應將單個對象映射到多個對象

[英]Single object mapped to multiple objects in response of Web Service

我已經編寫了一個Java服務類,並基於該類創建了一個Web服務(使用Eclipse Juno和Apache作為Web服務器)。 我的服務方法的返回類型為ProductInfoOutput,其內部由ProductInfo和ResponseStatus組成。 但是當我在WSDL文件中看到時,我發現了兩個基於ResponseStatus的對象。 我不知道為什么 也許在開發時我就這樣做了,但現在ProductInfoOutput只有一個ResponseStatus實例。 您能否建議我如何從WSDL中刪除此多余的對象。 以下是WSDL中的部分。

<complexType name="ProductInfoOutput">
<sequence>
 <element name="productInfo" nillable="true" type="tns1:ProductInfo"/>
 <element name="responseStatus" nillable="true" type="tns1:ResponseStatus"/>
 <element name="response" nillable="true" type="tns1:ResponseStatus"/>
</sequence>
</complexType>

服務等級:

ProductInfoOutput productInfoOutput;
DatabaseQueries query;

public ProductInfoOutput getProductInfo(String barcode) {
    productInfoOutput=new ProductInfoOutput();
    query=new DatabaseQueries();
    productInfoOutput=query.retrieveSingleProductByBarcode(barcode);
    return productInfoOutput;
}

經過兩天的浪費,我發現了問題的根本原因。 項目中有一個server-config.wsdd文件,該文件是在您首次創建Web服務時自動創建的,即使您更新業務類也不會更新。 我從wsdd中手動刪除了該服務,然后從業務類中重新創建了該Web服務。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM