Java 单个对象映射到多个对象以响应Web服务
我编写了一个java服务类,并基于该类创建了一个web服务(使用EclipseJuno和Apache作为web服务器)。我的服务方法的返回类型是ProductInfoOutput,它在内部由ProductInfo和ResponseStatus组成。但是当我在WSDL文件中看到时,我发现了两个基于ResponseStatus的对象。我不知道为什么。也许在开发时我就这么做了,但现在ProductInfoOutput只有一个ResponseStatus实例。您能建议我如何从WSDL中删除这个额外的对象吗。下面是WSDL的一部分Java 单个对象映射到多个对象以响应Web服务,java,web-services,Java,Web Services,我编写了一个java服务类,并基于该类创建了一个web服务(使用EclipseJuno和Apache作为web服务器)。我的服务方法的返回类型是ProductInfoOutput,它在内部由ProductInfo和ResponseStatus组成。但是当我在WSDL文件中看到时,我发现了两个基于ResponseStatus的对象。我不知道为什么。也许在开发时我就这么做了,但现在ProductInfoOutput只有一个ResponseStatus实例。您能建议我如何从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>
经过两天的浪费,我找到了问题的根源。项目中有一个server-config.wsdd文件,它是在您第一次创建web服务时自动创建的,即使您更新了业务类,它也不会更新。我从wsdd中手动删除了服务,并从business class中重新创建了web服务。请向我们展示映射到此服务的Java代码。这是使用eclipse自动生成的。右键单击服务类->Web服务->创建Web服务。在问题中更新了我的服务类。
ProductInfoOutput productInfoOutput;
DatabaseQueries query;
public ProductInfoOutput getProductInfo(String barcode) {
productInfoOutput=new ProductInfoOutput();
query=new DatabaseQueries();
productInfoOutput=query.retrieveSingleProductByBarcode(barcode);
return productInfoOutput;
}