web services - How do I include a packaged WSDL to use with Java classes generated with wsimport? -


i'm coming c# realize can't expect lot of (great) usability features , functionality there in java, i've been sort of put on java project , cannot figure out. in c# / .net making web service proxy classes , generated data contracts pie reason java implementation of web services doesn't seem right me.

here's deal...

i use wsimport create generated .java files .wsdl files. example...

"%java_home%\bin\wsimport" -quiet -extension -s .\src -d .\bin ".\wsdl\mywsdl.wsdl" 

i noticed hard-coded (typing phrase made me vomit now) "wsdllocation" current location of wsdl ("c:\users\me\etc\wsdl\mywsdl.wsdl"). take out:

"%java_home%\bin\wsimport" -quiet -extension -s .\src -d .\bin -wsdllocation "null" ".\wsdl\mywsdl.wsdl" 

now when instantiate generated service...

myservice xyz = new myservice(); 

i error. along lines of "can't find file c:\blahblah\temp\null" . ok... drawing board. after having investigated little, found post here on stack overflow talked using "classpath:meta-inf/wsdl.wsdl" wsdl location.

"%java_home%\bin\wsimport" ... -wsdllocation "classpath:wsdls/mywsdl.wsdl" ".\wsdl\mywsdl.wsdl" copy ".\wsdl\*" .\bin\wsdls cd bin "%java_home%\bin\jar" cf webserviceproxies.jar * 

error!

"unknown protocol: classpath"  

strangely enough, post on stack overflow marked answer. guess it's possible on last 2 years decent amount has changed point "classpath:" no longer supported or there method of doing haven't been able figure out / find answer.

ok, have 1 of several questions need answered (thanks in advance!!!! i'm going nuts on here!).

  1. is there way not need wsdl @ runtime? it's worth, think it's b.s. needs when instantiate objects. way suppress requirement? maybe if used different tool...?

  2. if there no way code not need wsdl @ runtime, how pick wsdl package? put in wsdllocation argument make load wsdl within jar file?

since need-for-wsdl-at-runtime-tragedy never bothered me, have no answers on #1. said, use of packaged wsdl should last resort anyways. prefer use published wsdl endpoint. actual wsdl location http(s)://host/name_of_service?wsdl hosting frameworks or http(s)://host/name_of_service.wsdl spring-ws.

as complexity of java-based webservice client programming, let me show small excerpt 1 of maven based projects:

<plugin>     <groupid>org.apache.cxf</groupid>     <artifactid>cxf-codegen-plugin</artifactid>     <version>2.6.1</version> <executions>     <execution>         <id>generate-sources</id>         <phase>generate-sources</phase>         <configuration>             <sourceroot>${project.build.directory}/generated-sources/cxf</sourceroot>             <wsdloptions>                 <wsdloption>                     <wsdl>https://xxxxxxxx/ws/loadsave?wsdl</wsdl>                 </wsdloption>             </wsdloptions>         </configuration>         <goals>             <goal>wsdl2java</goal>         </goals>     </execution> </executions> 

maybe i'm not ide-centric, seems pretty simple me. apache cxf 1 of best webservice stacks out there. (although documentation use fuse http://fusesource.com/docs/esb/3.5/fsf_se/jaxwswsdlfirst.html . it's cxf rebranded better documentation.)

hope answers question (at least partially).

on java rant: don't use ms tools unless have to, not because hate them. work somehow pushed me towards bigger projects , it's quite rare see .net support on high-end (or mid-range matter) servers. it's fact, won't make java better .net. i'm pretty sure if have work on ms stuff used pretty fast. advice is: happy work gave possibility learn new , cherish it. in end we're in business because learn new things guess.


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -