private void connectToRegister() throws Exception {
SOAPMessage request = new SOAPMessage();
System.out.println("Envelope :" + request.getEnvelopeNamespace());
Element headerElement = new Element("wsa:Action");
headerElement.setNamespace("wsa", "http://www.w3.org/2005/08/addressing/");
headerElement.setText("urn:ihe:iti:2007:RegistryStoredQuery");
request.addHeaderElement(headerElement);
headerElement = new Element("wsa:To");
headerElement.setNamespace("wsa", "http://www.w3.org/2005/08/addressing/");
headerElement.setText("http://124.13.177.149:9080/axis2/services/xdsregistryb");
request.addHeaderElement(headerElement);
headerElement = new Element("wsa:MessageID");
headerElement.setNamespace("wsa", "http://www.w3.org/2005/08/addressing/");
headerElement.setText("urn:uuid:9fcb4eb4-8a77-4efd-a570-83f8ebbb6ea8");
request.addHeaderElement(headerElement);
Element body = request.addBody();
Element method = body.addElement();
method.setNamespace("query", "urn:oasis:names:tc:ebxml-regrep:xsd:query:3.0");
method.setNamespace("rs", "urn:oasis:names:tc:ebxml-regrep:xsd:rs:3.0");
method.setNamespace("xsi", "http://www.w3.org/2001/XMLSchema-instance");
method.setNamespace("env", "http://schemas.xmlsoap.org/soap/envelope/");
method.setNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
method.setName("query", "AdhocQueryRequest");
Element arg1 = method.addElement("query:ResponseOption");
arg1.setAttribute("returnType", "LeafClass");
arg1.setAttribute("returnComposedObjects", "true");
Element arg2 = method.addElement("AdhocQuery");
arg2.setAttribute("xmlns", "urn:oasis:names:tc:ebxml-regrep:xsd:rim:3.0");
arg2.setAttribute("id", "urn:uuid:14d4debf-8f97-4251-9a74-a90016b0af0d");
Element req = arg2.addElement("Slot");
req.setAttribute("name", "$XDSDocumentEntryPatientId");
Element valueList1 = req.addElement("ValueList");
Element value1 = valueList1.addElement("Value");
Text t = new Text("'230230^^^Malaysia&2.16.840.1.113883.2.15&ISO'");
t.setRaw(true);
value1.addText(t);
req = arg2.addElement("Slot");
req.setAttribute("name", "$XDSDocumentEntryStatus");
valueList1 = req.addElement("ValueList");
value1 = valueList1.addElement("Value");
t = new Text("('urn:oasis:names:tc:ebxml-regrep:StatusType:Approved')");
t.setRaw(true);
value1.setText(t);
request.addMIMEHeader("SOAPAction", "\"\"");
System.out.println("request = \n" + request + "\n");
String url = "http://oracle.azmihashim.com:9080/axis2/services/xdsregistryb";
SOAPConnection connection = new SOAPConnection(url);
SOAPMessage response = connection.invoke(request);
XPath xpath = new XPath("//rim:Slot[@name='URI']//rim:Value");
Elements results = response.getBody().getElements(xpath);
while(results.hasMoreElements()){
Element result = results.next();
System.out.println("result " + result.getString());
}
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment