1 16 17 18 26 27 package test.wsdl.qualify; 28 29 import org.apache.axis.AxisFault; 30 import org.apache.axis.Message; 31 import org.apache.axis.MessageContext; 32 import org.apache.axis.message.SOAPEnvelope; 33 import org.w3c.dom.Element ; 34 import org.w3c.dom.Node ; 35 import org.w3c.dom.NodeList ; 36 37 public class Qualify_BindingImpl implements test.wsdl.qualify.Qualify_Port { 38 39 public static final String namespace = "urn:qualifyTest"; 40 41 public java.lang.String simple(java.lang.String name) throws java.rmi.RemoteException { 42 MessageContext mc = MessageContext.getCurrentContext(); 45 Message request = mc.getRequestMessage(); 46 SOAPEnvelope env = request.getSOAPEnvelope(); 47 String requestString = request.getSOAPPartAsString(); 48 49 Element body; 50 try { 51 body = env.getFirstBody().getAsDOM(); 52 } catch (Exception e) { 53 throw new AxisFault("Unable to get request body as DOM Element on server"); 54 } 55 56 59 65 66 String simpleNS = body.getNamespaceURI(); 68 if (!simpleNS.equals(namespace) ) { 69 throw new AxisFault("Namespace of Simple element incorrect: " + 70 simpleNS + " should be: " + namespace); 71 } 72 73 NodeList list = body.getChildNodes(); 74 for(int i=0;i<list.getLength();i++) { 75 Node node = list.item(i); 76 if(node.getNodeType() == Node.TEXT_NODE) 77 continue; 78 String nameNS = node.getNamespaceURI(); 79 if (!nameNS.equals("urn:qualifyTest")) { 80 throw new AxisFault("Namespace of name element incorrect: " + 81 nameNS + " should be: urn:qualifyTest"); 82 } 83 } 84 85 return "Hello there: " + name; 87 } 88 89 public test.wsdl.qualify.__FormOverrideResponse_response formOverride(test.wsdl.qualify.__FormOverride_complex complex) throws java.rmi.RemoteException { 90 MessageContext mc = MessageContext.getCurrentContext(); 93 Message request = mc.getRequestMessage(); 94 SOAPEnvelope env = request.getSOAPEnvelope(); 95 String requestString = request.getSOAPPartAsString(); 96 97 Element body; 98 try { 99 body = env.getFirstBody().getAsDOM(); 100 } catch (Exception e) { 101 throw new AxisFault("Unable to get request body as DOM Element on server"); 102 } 103 106 114 115 String FormOverrideNS = body.getNamespaceURI(); 117 if (!FormOverrideNS.equals(namespace) ) { 118 throw new AxisFault("Namespace of FormOverrideNS element incorrect: " + 119 FormOverrideNS + " should be: " + namespace); 120 } 121 122 Node complexNode = body.getFirstChild(); 123 String complexNS = complexNode.getNamespaceURI(); 124 if (complexNS != null ) { 125 throw new AxisFault("Namespace of <complex> element incorrect: " + 126 complexNS + " should be: NULL"); 127 } 128 129 if (complexNode.hasChildNodes()) { 133 Node nameNode = complexNode.getFirstChild(); 134 String nameNS = nameNode.getNamespaceURI(); 135 if (!nameNS.equals(namespace)) { 136 throw new AxisFault("Namespace of <name> element incorrect: " + 137 nameNS + " should be: " + namespace); 138 } 139 } 140 141 test.wsdl.qualify.__FormOverrideResponse_response r = new __FormOverrideResponse_response(); 143 r.setName("Tommy"); 144 return r; 145 } 146 147 } 148 | Popular Tags |