Client Usage

The JibxSoap client implementaion uses a simple message exchange pattern. This is implemented in the org.jibx.soap.client.SOAPClient class. You specify the target service access location when you create an instance of the class, along with the JiBX binding factory for the bindings used by the web service. Once the instance has been created, you use the call() method to actually invoke the service. Here's an example:

    // initialize SOAP client for service
    IBindingFactory fact = BindingDirectory.getFactory(Query.class);
    SOAPClient client = new SOAPClient
        ("http://localhost:8080/jibxsoap/quake", fact);
    ...
    // set up the query and pass in call to server
    Query query = new Query();
    ...
    Response response = (Response)client.call(query);

This accesses a service named quake located at http://localhost:8080/jibxsoap/quake. Since JibxSoap is intended only for doc/lit web services, the operation to be performed by the service is always determined by the root element of the SOAP request body. With JibxSoap the request body is generated by marshalling out the object supplied to the SOAPClient.call() method using the binding configured when the SOAPClient instance is created. The response message body is unmarshalled to create an object, which is then returned by the SOAPClient.call() method.

As of Alpha 0.2, the default for output XML generated by the client is to avoid any added spaces or line breaks. You can enable indentation of output XML by using an added parameter in the SOAPClient constructor call to specify the desired indentation level. You can have control over other aspects of the client side SOAP handling (including handlers and headers) by using the new code>getContext() method to access the org.jibx.soap.SOAPContext. Also as of Alpha 0.2, JibxSoap now follows the JAX-RPC convention of reporting SOAP Faults via java.rmi.ServerException exceptions.

The current main client limitation is the restriction to a simple generic call() method that takes a java.lang.Object parameter as input and returns another as the response. Code generation for a client proxy class to act as a convenient interface for wrapped style services (with multiple parameters) may be added in the future.