WebService (i) initial involvement

Source: Internet
Author: User

exception in thread  "Main"  com.sun.xml.internal.ws.model.RuntimeModelerException:  runtime modeler error: wrapper class com.wa.jaxws.sayhello is not  found. have you run 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 com.wa.servertest.main (Servertest.java:9)
Reason

CXF needs the support of Jaxws-api-2.1.jar and Jaxb-api-2.1.jar.

Solutions

1. Check to see if there are any of these related jar packages in the project, and if not, copy the jar of 2.1 required by CXF to the Jre\lib\endorsed folder in the JDK directory. If the endorsed folder does not exist, you can create a new.

2. The relevant jar package is included in the project, and you need to add @soapbinding (style = SOAPBinding.Style.RPC) above the public class XXX class.

3. JDK upgrade to 1.6.0.22 or above;

Define interface method: @WebServicepublic interface Helloint {@WebMethod public string SayHello (string name);} Definition implementation class: @WebService @soapbinding (style = SOAPBinding.Style.RPC) public class Helloimpl implements Helloint {@Override public string SayHello (string name) {return "Hello," +name;}} Test method: public class Servertest {public static void main (string[] args) {String address = "http://192.168.1.100:8989/d01w  S/hello ";  Endpoint.publish (Address,new Helloimpl ()); System.out.println ("WebService released successfully"); }}

To run the program:

In the browser address bar, type: http://192.168.1.100:8989/d01ws/hello?wsdl

You can see the content and publish it successfully:

<?xml version= "1.0"  encoding= "UTF-8"?> @namespace  html url (http://www.w3.org/1999/ XHTML); :root {                        font:small Verdana;         font-weight: bold;         padding:  2em;              padding-left:4em;        }                           * {                             display: block;             padding-left: 2em;      }                            html|style {                   display: none;          }                            html|span, html|a {            display: inline;            padding: 0;                 font-weight: normal;       text-decoration: none;   }                           html|span.block {              display: block;         }                            *[html|hidden],             span.block[html|hidden] {     display: none;           }                           .expand {                       display: block;         }                           . expand:before {               content:  ' + ';               color:  red;                 position: absolute;        left: -1em;              }  .collapse {                    display:  block;         }                           .collapse:before {             content:  '-';               color: red;                 position: absolute;         left:-1em;               }<!-- published by jax-ws ri at http://jax-ws.dev.java.net.  ri ' s version is jax-ws ri 2.1.1 in jdk 6. --><!--  generated by jax-ws ri at http://jax-ws.dev.java.net. ri ' S version  is jax-ws ri 2.1.1 in jdk 6. --><definitions name= " Helloimplservice " targetnamespace="http://wa.com/" xmlns=" http://schemas.xmlsoap.org/wsdl/" xmlns:xsd=" Http://www.w3.org/2001/XMLSchema " xmlns:tns=" http://wa.com/" xmlns:soap=" http://schemas.xmlsoap.org/wsdl/soap/"&GT;&LT;? xml:namespace prefix = [default] http://schemas.xmlsoap.org/wsdl/ ns =  " http://schemas.xmlsoap.org/wsdl/" /><types/><message name=" SayHello "><part  Name= "arg0"  type= "xsd:string"/></message><message name= "Sayhelloresponse" ><part  name= "return"  type= "xsd:string"/></message><porttype name= "HelloImpl" >< Operation name= "SayHello"  parameterorder= "arg0" ><input message= "Tns:sayhello"/>< Output message= "Tns:sayhelloresponse"/></operation></porttype><binding name= " Helloimplportbinding " type=" Tns:helloimpl "><soap:binding style=" RPC " transport="/HTTP/ Schemas.xmlsoap.org/soap/http "/><operatIon name= "SayHello" ><soap:operation soapaction= ""/><input><soap:body  Namespace= "http://wa.com/"  use= "literal"/></input><output><soap:body namespace= " http://wa.com/" use=" literal "/></output></operation></binding><service name= "Helloimplservice" ><port name= "Helloimplport"  binding= "tns:helloimplportbinding" ><soap: address location= "Http://192.168.1.110:8989/d01ws/hello"/></port></service></ Definitions>

WebService (i) initial involvement

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.