1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
| package com.dmp.kit_editeur.soapService;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.BindingProvider;
import javax.xml.ws.Service;
import com.dmp.iheprofiles.hl7v3.NE2009.GDPPortType;
import com.dmp.kit_editeur.util.Properties;
public class PatientService {
public PatientService() throws Exception {
this.patientServiceUrl = Properties.load("SERVER_URL")+"/patients";
}
private String patientServiceUrl;
public GDPPortType getPort() throws Exception {
System.setProperty("cxf.config.file", "cxf-client.xml");
// Appel au webservice
QName serviceName = new QName("urn:hl7-org:v3", "GDP_Service");
URL wsdlURL = PatientService.class
.getResource("wsdl/GestionDossierPatientPartage.wsdl");
Service service = Service.create(wsdlURL, serviceName);
GDPPortType portType = service.getPort(GDPPortType.class);
// Designation du service a utiliser
BindingProvider provider = (BindingProvider) portType;
provider.getRequestContext().put(
BindingProvider.ENDPOINT_ADDRESS_PROPERTY, patientServiceUrl);
return portType;
}
} |