jax ws - How to Avoid CXF Generating Separate class rather than use exiting XMLRootElement Class(JAXB Class) -
i'm newbie cxf , jaxb. i'm trying generate wsdl java class(bottom approach) using eclipse on cxf.
created interface fellows.
@webservice(name = "ebmdata", targetnamespace = "http://business.kp.org/") public interface ebmdata { @webmethod public @webresult opstatusdetails addebmfields(inputfields fields); @webmethod public @webresult opstatusdetails addolis(inputolis olis); } request xml jaxb class follows
@xmlaccessortype(xmlaccesstype.field) @xmltype(name="inputfields") @xmlrootelement(name="inputfields") public class inputfields { @xmlelement(name="fieldname", required=true) string fieldname; @xmlelement(name="oli", required=true) list<string> olis; public string getfieldname() { return fieldname; } public void setfieldname(string fieldname) { this.fieldname = fieldname; } public list<string> getolis() { return olis; } public void setolis(list<string> olis) { this.olis = olis; } } response xml jaxb class follows
@xmlaccessortype(xmlaccesstype.field) @xmltype(name="opstatusdetails") @xmlrootelement public class opstatusdetails { @xmlelement(name="returnmessage", required=true) string returnmessage; public string getreturncode() { return returnmessage; } public void setreturncode(string returnmessage) { this.returnmessage = returnmessage; } } once above class created, used new-> web service , used bottom approach option. , generated wsdl.
once wsdl generated, notice new package created. files addebmfields.java
@xmlrootelement(name = "addebmfields", namespace = "http://business.kp.org/") @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "addebmfields", namespace = "http://business.kp.org/") public class addebmfields { @xmlelement(name = "arg0") private org.kp.business.xmls.inputfields arg0; public org.kp.business.xmls.inputfields getarg0() { return this.arg0; } public void setarg0(org.kp.business.xmls.inputfields newarg0) { this.arg0 = newarg0; } } and addebmfieldsresponse.java
@xmlrootelement(name = "addebmfieldsresponse", namespace = "http://business.kp.org/") @xmlaccessortype(xmlaccesstype.field) @xmltype(name = "addebmfieldsresponse", namespace = "http://business.kp.org/") public class addebmfieldsresponse { @xmlelement(name = "return") private org.kp.business.xmls.opstatusdetails _return; public org.kp.business.xmls.opstatusdetails getreturn() { return this._return; } public void setreturn(org.kp.business.xmls.opstatusdetails new_return) { this._return = new_return; } } due these files request xml generating follows, instead of arg0 field, needs referenced inputfields.java. please on this.
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://business.kp.org/"> <soapenv:header/> <soapenv:body> <bus:addebmfields> <!--optional:--> <arg0> <fieldname>?</fieldname> <!--1 or more repetitions:--> <oli>?</oli> <oli>?</oli> <oli>?</oli> </arg0> </bus:addebmfields> </soapenv:body> </soapenv:envelope> and t
o know how jaxb class should following soap request xml <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bus="http://business.kp.org/"> <soapenv:header/> <soapenv:body> <bus:addebmfields> <!--optional:--> <fieldname>?</fieldname> <!--1 or more repetitions:--> <oli>?</oli> <oli>?</oli> <oli>?</oli> </bus:addebmfields> </soapenv:body> </soapenv:envelope>
add:
@soapbinding(parameterstyle = soapbinding.parameterstyle.bare) to ebmdata interface. default, create wrappers operations. specifying bare mode use types directly.
Comments
Post a Comment