1 16 17 18 26 27 package test.wsdl.qualify2; 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.Attr ; 34 import org.w3c.dom.Element ; 35 36 public class AttributeQualify_BindingImpl implements test.wsdl.qualify2.AttributeQualify_PortType { 37 38 public static final String NAMESPACE = "urn:attributeQualify"; 39 40 public test.wsdl.qualify2.Phone echoPhone(test.wsdl.qualify2.Phone in) throws java.rmi.RemoteException { 41 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 67 String bodyNS = body.getNamespaceURI(); 68 if (! NAMESPACE.equals(bodyNS)) 69 throw new AxisFault("On Server: Namespace of body element incorrect: " + 70 bodyNS + " should be: " + NAMESPACE); 71 72 Attr ageAttr = body.getAttributeNode("age"); 74 if (ageAttr.getNamespaceURI() != null) { 75 throw new AxisFault("On Server: Namespace of age attribute incorrect: " 76 + ageAttr.getNamespaceURI() + " should be: NULL"); 77 } 78 79 Attr hairAttr = body.getAttributeNodeNS(NAMESPACE, "hair"); 81 if (hairAttr == null) { 82 throw new AxisFault("On Server: Missing namespace for attribute 'hair' should be: " + NAMESPACE); 83 } 84 85 Attr colorAttr = body.getAttributeNodeNS(NAMESPACE, "color"); 86 if (hairAttr == null) { 87 throw new AxisFault("On Server: Missing namespace for attribute 'color' should be: " + NAMESPACE); 88 } 89 90 return in; 92 } 93 94 } 95 | Popular Tags |