Search in sources :

Example 16 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class JBWS2960TestCase method testOperations.

@Test
@RunAsClient
public void testOperations() throws Exception {
    Definition wsdl = getWSDLDefinition(wsdlFile.getAbsolutePath());
    PortType port = wsdl.getPortType(new QName("http://foobar.org/", "AddNumbers"));
    Operation operation = null;
    // addNumbersNoAction
    operation = this.getOperation(port, "addNumbersNoAction");
    this.assertInput(operation, "http://foobar.org/AddNumbers/addNumbersNoActionRequest");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbersNoActionResponse");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersNoAction/Fault/AddNumbersException", "AddNumbersException");
    // addNumbersEmptyAction
    operation = this.getOperation(port, "addNumbersEmptyAction");
    this.assertInput(operation, "http://foobar.org/AddNumbers/addNumbersEmptyActionRequest");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbersEmptyActionResponse");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersEmptyAction/Fault/AddNumbersException", "AddNumbersException");
    // addNumbers
    operation = this.getOperation(port, "addNumbers");
    this.assertInput(operation, "http://example.com/input");
    this.assertOutput(operation, "http://example.com/output");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbers/Fault/AddNumbersException", "AddNumbersException");
    // addNumbers2
    operation = this.getOperation(port, "addNumbers2");
    this.assertInput(operation, "http://example.com/input2");
    this.assertOutput(operation, "http://example.com/output2");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbers2/Fault/AddNumbersException", "AddNumbersException");
    // addNumbers3
    operation = this.getOperation(port, "addNumbers3");
    this.assertInput(operation, "http://example.com/input3");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbers3Response");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbers3/Fault/AddNumbersException", "AddNumbersException");
    // addNumbers4
    operation = this.getOperation(port, "addNumbers4");
    this.assertInput(operation, "http://example.com/input4");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbers4Response");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbers4/Fault/AddNumbersException", "AddNumbersException");
    // addNumbersFault1
    operation = this.getOperation(port, "addNumbersFault1");
    this.assertInput(operation, "finput1");
    this.assertOutput(operation, "foutput1");
    this.assertFault(operation, "http://fault1", "AddNumbersException");
    // addNumbersFault2
    operation = this.getOperation(port, "addNumbersFault2");
    this.assertInput(operation, "finput2");
    this.assertOutput(operation, "foutput2");
    this.assertFault(operation, "http://fault2/addnumbers", "AddNumbersException");
    this.assertFault(operation, "http://fault2/toobignumbers", "TooBigNumbersException");
    // addNumbersFault3
    operation = this.getOperation(port, "addNumbersFault3");
    this.assertInput(operation, "finput3");
    this.assertOutput(operation, "foutput3");
    this.assertFault(operation, "http://fault3/addnumbers", "AddNumbersException");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersFault3/Fault/TooBigNumbersException", "TooBigNumbersException");
    // addNumbersFault4
    operation = this.getOperation(port, "addNumbersFault4");
    this.assertInput(operation, "http://foobar.org/AddNumbers/addNumbersFault4Request");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbersFault4Response");
    this.assertFault(operation, "http://fault4/addnumbers", "AddNumbersException");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersFault4/Fault/TooBigNumbersException", "TooBigNumbersException");
    // addNumbersFault5
    operation = this.getOperation(port, "addNumbersFault5");
    this.assertInput(operation, "http://foobar.org/AddNumbers/addNumbersFault5Request");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbersFault5Response");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersFault5/Fault/AddNumbersException", "AddNumbersException");
    this.assertFault(operation, "http://fault5/toobignumbers", "TooBigNumbersException");
    // addNumbersFault6
    operation = this.getOperation(port, "addNumbersFault6");
    this.assertInput(operation, "http://foobar.org/AddNumbers/addNumbersFault6Request");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbersFault6Response");
    this.assertFault(operation, "http://fault6/addnumbers", "AddNumbersException");
    this.assertFault(operation, "http://fault6/toobignumbers", "TooBigNumbersException");
    // addNumbersFault7
    operation = this.getOperation(port, "addNumbersFault7");
    this.assertInput(operation, "http://foobar.org/AddNumbers/addNumbersFault7Request");
    this.assertOutput(operation, "http://foobar.org/AddNumbers/addNumbersFault7Response");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersFault7/Fault/AddNumbersException", "AddNumbersException");
    this.assertFault(operation, "http://foobar.org/AddNumbers/addNumbersFault7/Fault/TooBigNumbersException", "TooBigNumbersException");
}
Also used : QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) Operation(javax.wsdl.Operation) PortType(javax.wsdl.PortType) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 17 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class EarTestCase method testEJB3Endpoint.

@Test
@RunAsClient
public void testEJB3Endpoint() throws Exception {
    String soapAddress = "http://" + baseURL.getHost() + ":" + baseURL.getPort() + "/jaxws-samples-eardeployment-ejb3/EndpointService/Endpoint";
    QName serviceName = new QName("http://eardeployment.jaxws/", "EndpointService");
    Service service = Service.create(new URL(soapAddress + "?wsdl"), serviceName);
    Endpoint port = service.getPort(Endpoint.class);
    Definition wsdl = getWSDLDefinition(soapAddress + "?wsdl");
    String nsURI = wsdl.getNamespace("jbws1616");
    assertEquals("http://jira.jboss.org/jira/browse/JBWS-1616", nsURI);
    BindingProvider bp = (BindingProvider) port;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, soapAddress);
    String helloWorld = "Hello world!";
    String retObj = port.echo(helloWorld);
    assertEquals(helloWorld, retObj);
}
Also used : QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) Service(javax.xml.ws.Service) BindingProvider(javax.xml.ws.BindingProvider) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 18 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class JBossWebServicesEarTestCase method getWSDLDefinition.

private Definition getWSDLDefinition(String wsdlLocation) throws Exception {
    WSDLFactory wsdlFactory = WSDLFactory.newInstance();
    WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
    Definition definition = wsdlReader.readWSDL(null, wsdlLocation);
    return definition;
}
Also used : WSDLFactory(javax.wsdl.factory.WSDLFactory) Definition(javax.wsdl.Definition) WSDLReader(javax.wsdl.xml.WSDLReader)

Example 19 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class JBossWebServicesEarTestCase method testJSEEndpoint.

@Test
@RunAsClient
public void testJSEEndpoint() throws Exception {
    String soapAddress = baseURL + "JSEBean";
    QName serviceName = new QName("http://eardeployment.jaxws/", "EndpointService");
    Service service = Service.create(new URL(soapAddress + "?wsdl"), serviceName);
    Endpoint port = service.getPort(Endpoint.class);
    // check soap address rewrite to verify jboss-webservices.xml override
    Definition wsdl = getWSDLDefinition(soapAddress + "?wsdl");
    SOAPAddress sa = (SOAPAddress) wsdl.getService(serviceName).getPort("EndpointPort").getExtensibilityElements().iterator().next();
    assertEquals("https://foo-test:" + JBossWSTestHelper.getSecureServerPort(null, null) + "/earjse2/JSEBean", sa.getLocationURI());
    BindingProvider bp = (BindingProvider) port;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, soapAddress);
    String helloWorld = "Hello world!";
    String retObj = port.echo(helloWorld);
    assertEquals(helloWorld, retObj);
}
Also used : QName(javax.xml.namespace.QName) SOAPAddress(javax.wsdl.extensions.soap.SOAPAddress) Definition(javax.wsdl.Definition) Service(javax.xml.ws.Service) BindingProvider(javax.xml.ws.BindingProvider) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Example 20 with Definition

use of javax.wsdl.Definition in project jbossws-cxf by jbossws.

the class SOAPBindingTestCase method testWSDLAccess.

// [JBWS-1761] - WSProvide ignores SOAPBinding declaration
@Test
@RunAsClient
public void testWSDLAccess() throws Exception {
    URL wsdlURL = new URL(baseURL + "?wsdl");
    WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
    Definition wsdl = wsdlReader.readWSDL(wsdlURL.toString());
    String port = "SOAPEndpointPort";
    QName serviceQName = new QName("http://org.jboss.ws/jaxws/binding", "SOAPEndpointService");
    Binding wsdlBinding = wsdl.getService(serviceQName).getPort(port).getBinding();
    assertNotNull("Cannot find binding for port: " + port, wsdlBinding);
    String transport = null;
    @SuppressWarnings("unchecked") List<ExtensibilityElement> extList = wsdlBinding.getExtensibilityElements();
    for (ExtensibilityElement ext : extList) {
        if (ext instanceof SOAPBinding) {
            fail("Expected SOAP-1.2 binding");
        } else if (ext instanceof SOAP12Binding) {
            SOAP12Binding soapBinding = (SOAP12Binding) ext;
            transport = soapBinding.getTransportURI();
        }
    }
    if (isIntegrationCXF()) {
        System.out.println("FIXME: [CXF-2531] Wrong \"transport\" attribute in soap12:binding");
    } else {
        assertEquals("Invalid transport uri", "http://schemas.xmlsoap.org/soap/http", transport);
    }
}
Also used : SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) Binding(javax.wsdl.Binding) SOAP12Binding(javax.wsdl.extensions.soap12.SOAP12Binding) QName(javax.xml.namespace.QName) Definition(javax.wsdl.Definition) SOAPBinding(javax.wsdl.extensions.soap.SOAPBinding) URL(java.net.URL) WSDLReader(javax.wsdl.xml.WSDLReader) ExtensibilityElement(javax.wsdl.extensions.ExtensibilityElement) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) JBossWSTest(org.jboss.wsf.test.JBossWSTest)

Aggregations

Definition (javax.wsdl.Definition)226 Test (org.junit.Test)113 QName (javax.xml.namespace.QName)61 File (java.io.File)52 Document (org.w3c.dom.Document)44 Element (org.w3c.dom.Element)40 HashMap (java.util.HashMap)36 WSDLReader (javax.wsdl.xml.WSDLReader)35 RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)31 JBossWSTest (org.jboss.wsf.test.JBossWSTest)31 Service (javax.wsdl.Service)24 ExtensibilityElement (javax.wsdl.extensions.ExtensibilityElement)23 URL (java.net.URL)21 ArrayList (java.util.ArrayList)21 Port (javax.wsdl.Port)21 WSDLToIDLAction (org.apache.cxf.tools.corba.processors.wsdl.WSDLToIDLAction)21 Bus (org.apache.cxf.Bus)20 ServiceInfo (org.apache.cxf.service.model.ServiceInfo)20 WSDLManager (org.apache.cxf.wsdl.WSDLManager)20 IOException (java.io.IOException)18