2016-09-30 44 views
0

在我以前的問題here (Contains all the source information)我問過爲什麼我的WSDL不包含我的方法的參數。 我再叫,它是在WSDL可用可用下BIRT不適用於Java 1.6 JAX-WS方法參數

http://localhost:8080/hello?xsd=1 

望着那定義我可以清楚地看到該方法我的參數定義:

<!-- Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.2.4-b01. 
--> 
<xs:schema version="1.0" targetNamespace="http://soap.webapp.mobile.product.com/"> 
    <xs:element name="sayMyName" type="tns:sayMyName"/> 
    <xs:element name="sayMyNameResponse" type="tns:sayMyNameResponse"/> 
    <xs:complexType name="sayMyName"> 
     <xs:sequence> 
      <xs:element name="name" type="xs:string" minOccurs="0"/> 
     </xs:sequence> 
    </xs:complexType> 
    <xs:complexType name="sayMyNameResponse"> 
     <xs:sequence> 
      <xs:element name="return" type="xs:string" minOccurs="0"/> 
     </xs:sequence> 
    </xs:complexType> 
</xs:schema> 

當我使用WDSL作爲數據源對於BIRT,它顯示了方法名稱,但參數選擇對話框是空的。

它只是不適用於Java 1.6 API,應該使用axis2嗎?

回答

0

好了,我終於找到了如何得到它的工作,基本上我添加了以下注釋,以我的@WebService類:

@SOAPBinding(style = SOAPBinding.Style.RPC) 

完整的示例:

import javax.jws.WebMethod; 
import javax.jws.WebParam; 
import javax.jws.WebService; 
import javax.jws.soap.SOAPBinding; 
import javax.xml.ws.BindingType; 

@WebService 
@BindingType(value = "http://java.sun.com/xml/ns/jaxws/2003/05/soap/bindings/HTTP/") 
@SOAPBinding(style = SOAPBinding.Style.RPC) 
public class WSHello { 

    @WebMethod 
    public String sayMyName(@WebParam(name = "name") String name) { 
     return "Hello, ... " + name; 
    } 

} 
相關問題