I am attempting to build my first Java web service using this tutorial http://www.ibm.com/developerworks/webservices/tutorials/ws-jax/ws-jax.html but it produces errors at a certain point that I cannot resolve. The tutorial includes a download and even when I simply use the relevant file from the download its still gives me the errors. All java classes have complied until this point. The OrderProcessService class has complied fine and I have checked all spelling of files and folder names but still it is as if the java compiler cannot see the OrderProcessService class. What am I doing wrong here? I have copied in the OrderProcessService class and the OrderWebServicePublisher class. The other classes in the bean directory, such as Customer and Address are just POJO's. Here is the error;
The OrderProcessService.java
package com.ibm.jaxws.tutorial.service;
import javax.jws.WebMethod;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import com.ibm.jaxws.tutorial.service.bean.OrderBean;
// JWS annotation that specifies that the portType name of the
// Web service is "OrderProcessPort" the service name is
// "OrderProcess" and the targetNamespace used in the generated
// WSDL is "http://jaxws.ibm.tutorial/jaxws/orderprocess"
@WebService(serviceName = "OrderProcess",
portName = "OrderProcessPort",
targetNamespace = "http://jaxws.ibm.tutorial/jaxws/orderprocess")
// JWS annotation that specifies the mapping of the service onto the
// SOAP message protocol. In particular, it specifies that the SOAP
// messages
// are document literal
@SOAPBinding(style=SOAPBinding.Style.DOCUMENT, use=SOAPBinding.Use.LITERAL,
parameterStyle=SOAPBinding.ParameterStyle.WRAPPED)
public class OrderProcessService{
@WebMethod
public OrderBean processOrder(OrderBean orderBean){
// Do processing
System.out.println("processOrder called for customer"
+ orderBean.getCustomer().getCustomerId());
// Items ordered are
if(orderBean.getOrderItems() != null) {
System.out.println("Number of items is"
+ orderBean.getOrderItems().length);
}
// Process Order
// Set the order ID
orderBean.setOrderId("A1234");
return orderBean;
}
}
The OrderWebServicePublisher.java
package com.ibm.jaxws.tutorial.service.publish;
import javax.xml.ws.Endpoint;
import com.ibm.jaxws.tutorial.service.OrderProcessService;
public class OrderWebServicePublisher {
public static void main(String[] args) {
Endpoint.publish("http://localhost:8080/OrderProcessWeb/orderprocess",
new OrderProcessService());
System.out.println("The web service is published at
http://localhost:8080/OrderProcessWeb/orderprocess");
System.out.println("To stop running the web service , terminate the
java process");
}
}