简体   繁体   中英

Using Spring XML, create a JAX-WS Client without a serviceClass

I know it is possible to create a jaxws:endpoint without the SEI, so long as you have the wdslURL, serviceName & endpointName, address.

I see lots of examples about wsdl2java, and then using that class value as the serviceClass attr. And lots of Java based examples, I am more interested in spring based XML.

For example, here is what I currently have where it doesn't like me:

    <jaxws:client id="jaxwsIngest"  xmlns:n="webservice.ingest" 
            address="http://localhost:8088/IngestService" 
            wsdlLocation="http://localhost:8088/IngestService?WSDL" 
            serviceName="n:IngestService" 
            endpointName="n:IngestServicePort"> 
            <jaxws:properties> 
                    <entry key="dataFormat" value="PAYLOAD"/> 
            </jaxws:properties> 
    </jaxws:client> 

Is it possible to do something similar like jaxws:endpoint to jaxws:client? In reality, all I have is a WSDL file & the IP of the WebService.

Is there a way to interrogate, and get the serviceClass value via a GET? Like how we do http://?WSDL

All the example I see seem to sugest that serviceClass attr is required.

Thanks in advance, Aaron

Since this question is open after 2 months I feel I can give an answer despite my scarce knowledge of the inner workings of JAX-WS (and no spring).

The reason you need a service class is that the getPort functions are generic and will return an instance of that class (or likely, interface). This class is generated by digesting the wsdl (check out ant's wsconsume ). It is the interface for making calls to the webservice. More details: http://java.sun.com/developer/technicalArticles/J2SE/jax_ws_2/

Other answers that are useful:

JAX-WS client : what's the correct path to access the local WSDL?

JAX-WS Loading WSDL from jar

If you want want to generate your ServiceClass on the fly without a local copy of the interface then you'll need to do some super fancy reflection stuff. This is beyond me and most of Google, though I've seen some posts of people doing this for their thesis.

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