java - The service class does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly -


i new java webservices, trying create simple soap based web-services getting issue in creating it.

here webservice class:

@webservice public class teams {     private teamsutility utils;      public teams() {         utils = new teamsutility();         utils.make_test_teams();     }      @webmethod     public team getteam(string name) { return utils.getteam(name); }      @webmethod     public list<team> getteams() { return utils.getteams(); }      @webmethod     public string getdummyteams() { return "hi"; } } 

as can see have 3 methods here. if keep getdummyteams , ask eclipse create webservice, have no issues. when tried add remaining 2 methods public team getteam(string name) & public list<team> getteams() while creating webservice getting error :

the service class "helloservice.endpoint.teams" not comply 1 or more requirements of jax-rpc 1.1 specification, , may not deploy or function correctly. field or property "players" on value type "helloservice.endpoint.team" used via service class "helloservice.endpoint.teams" has data type, "java.util.list", not supported jax-rpc 1.1 specification. instances of type may not serialize or deserialize correctly. loss of data or complete failure of web service may result.

here team class:

@xmlrootelement public class team implements serializable{     private list<player> players;     private string name;      public team() {     }      public team(string name, list<player> players) {         setname(name);         setplayers(players);     } // setter & getter methods } 

can please me how fix issue? want use java.util.list. there settings have change in eclipse use collections while creating soap based web-services?

this not direct response question. nevertheless point out may consider not use jax-rpc @ all.

first of all, jax-rpc old api, has been replaced jax-ws.

reasons may want stay jax-rpc 1.1: ... if want send soap encoded messages or create rpc/encoded style wsdl.

and leads question "what rpc-encoded wsdl style?"

the wsdl file contains definition of methods of webservice. , there 4 ways/styles define these methods:

  • rpc/encoded
  • rpc/literal
  • document/encoded
  • document/literal

each style has advantages , disadvantages. important 1 following remark:

although legal wsdl, rpc/encoded not ws-i compliant.

ws-i stands "webservice interoperability". so, quote clarifies, though jax-rpc supports rpc/encoded wsdl files, doesn't mean it's compatible other rpc/encoded technologies (e.g. webservices written in php). jax-rpc webservices between java , php may seem work @ first, break in specific cases. so lesson is: avoid rpc/encoded wsdl files. , that's why jax-ws doesn't support them.

unfortunately, don't have choice (e.g. company provides webservice) if it's rpc/encoded wsdl file, won't able use jax-ws. if hosted webservice written in java, risk using jax-rpc. if it's written in other language, wouldn't take risk. you're better of writing custom handler when happens. (you can still safely use jaxb (java xml binding) perform (un)marshalling (conversion from/to xml) using annotations, jax-ws webservices.)

but how know if it's rpc/encoded wsdl file? open in text editor, , binding tag. following example rpc/literal style wsdl file. can use jax-ws webservice.

<binding name="myservice" type="tns:myservice">   <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>   <operation name="method">     <soap:operation soapaction=""/>     <input>       <soap:body use="literal" .../>     </input>     <output>       <soap:body use="literal" .../>     </output>   </operation> </binding> 

when define own webservice, can choose wsdl style annotating class @soapbinding(style=style.rpc, use=use.literal).

a source of confusion: both jax-rpc , jax-ws use soap. there's thing called xml-rpc old standard (before soap). but jax-rpc not use xml-rpc. on other hand, soap called "xml based rpc".


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -