Writing a Web Client
HI all,
I have followed the examples on how to write a web service and then compile it.
I used the example at
http://support.ptc.com/cs/help/windchill_hc/wc101_hc/index.jspx?id=IEUG_WSFWriteJavaWS&action=show
And then to connect to this service I have used the example at
However, this is where it falls over. (The client example is for a different service, so I have modified it for the MyJavaService example). I can get it to run from the command line exactly as the example shows, but I need to be able to access it from other places of course.
I have written a simple project in Eclipse to access this example and this is the code
import com.ptc.jws.client.handler.*;
import org.myorg.*;
public class testproj {
public static void main ( String [] args ) throws java.lang.Exception
{
int a = args.length > 0 ? Integer.parseInt ( args[0] ) : 0;
int b = args.length > 1 ? Integer.parseInt ( args[1] ) : 0;
// depending on your security requirements you may need to specify credentials up
// front, or on the command-line where most policies will prompt for them
Credentials.setUsername ( "wcadmin" );
Credentials.setPassword ( "wcadmin" );
// TODO implement your client
MyJavaService4Service service = new MyJavaService4Service();
MyJavaService4 port = service.getMyJavaServicePort ();
//invoke an action
System.out.printf ( "a+b=%d\n", port.add ( a, b ) );
}
}
But I always get a compile error on this line
MyJavaService4Service service = new MyJavaService4Service();
which states that MyJavaService4Service cannot be resolved to a type.
Does anybody know what class or jar I need to include in my build path to make this work. There is no jar for the Service4Service only a class file and if I include that it makes no difference.
Any help on how to make these examples work with Eclipse would be very much appreciated.
Regards
Ben

