Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

java

jax-ws

cxf

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.

like image 316
kuloch Avatar asked Feb 02 '12 16:02

kuloch


People also ask

How do I add JAX-WS to eclipse?

Right-click the project, select Properties, select Java Build Path, and click the Libraries tab. Click Add Library, select MyEclipse Libraries, and click Next. Scroll down, and select the JAX-WS library container to be added to your project's build path, and click Finish. Click OK to close the Properties window.

How does JAX-WS work?

JAX-WS represents remote procedure calls or messages using XML-based protocols such as SOAP, but hides SOAP's innate complexity behind a Java-based API. Developers use this API to define methods, then code one or more classes to implement those methods and leave the communication details to the underlying JAX-WS API.

Which is known as the set of APIS in Java used to create the web services in the form of XML?

JAX-WS: JAX-WS stands for Java API for XML Web Services. JAX-WS is XML based Java API to build web services server and client application.


1 Answers

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).

like image 190
jtahlborn Avatar answered Sep 24 '22 17:09

jtahlborn