Esempio n. 1
0
  @org.junit.Test
  public void testRetrieveWSMEX() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = IssueUnitTest.class.getResource("cxf-client.xml");

    Bus bus = bf.createBus(busFile.toString());
    SpringBusFactory.setDefaultBus(bus);
    SpringBusFactory.setThreadDefaultBus(bus);

    // Get Metadata
    JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
    proxyFac.setBindingId(SoapBindingConstants.SOAP11_BINDING_ID);
    proxyFac.setAddress("https://localhost:" + STSPORT + "/SecurityTokenService/Transport/mex");
    MetadataExchange exc = proxyFac.create(MetadataExchange.class);
    Metadata metadata = exc.get2004();

    // Parse response (as per the STSClient)
    Definition definition = null;
    // Parse the MetadataSections into WSDL definition + associated schemas
    for (MetadataSection s : metadata.getMetadataSection()) {
      if ("http://schemas.xmlsoap.org/wsdl/".equals(s.getDialect())) {
        definition = bus.getExtension(WSDLManager.class).getDefinition((Element) s.getAny());
      }
    }
    assertNotNull(definition);
  }
Esempio n. 2
0
  public Protocol(URL url, Authenticator transport) {
    final JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setServiceClass(WSMAN.class);
    factory.setAddress(url.toString());
    factory.setBindingId("http://schemas.xmlsoap.org/wsdl/soap12/");
    wsmanService = WSMAN.class.cast(factory.create());

    this.transport = transport;
  }