只有把targetNamespace
在服务端点接口或服务实现 豆。
/**
* Annotated Implementation Object
*/
@WebService(
name = "CustomerService",
targetNamespace = "http://org.company.services"
)
public class CustomerService {
@WebMethod
@WebResult(name="CustomerRecord")
public CustomerRecord locateCustomer(
@WebParam(name="FirstName") String firstName,
@WebParam(name="LastName") String lastName,
@WebParam(name="Address") USAddress addr) {
...
}
};
如果@WebResult
或@WebParam
没有targetNamespace
,默认是 的targetNamespace
为 Web服务。
另一方面,如果您不需要使用JAX-B定制的东西,则可以避免使用所有注释,并仅使用@WebService
。
其他位于JSR-181 Web Services Metadata for the JavaTM Platform
当我在'@ WebResult'和在'@ WebParam'在SOAP响应所生成的XML有用于最外层XML标签的命名空间(例如'')。参数(''而不是'')也是如此。 –
timomeinen
有人会认为上面的例子会起作用,但不幸的是它不喜欢上面提到的tim。为什么这么简单不容易实现?必须有一种方法,不要在每个WebParam和WebResult注释中不断复制和粘贴这个名称空间。 – GreenieMeanie