Search in sources :

Example 1 with DocumentRepositoryPortType

use of ihe.iti.xds_b._2007.DocumentRepositoryPortType in project nhin-d by DirectProject.

the class DocumentRepositoryUtils method getDocumentRepositoryPortType.

/**
     * Construct a DocumentRepositoryPortType object using the provided
     * endpoint.
     * 
     * @param endpoint
     *            The XDR endpoint.
     * @param wsdlPath
     *            The path to the WSDL.
     * @return a DocumentRepositoryPortType object.
     * @throws Exception
     */
public static DocumentRepositoryPortType getDocumentRepositoryPortType(String endpoint, URL wsdlPath) throws Exception {
    QName qname = new QName("urn:ihe:iti:xds-b:2007", "DocumentRepository_Service");
    DocumentRepositoryService service = new DocumentRepositoryService(wsdlPath, qname);
    service.setHandlerResolver(new RepositoryHandlerResolver());
    DocumentRepositoryPortType port = service.getDocumentRepositoryPortSoap12(new MTOMFeature(true, 1));
    BindingProvider bp = (BindingProvider) port;
    SOAPBinding binding = (SOAPBinding) bp.getBinding();
    binding.setMTOMEnabled(true);
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
    return port;
}
Also used : DocumentRepositoryPortType(ihe.iti.xds_b._2007.DocumentRepositoryPortType) QName(javax.xml.namespace.QName) MTOMFeature(javax.xml.ws.soap.MTOMFeature) SOAPBinding(javax.xml.ws.soap.SOAPBinding) BindingProvider(javax.xml.ws.BindingProvider) DocumentRepositoryService(ihe.iti.xds_b._2007.DocumentRepositoryService)

Example 2 with DocumentRepositoryPortType

use of ihe.iti.xds_b._2007.DocumentRepositoryPortType in project nhin-d by DirectProject.

the class XDClient method forward.

private String forward(String endpoint, ProvideAndRegisterDocumentSetRequestType request) throws Exception {
    LOGGER.trace("Sending XD* request to endpoint " + endpoint);
    this.to = endpoint;
    this.messageId = UUID.randomUUID().toString();
    this.action = "urn:ihe:iti:2007:ProvideAndRegisterDocumentSet-bResponse";
    setHeaderData();
    DocumentRepositoryPortType port;
    try {
        port = DocumentRepositoryUtils.getDocumentRepositoryPortType(endpoint);
    } catch (Exception e) {
        throw new Exception("Unable to create port.", e);
    }
    RegistryResponseType rrt = port.documentRepositoryProvideAndRegisterDocumentSetB(request);
    String response = rrt.getStatus();
    LOGGER.trace("Sending complete.");
    return response;
}
Also used : DocumentRepositoryPortType(ihe.iti.xds_b._2007.DocumentRepositoryPortType) RegistryResponseType(oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType)

Aggregations

DocumentRepositoryPortType (ihe.iti.xds_b._2007.DocumentRepositoryPortType)2 DocumentRepositoryService (ihe.iti.xds_b._2007.DocumentRepositoryService)1 QName (javax.xml.namespace.QName)1 BindingProvider (javax.xml.ws.BindingProvider)1 MTOMFeature (javax.xml.ws.soap.MTOMFeature)1 SOAPBinding (javax.xml.ws.soap.SOAPBinding)1 RegistryResponseType (oasis.names.tc.ebxml_regrep.xsd.rs._3.RegistryResponseType)1