import java.net.*;
import udir.types.eksamensplan.*;
import javax.xml.bind.*;
import java.io.*;

public class EksamensplanExample {
	
	private static String baseAddress = "https://eksamen-sas.udir.no";

	public static void main(String[] args) throws Exception{		
			
			String uri = baseAddress + "/api/ekstern/eksamensplan";
			URL url = new URL(uri);
			HttpURLConnection connection = (HttpURLConnection) url.openConnection();
			connection.setRequestMethod("GET");
			connection.setRequestProperty("Accept", "application/xml");

			JAXBContext jc = JAXBContext.newInstance(EksamensplanResponse.class);
			InputStream xml = connection.getInputStream();			
			
			BufferedReader in = new BufferedReader(new InputStreamReader(xml));
			String line = null;
			while((line = in.readLine()) != null) {
  				System.out.println(line);
			}
			
			connection.disconnect();		
	}
}
import java.net.*;
import udir.types.eksamensplan.*;
import javax.xml.bind.*;
import java.io.*;

public class EksamensplanExample {
	
	private static String baseAddress = "https://eksamen-sas.udir.no";

	public static void main(String[] args) throws Exception{		
			
			String uri = baseAddress + "/api/ekstern/eksamensplan";
			URL url = new URL(uri);
			HttpURLConnection connection = (HttpURLConnection) url.openConnection();
			connection.setRequestMethod("GET");
			connection.setRequestProperty("Accept", "application/xml");

			JAXBContext jc = JAXBContext.newInstance(EksamensplanResponse.class);
			InputStream xml = connection.getInputStream();			
			
			EksamensplanResponse eksamensplaner = (EksamensplanResponse) jc.createUnmarshaller().unmarshal(xml);
			
			System.out.println("Fagkoder i eksamensplanen:");
			for(EksamensplanType eksamensplan : eksamensplaner.getEksamensplaner().getEksamensplan())
			{
				for(EksamenType eksamen : eksamensplan.getEksamener().getEksamen())
				{
					System.out.println(eksamen.getFagkode());
				}
			}
			
			connection.disconnect();		
	}
}
--- 
+++ 
@@ -18,15 +18,10 @@
 			JAXBContext jc = JAXBContext.newInstance(EksamensplanResponse.class);
 			InputStream xml = connection.getInputStream();			
 			
-			EksamensplanResponse eksamensplaner = (EksamensplanResponse) jc.createUnmarshaller().unmarshal(xml);
-			
-			System.out.println("Fagkoder i eksamensplanen:");
-			for(EksamensplanType eksamensplan : eksamensplaner.getEksamensplaner().getEksamensplan())
-			{
-				for(EksamenType eksamen : eksamensplan.getEksamener().getEksamen())
-				{
-					System.out.println(eksamen.getFagkode());
-				}
+			BufferedReader in = new BufferedReader(new InputStreamReader(xml));
+			String line = null;
+			while((line = in.readLine()) != null) {
+  				System.out.println(line);
 			}
 			
 			connection.disconnect();		
Print out inputstream from eksamensplan
