1 package org.objectweb.celtix.systest.ws.addressing; 2 3 4 import java.net.URL ; 5 import java.util.List ; 6 import java.util.logging.Level ; 7 import java.util.logging.Logger ; 8 9 import javax.xml.ws.Endpoint; 10 import javax.xml.ws.handler.Handler; 11 12 import org.objectweb.celtix.systest.common.TestServerBase; 13 14 public class Server extends TestServerBase implements VerificationCache { 15 16 private String verified; 17 18 protected void run() { 19 GreeterImpl implementor = new GreeterImpl(); 20 implementor.verificationCache = this; 21 String address = "http://localhost:9008/SoapContext/SoapPort"; 22 URL url = getClass().getResource("client.xml"); 23 assertNotNull("cannot find test resource", url); 24 String configFileName = url.toString(); 25 if (configFileName != null) { 26 System.setProperty("celtix.config.file", configFileName); 27 } 28 Endpoint endpoint = Endpoint.publish(address, implementor); 29 List <Handler> handlerChain = endpoint.getBinding().getHandlerChain(); 30 for (Object h : handlerChain) { 31 if (h instanceof MAPVerifier) { 32 ((MAPVerifier)h).verificationCache = this; 33 } else if (h instanceof HeaderVerifier) { 34 ((HeaderVerifier)h).verificationCache = this; 35 } 36 } 37 } 38 39 public static void main(String [] args) { 40 try { 41 Server s = new Server(); 42 s.start(); 43 } catch (Exception ex) { 44 ex.printStackTrace(); 45 System.exit(-1); 46 } finally { 47 System.out.println("done!"); 48 } 49 } 50 51 public void put(String verification) { 52 if (verification != null) { 53 verified = verified == null 54 ? verification 55 : verified + "; " + verification; 56 } 57 } 58 59 65 protected boolean verify(Logger log) { 66 if (verified != null) { 67 log.log(Level.WARNING, 68 "MAP/Header verification failed: {0}", 69 verified); 70 } 71 return verified == null; 72 } 73 } 74 | Popular Tags |