简体   繁体   中英

Does Java 7 include a JAX-WS implementation or just the API?

I am told that Java 7 is supposed to include JAX-WS such that I don't need libraries like those in Apache CXF. However, the official docs say:

This release contains Java API for XML Processing (JAXP) 1.4.5, supports Java Architecture for XML Binding (JAXB) 2.2.3, and supports Java API for XML Web Services (JAX-WS) 2.2.4.

Further, the Eclipse page on JAX-WS speaks of using implementations such as Apache CXF, Sun Metro, or Apache Axis. And every example/tutorial I can find on JAX-WS uses a library set like CXF or Metro.

I have a project in Eclipse that calls "Endpoint.publish(...)" on a class with a javax.jws.WebService annotation. The WSDL file referenced below resides outside Eclipse. This project runs (as a "Java Application") fine with the Apache CXF libraries includes. As soon as I remove them (and Eclipse references to Apache CXF), it crashes with the following exception:

com.sun.xml.internal.ws.server.ServerRtException: [failed to localize] cannot.load.wsdl(http://localhost:8081/wsdl/csw.wsdl)
    at com.sun.xml.internal.ws.transport.http.server.EndpointImpl.getPrimaryWsdl(EndpointImpl.java:313)

So either I'm doing something wrong or Apache is supplying implementations of things to which the JDK itself only has APIs. Please point out which is the case, along with the usual link to something relevant.

Jdk 7 (like 6) includes a metro based implementation.

As you can see from your exception, the internal implementation is running "com.sun.xml.internal.ws.transport.http.server.EndpointImpl". The problem seems to be that it doesn't like your WsdlLocation (i believe jaxws is expecting a local resource, but you have given it a http resource).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM