Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejava
titleEksempel på brug af NspSoapClient
linenumberstrue
import static dk.nsp.test.idp.EmployeeIdentities.jordemoderAdaLovelace;

private static final URI NTS_ENDPOINT = URI.create("http://test1-cnsp.ekstern-test.nspop.dk:8080/nts/service");

private static final String NTS_ACTION = "http://sundhedsdatastyrelsen.dk/soap/2022/10/21/actions#SomeSoapAction";

private static final String NTS_REQUEST_BODY = "<Request/>";

public void employeeExample() throws Exception {
	try (NspSoapClient client = new NspSoapClient(System.out::println)) {
		try (NspSoapResponse response = client.request(NTS_ENDPOINT, NTS_ACTION).as(jordemoderAdaLovelace()).execute(NTS_REQUEST_BODY)) {
			assertNotNull(response);
			assertFalse(response.isFault());
			String xml = IOUtils.toString(response.getResponse(), "utf-8");
			assertTrue(xml.contains("OK"));
		}
	}
}

...