javax.wsdl.extensions.soap12.SOAP12Address Java Examples

The following examples show how to use javax.wsdl.extensions.soap12.SOAP12Address. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WsdlUtils.java    From hop with Apache License 2.0 5 votes vote down vote up
/**
 * Get the SOAP address location for the specified port.
 *
 * @param p A WSDL Port instance.
 * @return The SOAP address URI.
 */
protected static String getSOAPAddress( Port p ) {
  ExtensibilityElement e = findExtensibilityElement( (ElementExtensible) p, SOAP_PORT_ADDRESS_NAME );
  if ( e instanceof SOAP12Address ) {
    return ( (SOAP12Address) e ).getLocationURI();
  } else if ( e instanceof SOAPAddress ) {
    return ( (SOAPAddress) e ).getLocationURI();
  }

  return null;
}
 
Example #2
Source File: WSDLUtils.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
public static String getPortAddress(final Port port) {
    final Collection<?> extensibilityElements = port.getExtensibilityElements();
    SOAPAddress soapAddress = findExtensibilityElement(extensibilityElements, SOAPAddress.class);
    if (null != soapAddress) {
        return soapAddress.getLocationURI();
    }
    SOAP12Address soap12Address = findExtensibilityElement(extensibilityElements, SOAP12Address.class);
    if (null != soap12Address) {
        return soap12Address.getLocationURI();
    }
    return null;
}
 
Example #3
Source File: WSDLGetUtils.java    From cxf with Apache License 2.0 5 votes vote down vote up
protected void setSoapAddressLocationOn(Port port, String url) {
    List<?> extensions = port.getExtensibilityElements();
    for (Object extension : extensions) {
        if (extension instanceof SOAP12Address) {
            ((SOAP12Address)extension).setLocationURI(url);
        } else if (extension instanceof SOAPAddress) {
            ((SOAPAddress)extension).setLocationURI(url);
        }
    }
}
 
Example #4
Source File: WsdlUtils.java    From pentaho-kettle with Apache License 2.0 5 votes vote down vote up
/**
 * Get the SOAP address location for the specified port.
 *
 * @param p
 *          A WSDL Port instance.
 * @return The SOAP address URI.
 */
protected static String getSOAPAddress( Port p ) {
  ExtensibilityElement e = findExtensibilityElement( p, SOAP_PORT_ADDRESS_NAME );
  if ( e instanceof SOAP12Address ) {
    return ( (SOAP12Address) e ).getLocationURI();
  } else if ( e instanceof SOAPAddress ) {
    return ( (SOAPAddress) e ).getLocationURI();
  }

  return null;
}
 
Example #5
Source File: ComponentBuilder.java    From tesb-studio-se with Apache License 2.0 4 votes vote down vote up
private static ServiceInfo populateComponent(Service service) {
    ServiceInfo serviceInfo = new ServiceInfo();
    serviceInfo.setServiceName(service.getQName());
    Collection<Port> ports = service.getPorts().values();
    for (Port port : ports) {
        String soapLocation = null;
        SOAPAddress soapAddress = findExtensibilityElement(port.getExtensibilityElements(), SOAPAddress.class);
        if (null != soapAddress) {
            soapLocation = soapAddress.getLocationURI();
        } else {
            SOAP12Address soap12Address = findExtensibilityElement(port.getExtensibilityElements(), SOAP12Address.class);
            if (null != soap12Address) {
                soapLocation = soap12Address.getLocationURI();
            }
        }
        Binding binding = port.getBinding();
        for (BindingOperation operation : (Collection<BindingOperation>) binding.getBindingOperations()) {
            SOAPOperation soapOperation = findExtensibilityElement(operation.getExtensibilityElements(), SOAPOperation.class);

            if (null != soapOperation && OPERATION_TYPE_RPC.equalsIgnoreCase(soapOperation.getStyle())) {
                // TESB-6151 disable display of unsupported RPC type.
                serviceInfo.setHasRpcOperation(true);
                continue;
            }
            OperationInfo operationInfo = new OperationInfo(operation.getOperation());
            operationInfo.setPortName(port.getName());
            operationInfo.setNamespaceURI(binding.getPortType().getQName().getNamespaceURI());
            if (soapOperation != null) {
                operationInfo.setSoapActionURI(soapOperation.getSoapActionURI());
            } else {
                SOAP12Operation soap12Operation = findExtensibilityElement(operation.getExtensibilityElements(),
                        SOAP12Operation.class);
                if (soap12Operation != null) {
                    operationInfo.setSoapActionURI(soap12Operation.getSoapActionURI());
                }
            }

            operationInfo.setTargetURL(soapLocation);
            serviceInfo.addOperation(operationInfo);
        }
    }
    return serviceInfo;
}
 
Example #6
Source File: PublishedEndpointUrlTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testPublishedEndpointUrl() throws Exception {

    Greeter implementor = new org.apache.hello_world_soap_http.GreeterImpl();
    String publishedEndpointUrl = "http://cxf.apache.org/publishedEndpointUrl";
    Bus bus = BusFactory.getDefaultBus();
    JaxWsServerFactoryBean svrFactory = new JaxWsServerFactoryBean();
    svrFactory.setBus(bus);
    svrFactory.setServiceClass(Greeter.class);
    svrFactory.setAddress("http://localhost:" + PORT + "/publishedEndpointUrl");
    svrFactory.setPublishedEndpointUrl(publishedEndpointUrl);
    svrFactory.setServiceBean(implementor);

    Server server = svrFactory.create();

    WSDLReader wsdlReader = WSDLFactory.newInstance().newWSDLReader();
    wsdlReader.setFeature("javax.wsdl.verbose", false);

    URL url = new URL(svrFactory.getAddress() + "?wsdl=1");
    HttpURLConnection connect = (HttpURLConnection)url.openConnection();
    assertEquals(500, connect.getResponseCode());

    Definition wsdl = wsdlReader.readWSDL(svrFactory.getAddress() + "?wsdl");
    assertNotNull(wsdl);

    Collection<Service> services = CastUtils.cast(wsdl.getAllServices().values());
    final String failMesg = "WSDL provided incorrect soap:address location";

    for (Service service : services) {
        Collection<Port> ports = CastUtils.cast(service.getPorts().values());
        for (Port port : ports) {
            List<?> extensions = port.getExtensibilityElements();
            for (Object extension : extensions) {
                String actualUrl = null;
                if (extension instanceof SOAP12Address) {
                    actualUrl = ((SOAP12Address)extension).getLocationURI();
                } else if (extension instanceof SOAPAddress) {
                    actualUrl = ((SOAPAddress)extension).getLocationURI();
                }

                //System.out.println("Checking url: " + actualUrl + " against " + publishedEndpointUrl);
                assertEquals(failMesg, publishedEndpointUrl, actualUrl);
            }
        }
    }
    server.stop();
    server.destroy();
    bus.shutdown(true);
}
 
Example #7
Source File: WSDLToServiceProcessorTest.java    From cxf with Apache License 2.0 4 votes vote down vote up
@Test
public void testNewServiceSoap12() throws Exception {
    String[] args = new String[] {"-soap12", "-transport", "soap",
                                  "-e", "SOAPService", "-p", "SoapPort", "-n",
                                  "Greeter_SOAPBinding", "-a",
                                  "http://localhost:9000/SOAPService/SoapPort", "-d",
                                  output.getCanonicalPath(),
                                  getLocation("/misctools_wsdl/hello_world_soap12.wsdl")};
    WSDLToService.main(args);

    File outputFile = new File(output, "hello_world_soap12-service.wsdl");
    assertTrue("New wsdl file is not generated", outputFile.exists());
    WSDLToServiceProcessor processor = new WSDLToServiceProcessor();
    processor.setEnvironment(env);
    try {
        processor.parseWSDL(outputFile.getAbsolutePath());
        Service service = processor.getWSDLDefinition().getService(
                                                                   new QName(processor
                                                                       .getWSDLDefinition()
                                                                       .getTargetNamespace(),
                                                                             "SOAPService"));
        if (service == null) {
            fail("Element wsdl:service serviceins Missed!");
        }
        Iterator<?> it = service.getPort("SoapPort").getExtensibilityElements().iterator();
        if (it == null || !it.hasNext()) {
            fail("Element wsdl:port portins Missed!");
        }

        while (it.hasNext()) {
            Object obj = it.next();
            if (obj instanceof SOAP12Address) {
                SOAP12Address soapAddress = (SOAP12Address)obj;
                assertNotNull(soapAddress.getLocationURI());
                assertEquals("http://localhost:9000/SOAPService/SoapPort", soapAddress.getLocationURI());
                break;
            }
        }
    } catch (ToolException e) {
        fail("Exception Encountered when parsing wsdl, error: " + e.getMessage());
    }

}
 
Example #8
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPAddress(Object obj) {
    return obj instanceof SOAPAddress || obj instanceof SOAP12Address;
}
 
Example #9
Source File: SOAPBindingUtil.java    From cxf with Apache License 2.0 4 votes vote down vote up
public static boolean isSOAPAddress(Object obj) {
    return obj instanceof SOAPAddress || obj instanceof SOAP12Address;
}