1. Generate the Java Client

http://docs.oracle.com/javase/6/docs/technotes/tools/share/wsimport.html

First create a directory for the generated client in your Eclipse workspace directory, cd to that directory, and within it create a src directory and a classes directory.

~/workspace$ mkdir FP-Client ~/workspace$ cd FP-Client ~/workspace/generated$ mkdir src ~/workspace/generated$ mkdir bin

To use the JDK wsimport tool open a terminal window and invoke it with the access point wsdl and desired output locations for the source and classes:

wsimport http://<hostname>:<port>/FPNetworkAccessPointWebServiceService/FPNetworkAccessPointWebService?wsdl -s src -d bin

Now open Eclipse and select New > Other from the File menu and select Java Project in the New dialog. Name the project FP-Client In the Import dialog select "Existing Projects into Workspace" and click Next. Confirm that the Location text area contains the location to the directory you created earlier for wsimport, otherwise click the Browse... button and navigate to the generated directory that contains src and bin.

You should now have a project in your Eclipse workspace that contains classes for connecting to the AccessPoint in the org.filteredpush.triage package. Right click on the src directory in the Package Explorer and click New > Class to create the client class. Enter a name for the package such as org.filteredpush.client, a name for the class such as "TestClient", and select the option to create the main method public static void main(String[] args) before clicking Finish.

Use the following code example to construct a client using the generated classes

GregorianCalendar cal = new GregorianCalendar(); cal.setTime(new Date()); XMLGregorianCalendar date = DatatypeFactory.newInstance().newXMLGregorianCalendar(cal); // Message type MessageType type = new ApplePieMessageType(); type.setName("PING"); FpMessage message = new FpMessage(); message.setTime(date); message.setType(type); message.setContent(""); // No content for ping message try { JAXBContext context = JAXBContext.newInstance(FpMessage.class); Marshaller m = context.createMarshaller(); m.marshal(message, writer); } catch (JAXBException e) { throw new RuntimeException(e); } String signedMessage = XMLSignatureAuth.sign(writer.toString()); FPNetworkAccessPointService service = new FPNetworkAccessPointService( new URL("<hostname>:<port>/FPNetworkAccessPointService/FPNetworkAccessPoint?wsdl"), new QName("http://triage.filteredpush.org/", "FPNetworkAccessPointService")); String response = service.getFPNetworkAccessPointPort().acceptMessage(signedMessage, new ClientIdentity());

2. Generating a PHP Client

Install the php pear installer package.

$ sudo apt-get install php-pear

Download the latest version of wsdl2php from http://www.urdalen.no/wsdl2php/index.php and install the pear with the following command:

$ sudo pear install wsdl2php-0.2.1-pear.tgz

Now generate the php client code from the access point wsdl file by invoking wsdl2php:

$ wsdl2php http://<hostname>:<port>/FPNetworkAccessPointService/FPNetworkAccessPoint?wsdl

You should now see the generated FPNetworkAccessPointService.php file in the current directory. To invoke the webservice with an fp message use the following code (an example of an annotation message):

$accesspoint = new FPNetworkAccessPointService(); $request = new acceptMessage(); $message = new fpMessage(); $message->content = $rdf; $message->time = new DateTime(); $message->clientMessageID = $this->generateUUID(); $message->sender = new clientIdentity(); $type = new messageType(); $type->name = "ANNOTATION"; $scheme = new messageScheme(); $scheme->name = "RDF_XML"; $message->scheme = $scheme; $message->type = $type; $request->message = $message; $request->origin = new clientIdentity(); $accesspoint->acceptMessage($request);

Change the message type, scheme and content to change the nature of the request.