You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Eclipse中新增SOAP WebService操作后如何更新WSDL

How to Update WSDL for New SOAP WebService Operations in Eclipse

Hey there! Let's walk through exactly how to get your new addCI operation showing up in your WSDL, since you already have sayHello working smoothly. Here's the step-by-step breakdown:

1. Update Your WebService Code First

Before touching the WSDL, you need to add the new operation to your service's interface and implementation:

  • Open your WebService interface (e.g., YourService.java) and add the addCI method definition with proper JAX-WS annotations:
    @WebMethod(operationName = "addCI")
    @WebResult(name = "addCIResult")
    public int addCI(@WebParam(name = "param1") int num1, @WebParam(name = "param2") int num2);
    
  • Implement this method in your service's concrete class (e.g., YourServiceImpl.java) with your business logic.

2. Regenerate/Update the WSDL in Eclipse

Eclipse's JAX-WS tools handle WSDL generation automatically based on your annotated code—you just need to trigger the update:

  • Right-click your WebService project → Go to Web Services → Select Update Web Service.
  • In the popup dialog:
    • Make sure the Service Implementation points to your updated service class.
    • Check the Generate WSDL option (this overwrites or updates the existing WSDL with your new operation).
    • Click Finish—Eclipse will generate the updated WSDL that includes both sayHello and addCI.

For Dynamic WSDL (Accessed via ?wsdl)

If your service uses a dynamically generated WSDL (the one you get by appending ?wsdl to your service URL), you just need to:

  • Restart your application server (e.g., Tomcat, WildFly). The server will pick up the updated service code and generate a fresh WSDL with the addCI operation when you access the URL.

3. Verify the Updated WSDL

Open your browser and navigate to your service's WSDL URL. Search for addCI—you should see:

  • An <operation> entry under the <portType> section.
  • Corresponding <message> definitions for the request and response of addCI.
  • The <binding> section mapping the operation to SOAP.

4. Update Your Client (If Needed)

If you have an existing client generated from the old WSDL, you'll need to regenerate it to access the new addCI operation:

  • Right-click your client project → Web Services → Generate Client.
  • Input the updated WSDL URL and follow the prompts to regenerate the client classes. Now you can call addCI just like you do with sayHello.

Quick Notes to Avoid Issues

  • Double-check that your addCI method has all required JAX-WS annotations—missing annotations can cause the operation to not show up in the WSDL.
  • If you're using a framework like Apache CXF, ensure your service configuration (e.g., cxf-servlet.xml) doesn't hardcode a static WSDL path; use dynamic generation instead.
  • Always restart your server after code changes to clear any cached WSDL content.

内容的提问来源于stack exchange,提问作者lrente

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.20 07:56:15