Recently in the study of webservice, the use of the JDK to implement a simple webservice release, but the runtime has such an exception, as follows:
Exception in thread "main" Com.sun.xml.internal.ws.model.RuntimeModelerException:runtime Modeler Error:wrapper Class Webservice.jaxws.SayHi is not found. Do you run the APT to generate them?
At Com.sun.xml.internal.ws.model.RuntimeModeler.getClass (runtimemodeler.java:256)
At Com.sun.xml.internal.ws.model.RuntimeModeler.processDocWrappedMethod (runtimemodeler.java:567)
At Com.sun.xml.internal.ws.model.RuntimeModeler.processMethod (runtimemodeler.java:514)
At Com.sun.xml.internal.ws.model.RuntimeModeler.processClass (runtimemodeler.java:341)
At Com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel (runtimemodeler.java:227)
At Com.sun.xml.internal.ws.server.EndpointFactory.createSEIModel (endpointfactory.java:308)
At Com.sun.xml.internal.ws.server.EndpointFactory.createEndpoint (endpointfactory.java:174)
At Com.sun.xml.internal.ws.api.server.WSEndpoint.create (wsendpoint.java:420)
At Com.sun.xml.internal.ws.api.server.WSEndpoint.create (wsendpoint.java:439)
At Com.sun.xml.internal.ws.transport.http.server.EndpointImpl.createEndpoint (endpointimpl.java:208)
At Com.sun.xml.internal.ws.transport.http.server.EndpointImpl.publish (endpointimpl.java:138)
At Com.sun.xml.internal.ws.spi.ProviderImpl.createAndPublishEndpoint (providerimpl.java:90)
At Javax.xml.ws.Endpoint.publish (endpoint.java:170)
At WebService. Test.main (Test.java:8)
Finally found that the original version of the JDK is too low, I am using jdk1.6.10, and the minimum requirement is 1.6. More than 22, so I hereby record, beware of the wrong again
Exceptions, this method of publishing is as follows:
First step: Define the interface HelloWorld
Package WebService;
Import Javax.jws.WebService;
@WebService public interface HelloWorld {
String Sayhi (String str);
}
Step two: Implement class Helloworldimpl
Package WebService;
Import Javax.jws.WebService;
Import Javax.xml.ws.Endpoint;
@WebService (endpointinterface = "WebService". HelloWorld ")
public class Helloworldimpl implements HelloWorld {
public string Sayhi (String str) {
System.out.println ("I am WebService");
Return "Hello," + str;
}
public static void Main (string[] args) {
Endpoint.publish ("Http://localhost:8088/hello", New Helloworldimpl ());
}
}
Step three: Run the Helloworldimpl.java Main method
Fourth step: Enter in the browser address bar: http://localhost:8088/hello?wsdl
Fifth step: View the response XML file: If successful, return as follows:
<?xml version= "1.0" encoding= "UTF-8"?><!--Published by Jax-ws RI at http://jax-ws.dev.java.net. Ri ' s version is JAX-ws RI 2.2.4-B01. -<!--Generated by Jax-ws RI at http://jax-ws.dev.java.net. Ri ' s version is JAX-ws RI 2.2.4-B01. -
<DefinitionsName= "Helloworldimplservice "Targetnamespace= "http://webservice/"Xmlns= "http://schemas.xmlsoap.org/wsdl/"xmlns:xsd=" http://www.w3.org/2001/ XmlSchema "xmlns:tns=" http://webservice/ "xmlns:soap=" http://schemas.xmlsoap.org /wsdl/soap/"xmlns:wsam=" http:// Www.w3.org/2007/05/addressing/metadata "xmlns:wsp1_2=" http://schemas.xmlsoap.org/ws/2004/09/policy "xmlns:wsp=" http://www.w3.org/ns/ws-policy "xmlns:wsu=" http://docs.oasis-open.org/wss/2004/01/ Oasis-200401-wss-wssecurity-utility-1.0.xsd " <types><xsd:schema><xsd:import schemalocation= "http://localhost:8088/hello?xsd=1" namespace= "http://webservice/" /> </xsd:schema> </types> <message name= "sayhi" > <part name= "parameters" element= "tns:sayhi"/> </message> <message name= " sayhiresponse "; <part parameters "element=" tns: Sayhiresponse "/> </message> <porttype name= "helloworld"; <operation sayhi "
<input message= "tns:sayhi" wsam:action= "http://webservice/HelloWorld/sayHiRequest"/> <output message= "tns:sayhiresponse" wsam:action= "/http/ Webservice/helloworld/sayhiresponse "/>
<input message= "tns:sayhi" wsam:action= "http://webservice/HelloWorld/sayHiRequest"/> <output message= "tns:sayhiresponse" wsam:action= "http://webservice/HelloWorld/sayHiResponse"/ > </operation> </porttype> <binding name= "helloworldimplportbinding" type= "tns:helloworld" > <soap:binding style= "document" transport= "http://schemas.xmlsoap.org/soap/http"/> <operation name= "sayhi" > <soap:operation soapaction= ""/> <INPUT> << Span style= "color: #990000;" >soap:body use= "literal"/> </ Input><OUTPUT> <soap:body use= "literal"/> </ Output> </operation> </binding> <service name= "helloworldimplservice" > <Port name= "helloworldimplport" binding= "tns:helloworldimplportbinding" > <soap:address location= "http://localhost:8088/hello"/> </port> </service> </definitions> Since the input box is blocked, the following
Wrapper class Webservice.jaxws.SayHi is not found. Do you run the APT to generate them?