Hello,
I'm evaluating the CXF API and I'm going through some of your examples.
I got the sample code under java_first_jaxws, working fairly quickly.
I'm trying to expand on the code with a more realistic scenario where I
will be using a custom defined POJO as a parameter in the sayHi() method.
I created a simple class called block which does nothing but accept a
string in its' constructor and allows access to the string via a getter
method (I provided my code below). I restarted the server and then ran
the client. When the client executes, I get the following exception:
JAXBException: demo.hw.client.Block is not known to this context
I understand that I need to somehow register or define the Block class
so the JAXB context knows about it. I haven't been able to determine
how to do this. Could some one provide a code block or set of instructions
that clearly describes how this should be done so that I can successfully
execute this example using the Block class.
The code is almost identical to the code in original simple example:
public class Block implements Serializable {
private String message;
public Block(String message) { this.message = message; }
public String getMessage() { return message; }
}
@WebService
public interface HelloWorld {
public String sayHi(Block block);
}
@WebService(endpointInterface = "demo.hw.server.HelloWorld", serviceName =
"HelloWorld")
public class HelloWorldImpl implements HelloWorld {
public String sayHi(Block block) {return "Hello " + block.getMessage(); }
}
public final class Client {
private static String QNAME = "http://server.hw.demo/";
private static final QName SERVICE_NAME = new QName(QNAME, "HelloWorld");
private static final QName PORT_NAME = new QName(QNAME, "HelloWorldPort");
private Client() {}
public static void main(String args[]) throws Exception {
final Service service = Service.create(SERVICE_NAME);
final String endpointAddress = "http://localhost:9000/helloWorld";
service.addPort(PORT_NAME, SOAPBinding.SOAP11HTTP_BINDING,
endpointAddress);
final HelloWorld hw = service.getPort(HelloWorld.class);
final String message = "World";
final Block block = new Block(message);
final String result = hw.sayHi(block);
System.out.println(result);
}
public class Server {
protected Server() throws Exception {
System.out.println("Starting Server");
HelloWorldImpl implementor = new HelloWorldImpl();
String address = "http://localhost:9000/helloWorld";
Endpoint.publish(address, implementor);
}
public static void main(String args[]) throws Exception {
new Server();
System.out.println("Server ready...");
Thread.sleep(5 * 60 * 1000);
System.out.println("Server exiting");
System.exit(0);
}
}
Thank you,
Hycel
[EMAIL PROTECTED]