简体   繁体   中英

Jax-WS and annotations

We currently have this

@WebServiceRef(wsdlLocation = "META-INF/wsdl/localhost_8080/SwitchWSService/SwitchWebService.wsdl")
private SwitchWSService switchWS;

Can't we point to the real web service and it still work.

@WebServiceRef(wsdlLocation = "www.web.com/SwitchWSService/SwitchWebService.wsdl")
private SwitchWSService switchWS;

Chapter 7.9 of the JAX-WS 2.0 spec says:

wsdlLocation:

A URL pointing to the location of the WSDL document for the service being referred to.
...
The wsdlLocation element, if present, overrides theWSDL location information specified in the WebService annotation of the referenced generated service class.

So your approach is basically OK. But strictly speaking

www.web.com/SwitchWSService/SwitchWebService.wsdl

is not an URL since an URL or URI in general must start with a scheme (see RFC 3986 ).

Let me see, you want your WSDL to be published onto some external URL and then give clients that URL to retrieve WSDL from. That means your service won't be the source of WSDL download, and thus you don't need to provide ANY wsdlLocation for it.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM