Java Code Examples for org.apache.axiom.om.OMElement#toString()

The following examples show how to use org.apache.axiom.om.OMElement#toString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WSXACMLEntitlementServiceClient.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * Format the sent in request as required by OpenSAML
 *
 * @param xacmlRequest : received XACML request
 * @return formatted request
 * @throws Exception
 */
private String formatRequest(String xacmlRequest) throws EntitlementProxyException {

    xacmlRequest = xacmlRequest.replace("\n", "");

    OMElement omElemnt = null;
    try {
        omElemnt = AXIOMUtil.stringToOM(xacmlRequest);
        omElemnt.setNamespace(xacmlContextNS);
        Iterator childIterator = omElemnt.getChildElements();
        setXACMLNamespace(childIterator);
        return omElemnt.toString();

    } catch (Exception e) {
        log.error("Error occurred while formatting the XACML request", e);
        throw new EntitlementProxyException("Error occurred while formatting the XACML request", e);
    }

}
 
Example 2
Source File: Evs.java    From openxds with Apache License 2.0 6 votes vote down vote up
public String getReport(String messageId) {
	String reportTxt = null;
	try {
		init();
		Message m = log.readMessage(messageId);
		OMElement report = buildReport(m);

		reportTxt = report.toString();
		done();
	} catch (Exception e) {
		if (reportTxt == null)
			reportTxt = "<XdsEvsResult><InternalError>" + e.getMessage() + "</InternalError></XdsEvsResult>";
	} 
	finally {
		done();
	}
	return reportTxt;
}
 
Example 3
Source File: IterateClient.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * This is used to send a multiple custom stockquote request
 *
 * @param address service address
 * @param symbol  stock quote symbol
 * @return
 * @throws java.io.IOException
 */
public String getMultipleCustomResponse(String address, String symbol, int iterations)
        throws IOException {

    AxisOperationClient operationClient = new AxisOperationClient();
    OMElement response = null;
    try {
        response = operationClient.send(address, null, createMultipleCustomQuoteRequestBody(symbol, iterations), "urn:getQuote");
    } finally {
        operationClient.destroy();
    }
    Assert.assertNotNull(response, "Response null");

    return response.toString();

}
 
Example 4
Source File: IterateClient.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * This is used to send a multiple custom stockquote request
 *
 * @param address service address
 * @param symbol  stock quote symbol
 * @return
 * @throws java.io.IOException
 */
public String getMultipleCustomResponse(String address, String symbol, int iterations)
        throws IOException {

    AxisOperationClient operationClient = new AxisOperationClient();
    OMElement response = null;
    try {
        response = operationClient.send(address, null, createMultipleCustomQuoteRequestBody(symbol, iterations), "urn:getQuote");
    } finally {
        operationClient.destroy();
    }
    Assert.assertNotNull(response, "Response null");

    return response.toString();

}
 
Example 5
Source File: IterateClient.java    From micro-integrator with Apache License 2.0 6 votes vote down vote up
/**
 * This is used to send a request which contains several getquote elements
 *
 * @param address service address
 * @param symbol  stock quote symbol
 * @return
 * @throws IOException
 */
public String getGetQuotesResponse(String address, String symbol, int iterations) throws IOException {

    AxisOperationClient operationClient = new AxisOperationClient();
    OMElement response = null;
    try {
        response = operationClient
                .send(address, null, createGetQuotesRequestBody(symbol, iterations), "urn:getQuote");
    } finally {
        operationClient.destroy();
    }
    Assert.assertNotNull(response, "Response null");

    return response.toString();

}
 
Example 6
Source File: IterateClient.java    From product-ei with Apache License 2.0 6 votes vote down vote up
/**
 * This is used to send a multiple stockquote request
 *
 * @param address service address
 * @param symbol  stock quote symbol
 * @return
 * @throws java.io.IOException
 */
public String getMultipleResponse(String address, String symbol, int iterations)
        throws IOException {

    AxisOperationClient operationClient = new AxisOperationClient();
    OMElement response = null;
    try {
        response = operationClient.send(address, null, createMultipleQuoteRequestBody(symbol, iterations), "urn:getQuote");
    } finally {
        operationClient.destroy();
    }
    Assert.assertNotNull(response, "Response null");

    return response.toString();

}
 
Example 7
Source File: EnrichIntegrationReplaceEnvelopeWithPropertyTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private String getResponse() throws IOException {

        AxisOperationClient operationClient = new AxisOperationClient();
        OMElement response = null;
        try {
            response = operationClient.send(getProxyServiceURLHttp("enrichReplaceEnvelopeWithPropertyTestProxy"), null,
                                            createQuoteRequestBody("WSO2"), "urn:getQuote");
        } finally {
            operationClient.destroy();
        }

        Assert.assertNotNull(response, "Response null");
        return response.toString();

    }
 
Example 8
Source File: CallTemplateWithValuesAndExpressionTestCase.java    From product-ei with Apache License 2.0 5 votes vote down vote up
private String getResponse() throws IOException {
    AxisOperationClient operationClient = new AxisOperationClient();
    OMElement response = null;
    try {
        response = operationClient.send(getProxyServiceURLHttp(proxyServiceName), null,
                                        createMultipleQuoteRequestBody(symbol, iterations), "urn:getQuote");
    } finally {
        operationClient.destroy();
    }

    Assert.assertNotNull(response, "Response null");
    return response.toString();

}
 
Example 9
Source File: RegistrytStoredQueryTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetFolders() throws Exception {
	//1. Submit a document first for a random patientId
	String patientId = generateAPatientId();
	String folderUniqueId = submitOneDocument2Folder(patientId);
	
	//2. Generate StoredQuery request message
	String message = GetFoldersQuery(folderUniqueId, true);
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 
	
	//5. Verify that the given FolderPatientId is found from the StoredQuery response. 
	NodeList nodes = getPatientIdNodes(response, patientId, "getFolders");
	assertTrue(nodes.getLength() == 1); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 10
Source File: IterateClient.java    From micro-integrator with Apache License 2.0 5 votes vote down vote up
/**
 * @param address
 * @param symbol
 * @return
 * @throws IOException
 */
public String getResponse(String address, String symbol) throws IOException {
    AxisOperationClient operationClient = new AxisOperationClient();
    OMElement response = null;
    try {
        response = operationClient.send(address, null, createSimpleQuoteRequestBody(symbol), "urn:getQuote");
    } finally {
        operationClient.destroy();
    }
    Assert.assertNotNull(response, "Response null");
    return response.toString();

}
 
Example 11
Source File: RegularExpressionProtector.java    From carbon-apimgt with Apache License 2.0 5 votes vote down vote up
/**
 * This method checks whether the request body contains matching vulnerable key words.
 *
 * @param messageContext contains the message properties of the relevant API request which was
 *                       enabled the regexValidator message mediation in flow.
 */
private boolean isRequestBodyVulnerable(MessageContext messageContext) {
    SOAPEnvelope soapEnvelope;
    SOAPBody soapBody;
    OMElement omElement;
    org.apache.axis2.context.MessageContext axis2MC = ((Axis2MessageContext)
            messageContext).getAxis2MessageContext();
    if (enabledCheckBody) {
        soapEnvelope = axis2MC.getEnvelope();
        if (soapEnvelope == null) {
            return false;
        }
        soapBody = soapEnvelope.getBody();
        if (soapBody == null) {
            return false;
        }
        omElement = soapBody.getFirstElement();
        if (omElement == null) {
            return false;
        }
        String payload = omElement.toString();
        if (pattern != null && payload != null && pattern.matcher(payload).find()) {
            if (logger.isDebugEnabled()) {
                logger.debug(String.format("Threat detected in request payload [ %s ] by regex [ %s ]))",
                        payload, pattern));
            }
            GatewayUtils.handleThreat(messageContext, APIMgtGatewayConstants.HTTP_SC_CODE,
                    threatType + " " + APIMgtGatewayConstants.PAYLOAD_THREAT_MSG);
            return true;
        }
    }
    return false;
}
 
Example 12
Source File: ProvideAndRegisterDocumentSetTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testSubmitMultipleDocument() throws Exception {
	createPatient(patientId);

	String message = IOUtils.toString( ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/submit_multiple_documents.xml"));
	String document1 = IOUtils.toString(ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/referral_summary.xml"));
	String document2 = IOUtils.toString(ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/medical_summary.xml"));
	//replace document and submission set uniqueId variables with actual uniqueIds. 
	message = message.replace("$XDSDocumentEntry.uniqueId", "2.16.840.1.113883.3.65.2." + System.currentTimeMillis());
	message = message.replace("$XDSDocumentEntry.uniqueId1", "2.16.840.1.113883.3.65.2." + System.currentTimeMillis());
	message = message.replace("$XDSSubmissionSet.uniqueId", "1.3.6.1.4.1.21367.2009.1.2.108." + System.currentTimeMillis());
	message = message.replace("$patientId", patientId);
	String uuid1 = getUUID();
	String uuid2 = getUUID();
	message = message.replace("$doc1", uuid1);
	message = message.replace("$doc2", uuid2);
	ServiceClient sender = getRepositoryServiceClient();			
	
	OMElement request = OMUtil.xmlStringToOM(message);			
	
	//Add a referral summary document
	request = addOneDocument(request, document1, uuid1);
	//Add a Discharge summary documents
	request = addOneDocument(request, document1, uuid2);

	System.out.println("Request:\n" +request);
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue());
	
	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 13
Source File: RegistrytStoredQueryTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetDocumentsAndAssociations() throws Exception {
	//1. Submit a document first for a random patientId
	String patientId = generateAPatientId();
	String uuid = submitOneDocument(patientId);
	
	//2. Generate StoredQuery request message
	String message = GetDocumentsQuery(uuid, false,"urn:uuid:bab9529a-4a10-40b3-a01f-f68a615d247a");
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 
	
	//5. Verify that the given PatientId is found from the StoredQuery response. 
	NodeList nodes = getPatientIdNodes(response, patientId, "getDocuments");
	assertTrue(nodes.getLength() == 1); 
	
	//6. Verify that the Association object found from the StoredQuery response. 
	NodeList nodes1 = getPatientIdNodes(response, patientId, "getAssociations");
	assertTrue(nodes1.getLength() == 1); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 14
Source File: RegistrytStoredQueryTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testFindDocuments() throws Exception {
	//1. Submit a document first for a random patientId
	String patientId = generateAPatientId();
	String uuid = submitOneDocument(patientId);
	
	//2. Generate StoredQuery request message
	String message = findDocumentsQuery(patientId, "Approved");
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 
	
	//5. Verify that the given patientId is found from the StoredQuery response. 
	NodeList nodes = getPatientIdNodes(response, patientId, "findDocuments");
	assertTrue(nodes.getLength() == 1); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 15
Source File: RegistrytStoredQueryTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetDocuments() throws Exception {
	//1. Submit a document first for a random patientId
	String patientId = generateAPatientId();
	String uuid = submitOneDocument(patientId);
	
	//2. Generate StoredQuery request message
	String message = GetDocumentsQuery(uuid, false, "urn:uuid:5c4f972b-d56b-40ac-a5fc-c8ca9b40b9d4");
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 
	
	//5. Verify that the given PatientId is found from the StoredQuery response. 
	NodeList nodes = getPatientIdNodes(response, patientId, "getDocuments");
	assertTrue(nodes.getLength() == 1); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 16
Source File: RegistrytStoredQueryTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetSubmissionSetAndContents() throws Exception {
	//1. Submit a document first for a random patientId
	String patientId = generateAPatientId();
	String subUniqueId = submitDocument2SubmissionSet(patientId);
	
	//2. Generate StoredQuery request message
	String message = GetSubmissionSetAndContentsQuery(subUniqueId, true);
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 
	
	//5. Verify that the given PatientId is found from the StoredQuery response. 
	NodeList nodes = getPatientIdNodes(response, patientId, "getDocuments");
	assertTrue(nodes.getLength() == 1); 
	
	//NodeList asso_nodes = getPatientIdNodes(response, patientId, "getAssociations");
	//assertTrue(asso_nodes.getLength() == 1); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 17
Source File: RegistrytStoredQueryTest.java    From openxds with Apache License 2.0 5 votes vote down vote up
@Test
public void testGetSubmissionSets() throws Exception {
	//1. Submit a document first for a random patientId
	String patientId = generateAPatientId();
	String uuid = submitOneDocument(patientId);
	
	//2. Generate StoredQuery request message
	String message = GetSubmissionSetsQuery(uuid);
	OMElement request = OMUtil.xmlStringToOM(message);			
	System.out.println("Request:\n" +request);

	//3. Send a StoredQuery
	ServiceClient sender = getRegistryServiceClient();															 
	OMElement response = sender.sendReceive( request );
	assertNotNull(response); 

	//4. Verify the response is correct
	OMAttribute status = response.getAttribute(new QName("status"));
	assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue()); 
	
	//5. Verify that the given PatientId is found from the StoredQuery response. 
	NodeList nodes = getPatientIdNodes(response, patientId, "getSubmissionSets");
	assertTrue(nodes.getLength() == 1); 

	String result = response.toString();
	System.out.println("Result:\n" +result);
}
 
Example 18
Source File: FaultyDataServiceTestCase.java    From product-ei with Apache License 2.0 4 votes vote down vote up
@Test(groups = "wso2.dss", dependsOnMethods = {"isFaultyService"}, description = "Fix the fault and redeploy")
public void editFaultyService()
        throws Exception {
    DataServiceAdminClient dataServiceAdminService =
            new DataServiceAdminClient(dssContext.getContextUrls().getBackEndUrl(),
                                      sessionCookie);
    String serviceContent;
    String newServiceContent;
    SqlDataSourceUtil dssUtil =
            new SqlDataSourceUtil(sessionCookie,
                                  dssContext.getContextUrls().getBackEndUrl());

    dssUtil.createDataSource(getSqlScript());

    serviceContent = dataServiceAdminService.getDataServiceContent(serviceName);

    try {
        OMElement dbsFile = AXIOMUtil.stringToOM(serviceContent);
        OMElement dbsConfig = dbsFile.getFirstChildWithName(new QName("config"));
        Iterator configElement1 = dbsConfig.getChildElements();
        while (configElement1.hasNext()) {
            OMElement property = (OMElement) configElement1.next();
            String value = property.getAttributeValue(new QName("name"));
            if ("org.wso2.ws.dataservice.protocol".equals(value)) {
                property.setText(dssUtil.getJdbcUrl());

            } else if ("org.wso2.ws.dataservice.driver".equals(value)) {
                property.setText(dssUtil.getDriver());

            } else if ("org.wso2.ws.dataservice.user".equals(value)) {
                property.setText(dssUtil.getDatabaseUser());

            } else if ("org.wso2.ws.dataservice.password".equals(value)) {
                property.setText(dssUtil.getDatabasePassword());
            }
        }
        if (log.isDebugEnabled()) {
            log.debug(dbsFile);
        }
        newServiceContent = dbsFile.toString();
    } catch (XMLStreamException e) {
        log.error("XMLStreamException while handling data service content ", e);
        throw new XMLStreamException("XMLStreamException while handling data service content ", e);
    }
    Assert.assertNotNull("Could not edited service content", newServiceContent);
    dataServiceAdminService.editDataService(serviceName, "", newServiceContent);
    log.info(serviceName + " edited");

}
 
Example 19
Source File: CrossGatewayRetrieveTest.java    From openxds with Apache License 2.0 4 votes vote down vote up
/**
    * XGR Retrieve multiple document, Generate request for the retrieval of multiple documents.
    * Some from the local community, and some from a remote community. 
    * Based on the XDSDocument.uniqueId, repositoryUniqueId, and homeCommunityId returned in metadata, 
    * issue a RetrieveDocumentSet transaction to retrieve two documents.
    * <p>
    * Note:
    * This test submits the RetrieveDocumentSet request to the initiating gateway instead of the responding gateway.
    * 
    * @throws Exception
    */	
	@Test
	public void testIGMultipleDocuments() throws Exception {
		//1. Load one or more documents for the default patient: patientId
		
		//2. Generate StoredQuery request message
		String message = new CrossGatewayQueryTest().findDocumentsQuery(patientId, "Approved", "LeafClass");
		OMElement request = OMUtil.xmlStringToOM(message);			
		System.out.println("Request:\n" +request);

		//3. Send a StoredQuery
		ServiceClient sender = getRegistryGateWayClient();															 
		OMElement response = sender.sendReceive( request );
		assertNotNull(response); 
		
		//4. Get DocumentUniqueId from the response.
		List extrinsicObjects = getExtrinsicObjects(response);
		List<String> docIds = getDocumentId(extrinsicObjects);
		
		//5. Get RepositoryUniqueId from the response.
		XdsRepositoryService xdsService = (XdsRepositoryService) XdsFactory.getInstance().getBean("repositoryService");
		String reposiotryUniqueId = xdsService.getRepositoryUniqueId();

		//6. Generate Retrieve document request message
		List<String> ids = new ArrayList<String>();
		//Add the documents from the local community repository
		for (String docId : docIds) {
			ids.add(homeProperty);
			ids.add(reposiotryUniqueId);
			ids.add(docId);
		}		
//String 	reposiotryUniqueId = "1.3.6.1.4.1.21367.2010.1.2.1125";
//ids.add("urn:oid:1.3.6.1.4.1.21367.2010.1.2.2045"); 
////use the same repository as in the local community. In the real world, it should not be the same.
//ids.add(reposiotryUniqueId);
//// docId - hard coded for now
//ids.add("2.16.840.1.113883.3.65.2.1262392348530");
		
		//Add the documents from a remote community (in the 198.160.211.53 server)
		//remote home id
		String remoteHomeId = "urn:oid:1.3.6.1.4.1.21367.2010.1.2.2800";
		ids.add(remoteHomeId); 
		//use the same repository as in the local community. In the real world, it should not be the same.
		ids.add(reposiotryUniqueId);
		// docId - hard coded for now
		ids.add("2.16.840.1.113883.3.65.2.1262451539643");
		
		String retrieveDoc = retrieveDocuments(ids);
		OMElement retrieveDocRequest = OMUtil.xmlStringToOM(retrieveDoc);
		System.out.println("Request:\n" +retrieveDoc);
		
		//7. Send a Retrieve document set request
		ServiceClient retrieveDocSender = getIGRetrieveServiceClient();
		OMElement retrieveDocResponse = retrieveDocSender.sendReceive(retrieveDocRequest);

		assertNotNull(retrieveDocResponse);

		String responseStatus;
		//8. Verify the response is correct
		List registryResponse = new ArrayList();
		for (Iterator it = retrieveDocResponse.getChildElements(); it.hasNext();) {
			OMElement obj = (OMElement) it.next();
			String type = obj.getLocalName();
			if (type.equals("RegistryResponse")) {
				registryResponse.add(obj);
			}
		}
		responseStatus = getRetrieveDocumentStatus(registryResponse);
		assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", responseStatus);
		
		//9. Verify the response returning more than 1 Document and each has a valid HomeCommunityId
		List<OMElement> docRequests = MetadataSupport.childrenWithLocalName(retrieveDocResponse, "DocumentResponse");
		assertNotNull (docRequests);

		for (OMElement documentRequest : docRequests) {
			OMElement homeElem = MetadataSupport.firstChildWithLocalName(documentRequest, "HomeCommunityId");
			assertNotNull (homeElem);
			String home = homeElem.getText();
			assertNotNull (home);
			assertTrue(home.equals(homeProperty) || home.equals(remoteHomeId));
		}
		assertTrue(docRequests.size() >= 1); 
		
		String result = retrieveDocResponse.toString();
		System.out.println("Result:\n" +result);
	}
 
Example 20
Source File: XdsTest.java    From openxds with Apache License 2.0 4 votes vote down vote up
public String submitMultipleDocuments(String patientId) throws Exception {

		String message = IOUtils.toString( ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/submit_multiple_documents.xml"));
		String document1 = IOUtils.toString(ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/referral_summary.xml"));
		String document2 = IOUtils.toString(ProvideAndRegisterDocumentSetTest.class.getResourceAsStream("/data/medical_summary.xml"));
		//replace document and submission set uniqueId variables with actual uniqueIds. 
		message = message.replace("$XDSDocumentEntry.uniqueId", "2.16.840.1.113883.3.65.2." + System.currentTimeMillis());
		message = message.replace("$XDSDocumentEntry.uniqueId1", "2.16.840.1.113883.3.65.2." + System.currentTimeMillis());
		message = message.replace("$XDSSubmissionSet.uniqueId", "1.3.6.1.4.1.21367.2009.1.2.108." + System.currentTimeMillis());
		//replace the document uuid.
		String uuid1 = getUUID();
		message = message.replace("$doc1", uuid1);
		String uuid2 = getUUID();
		message = message.replace("$doc2", uuid2);
		
		
		//replace the patient id
		if (patientId != null) 
			message = message.replace("$patientId", patientId);
		
		ServiceClient sender = getRepositoryServiceClient();			
		
		OMElement request = OMUtil.xmlStringToOM(message);			
		
		//Add a referral summary document
		request = addOneDocument(request, document1, uuid1);
		//Add a Discharge summary documents
		request = addOneDocument(request, document2, uuid2);

		System.out.println("Request:\n" +request);
		OMElement response = sender.sendReceive( request );
		assertNotNull(response); 

		OMAttribute status = response.getAttribute(new QName("status"));
		assertEquals("urn:oasis:names:tc:ebxml-regrep:ResponseStatusType:Success", status.getAttributeValue());
		
		String result = response.toString();
		System.out.println("Result:\n" +result);
		
		String uuids = uuid1 +"','"+uuid2;
		return uuids;
	}