Java codegen for the IHE ITI profiles
This project aims to make it simpler for teams using java & other jvm languages to build stuff based on IHE's IT Infrastructure profiles.
To write a client, this is all you need.
If you want to build a server, you need to know enough about CXF or Metro; and use this for your interfaces. Example using CXF can be found here.
Here's a working XDS.b Document Repository client:
@Grapes([
@Grab('com.github.rahulsom:ihe-iti:0.8-SNAPSHOT'),
])
import ihe.iti.xds_b._2007.*
import javax.xml.ws.*
import javax.xml.ws.soap.*
def wsdl = this.class.getResource('/iti/wsdl/XDS.b_DocumentRepository.wsdl')
Service service = new DocumentRepositoryService(wsdl)
def port = service.getDocumentRepositoryPortSoap12(
new AddressingFeature(true, true),
new MTOMFeature(true),
new RespectBindingFeature(true)
)
BindingProvider bp = port
bp.requestContext[BindingProvider.ENDPOINT_ADDRESS_PROPERTY] =
'http://hit-testing.nist.gov:12080/xdstools2/sim/6d39cc7d-8ec7-4547-b506-f9b5155ad211/rep/ret'
def request = new RetrieveDocumentSetRequestType().
withDocumentRequest(
new RetrieveDocumentSetRequestType.DocumentRequest().
withDocumentUniqueId('123').
withRepositoryUniqueId('1.2.3.4')
)
println "Request created"
Executing asynchronously with a Response<ReturnType>
def response = port.documentRepositoryRetrieveDocumentSetAsync(request)
println "response<...> executed"
...
response.get()
println "response<...> complete: ${response.get().registryResponse.status}"
Executing asynchronously with a AsyncHandler<ReturnType>
def future = port.documentRepositoryRetrieveDocumentSetAsync(request, new AsyncHandler<RetrieveDocumentSetResponseType>() {
@Override
void handleResponse(Response<RetrieveDocumentSetResponseType> res) {
println "future<...> returned: ${res.get().registryResponse.status}"
}
})
println "future<...> executed"
...
future.get()
println "future<...> complete: ${future.get().registryResponse.status}"
Executing synchronously like normal people do
def resp = port.documentRepositoryRetrieveDocumentSet(request)
println "Sync returned: ${resp.registryResponse.status}"
Please note that it is preferred to use the async methods in client code for performance reasons.
Rahul Somasunderam (@rahulsom)
Use the Mailing List.