MedicalRecordServiceAdapterpublic class MedicalRecordServiceAdapter extends Object
Fields Summary |
---|
public String | endpoint | private org.apache.soap.transport.http.SOAPHTTPConnection | m_httpConnection | private org.apache.soap.encoding.SOAPMappingRegistry | m_smr |
Constructors Summary |
---|
public MedicalRecordServiceAdapter()
m_httpConnection = new SOAPHTTPConnection();
m_smr = new SOAPMappingRegistry();
BeanSerializer beanSer = new BeanSerializer();
m_smr.mapTypes(Constants.NS_URI_SOAP_ENC,
new QName("http://chapter9/IMedicalRecordService.xsd",
"chapter9_PatientRecord"), PatientRecord.class,
beanSer, beanSer);
|
Methods Summary |
---|
public PatientRecord | getMedicalRecord(java.lang.Long patientID)
PatientRecord returnVal = null;
URL endpointURL = new URL(endpoint);
Call call = new Call();
call.setSOAPTransport(m_httpConnection);
call.setTargetObjectURI("chapter9.MedicalRecordService");
call.setMethodName("getMedicalRecord");
call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
Vector params = new Vector();
params.addElement(new Parameter("patientID",
java.lang.Long.class, patientID, null));
call.setParams(params);
call.setSOAPMappingRegistry(m_smr);
Response response = call.invoke(endpointURL, "");
if (!response.generatedFault()) {
Parameter result = response.getReturnValue();
returnVal = (PatientRecord)result.getValue();
}
else {
Fault fault = response.getFault();
throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
}
return returnVal;
|
|