1 16 17 package org.apache.wsdl; 18 19 import org.apache.axis2.wsdl.WSDLVersionWrapper; 20 import org.apache.axis2.wsdl.builder.WOMBuilderFactory; 21 import org.apache.wsdl.extensions.ExtensionConstants; 22 import org.apache.wsdl.extensions.SOAPOperation; 23 24 import javax.wsdl.Definition; 25 import javax.xml.namespace.QName ; 26 import java.io.FileInputStream ; 27 import java.io.InputStream ; 28 import java.util.Iterator ; 29 30 34 public class SOAPActionTest extends AbstractTestCase { 35 36 private WSDLDescription womDescription = null; 37 38 private Definition wsdl4jDefinition = null; 39 40 public SOAPActionTest(String args) { 41 super(args); 42 } 43 44 protected void setUp() throws Exception { 45 super.setUp(); 46 WSDLVersionWrapper wsdlVersionWrapper = null; 47 if (null == this.womDescription) { 48 InputStream in = new FileInputStream ( 49 getTestResourceFile("InteropTestDocLit2.wsdl")); 50 wsdlVersionWrapper = WOMBuilderFactory.getBuilder( 51 WOMBuilderFactory.WSDL11).build(in); 52 this.womDescription = wsdlVersionWrapper.getDescription(); 53 54 } 55 if (null == wsdl4jDefinition) { 56 this.wsdl4jDefinition = wsdlVersionWrapper.getDefinition(); 57 } 58 } 59 60 public void testSOAPActionPopulation() { 61 WSDLBindingOperation bindingOperation = womDescription 62 .getFirstBinding().getBindingOperation( 63 new QName ( 64 "http://soapinterop.org/WSDLInteropTestDocLit", 65 "echoVoid")); 66 Iterator iterator = bindingOperation.getExtensibilityElements() 67 .iterator(); 68 while (iterator.hasNext()) { 69 WSDLExtensibilityElement element = (WSDLExtensibilityElement) iterator 70 .next(); 71 SOAPOperation soapOperation = null; 72 if (ExtensionConstants.SOAP_OPERATION.equals(element.getType())) { 73 soapOperation = (SOAPOperation) element; 74 } 75 if (soapOperation == null) { 76 fail(); 77 } else { 78 assertEquals(soapOperation.getSoapAction(), 79 "http://soapinterop.org/"); 80 } 81 } 82 } 83 84 } | Popular Tags |