Beispiel #1
0
  public static Object getWSClient(
      String wsdlURL, QName SERVICE_NAME, Boolean clientSchemaValidation, Class SEI) {
    try {
      File wsdlFile = new File(wsdlURL);

      URL url;
      if (wsdlFile.exists()) {
        url = wsdlFile.toURI().toURL();
      } else {
        url = new URL(wsdlURL);
      }

      System.out.println(
          "Creating client service with wsdl url: "
              + url
              + ", SERVICE QNAME: "
              + SERVICE_NAME
              + " ...");
      Service ss = Service.create(url, SERVICE_NAME);

      Object port = ss.getPort(SEI);
      if (clientSchemaValidation) {
        BindingProvider provider = (BindingProvider) port;
        provider.getRequestContext().put("schema-validation-enabled", "true");
      }
      return port;
    } catch (MalformedURLException e) {
      e.printStackTrace();
    }
    return null;
  }
Beispiel #2
0
  private void initPort(
      BindingProvider bindingProvider,
      String baseurl,
      SSLSocketFactory sslFactory,
      boolean soapMessage) {
    if (baseurl != null) {
      bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, baseurl);
      if (soapMessage) {
        List<Handler> handlerChain = new LinkedList<Handler>();
        handlerChain.add(new TraceHandler());
        bindingProvider.getBinding().setHandlerChain(handlerChain);
      }
    }

    // uncomment this lines if you what to use spécific keyStore and trustStore,
    // and not the default parameters from JVM. Do not forget to handle correctly
    // the exceptions.
    if (sslFactory != null) {
      try {
        bindingProvider.getRequestContext().put(JAXWSProperties.SSL_SOCKET_FACTORY, sslFactory);
      } catch (Exception ex) {
        // do something to log/track execptions
        ex.printStackTrace();
      }
    }
  }
Beispiel #3
0
  public void testHeaderWithNull() throws Exception {
    TestLogger.logger.debug("------------------------------");
    TestLogger.logger.debug("Test : " + getName());

    BareDocLitService service = new BareDocLitService();
    DocLitBarePortType proxy = service.getBareDocLitPort();
    BindingProvider p = (BindingProvider) proxy;
    p.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
    p.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "headerTest");
    p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT_URL);

    // Don't write a header element when the @WebParam header parameter is null.
    p.getRequestContext()
        .put(org.apache.axis2.jaxws.Constants.WRITE_HEADER_ELEMENT_IF_NULL, Boolean.FALSE);

    String request = null; // No header
    String response = proxy.headerTest(1, request);
    assertTrue(response != null);
    assertTrue(response.indexOf("No Header") > 0);

    // Try the test again
    request = null;
    response = proxy.headerTest(1, request);
    assertTrue(response != null);
    assertTrue(response.indexOf("No Header") > 0);

    TestLogger.logger.debug("------------------------------");
  }
Beispiel #4
0
  @org.junit.Test
  public void testPlaintextPrincipal() throws Exception {

    SpringBusFactory bf = new SpringBusFactory();
    URL busFile = UsernameTokenTest.class.getResource("client.xml");

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

    URL wsdl = UsernameTokenTest.class.getResource("DoubleItUt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItPlaintextPrincipalPort");
    DoubleItPortType utPort = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(utPort, test.getPort());

    if (test.isStreaming()) {
      SecurityTestUtil.enableStreaming(utPort);
    }

    ((BindingProvider) utPort).getRequestContext().put(SecurityConstants.USERNAME, "Alice");
    utPort.doubleIt(25);

    try {
      ((BindingProvider) utPort).getRequestContext().put(SecurityConstants.USERNAME, "Frank");
      utPort.doubleIt(30);
      fail("Failure expected on a user with the wrong role");
    } catch (javax.xml.ws.soap.SOAPFaultException ex) {
      String error = "Unauthorized";
      assertTrue(ex.getMessage().contains(error));
    }

    ((java.io.Closeable) utPort).close();
    bus.shutdown(true);
  }
Beispiel #5
0
  public void testTwoWaySync() {
    TestLogger.logger.debug("------------------------------");
    TestLogger.logger.debug("Test : " + getName());

    try {

      BareDocLitService service = new BareDocLitService();
      DocLitBarePortType proxy = service.getBareDocLitPort();
      BindingProvider p = (BindingProvider) proxy;
      p.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
      p.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, "twoWaySimple");
      p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, ENDPOINT_URL);

      String response = proxy.twoWaySimple(10);
      TestLogger.logger.debug("Sync Response =" + response);

      // Try the call again
      response = proxy.twoWaySimple(10);

      TestLogger.logger.debug("Sync Response =" + response);
      TestLogger.logger.debug("------------------------------");
    } catch (Exception e) {
      e.printStackTrace();
      fail();
    }
  }
  public static void main(String[] args) {

    String trustStore = null;
    trustStore = "wso2carbon.jks";
    System.setProperty("javax.net.ssl.trustStore", trustStore);
    System.setProperty("javax.net.ssl.trustStorePassword", "wso2carbon");

    HolamundoWSDL service = new HolamundoWSDL();
    HolamundoPortType port = service.getHolamundoHttpsSoap12Endpoint();

    BindingProvider bp = (BindingProvider) port;
    bp.getRequestContext()
        .put(
            BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
            "https://localhost:9445/services/HolamundoWSDL");

    Persona persona = new Persona();
    persona.setNombre("Jorge");
    persona.setApellidos("Infante Osorio");

    PersonaRespuesta response;
    try {
      response = port.holaati(persona);
      System.out.println(response.getSaludo().toString());

    } catch (HolaatiFault_Exception e) {
      System.out.println("ERROR: " + e.getMessage());
    } catch (Exception e) {
      System.out.println("ERROR STARTUP: " + e.getMessage());
    }
  }
  @Override
  protected void doGet(HttpServletRequest req, HttpServletResponse resp)
      throws ServletException, IOException {

    /*
     * Add client handler chain
     */
    BindingProvider bindingProvider = (BindingProvider) client;
    List<Handler> handlers = new ArrayList<Handler>(1);
    handlers.add(new JaxWSHeaderContextProcessor());
    bindingProvider.getBinding().setHandlerChain(handlers);

    /*
     * Lookup the DNS name of the server from the environment and set the endpoint address on the client.
     */
    String openshift = System.getenv("OPENSHIFT_APP_DNS");
    if (openshift != null) {
      bindingProvider
          .getRequestContext()
          .put(
              BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
              "http://" + openshift + "/RestaurantServiceAT");
    }

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    out.write(
        "<h1>Quickstart: This example demonstrates the deployment of a WS-AT (WS-AtomicTransaction) enabled JAX-WS Web service bundled in a war archive for deployment to *JBoss Enterprise Application Platform 6*.</h1>");

    System.out.println("[CLIENT] Creating a new WS-AT User Transaction");
    UserTransaction ut = UserTransactionFactory.userTransaction();
    try {
      System.out.println(
          "[CLIENT] Beginning Atomic Transaction (All calls to Web services that support WS-AT wil be included in this transaction)");
      ut.begin();
      System.out.println("[CLIENT] invoking makeBooking() on WS");
      client.makeBooking();
      System.out.println(
          "[CLIENT] committing Atomic Transaction (This will cause the AT to complete successfully)");
      ut.commit();

      out.write("<p><b>Transaction succeeded!</b></p>");

    } catch (Exception e) {
      e.printStackTrace();

      out.write("<p><b>Transaction failed with the following error:</b></p>");
      out.write("<p><blockquote>");
      out.write(e.toString());
      out.write("</blockquote></p>");
    } finally {
      rollbackIfActive(ut);
      client.reset();

      out.write(
          "<p><i>Go to your JBoss Application Server console or Server log to see the detailed result of the transaction.</i></p>");
    }
  }
 /**
  * Sets the request context parameters for the port. Includes setting the username and password
  * for each request.
  *
  * @param port The web service port.
  */
 protected void setContextParameters(BindingProvider port) {
   if (userName != null) {
     port.getRequestContext().put(com.sun.xml.wss.XWSSConstants.USERNAME_PROPERTY, userName);
   }
   if (options != null && options.length > 0) {
     port.getRequestContext()
         .put(com.sun.xml.wss.XWSSConstants.PASSWORD_PROPERTY, new String(options));
   }
 }
    public void setEndpoint(String endpointUrl) {
      BindingProvider bp = (BindingProvider) _proxy;
      bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);

      if (_dispatch != null) {
        bp = (BindingProvider) _dispatch;
        bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);
      }
    }
Beispiel #10
0
  /** Configures SOAP binding of the given SOAP port. */
  private void configureBinding(Object port) {
    BindingProvider bindingProvider = (BindingProvider) port;

    Map<String, Object> reqContext = bindingProvider.getRequestContext();
    reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceUrl);

    Binding binding = bindingProvider.getBinding();
    SOAPBinding soapBinding = (SOAPBinding) binding;
    soapBinding.setMTOMEnabled(wsTransactionConfiguration.isMtom());
  }
  public TestSubmissionEmail getPort() {
    String EPPath =
        "/soa-infra/services/default/Lab2ptEmailFormatter/testsubmissionemail_client_ep";
    /*
        String devServer = "http://soadev.cap.org:8001";
        String tstServer = "http://soatst.cap.org:8001";
        String ssPc = "http://dw764760cf1v9k1.cap.org:8001";
        String soapUI = "http://localhost:8088";
    //     String surl = tstServer + EPPath;
    */
    String soaServer = null;

    try {
      String server = InfraConfig.getString("org.cap.submission.emailFormatter.server");
      String port = InfraConfig.getString("org.cap.submission.emailFormatter.port");
      soaServer = "http://" + server + ":" + port;
    } catch (ExceptionInInitializerError e) {
      System.err.println(
          "Error: Unable to get email formatter server name, org.cap.submission.emailFormatter.server");
      System.err.println(e.getMessage());
      soaServer = null;
    } catch (NoClassDefFoundError e) {
      System.err.println(
          "Error: Unable to locate InfraConfig class to get email formatter server name, org.cap.submission.emailFormatter.server");
      System.err.println(e.getMessage());
      soaServer = null;
    }

    String surl = soaServer + EPPath;
    TestSubmissionEmail port = null;
    URL url;
    try {
      URL baseUrl = new File(".").toURL();
      url = new URL(baseUrl, surl + "?wsdl");
      //      System.out.println("getMailPort:" + url);

      // 1st argument service URI, refer to wsdl document above
      // 2nd argument is service name, refer to wsdl document above
      QName qname =
          new QName(
              "http://xmlns.oracle.com/Lab2ptEmailFormatter_jws/Lab2ptEmailFormatter/TestSubmissionEmail",
              "testsubmissionemail_client_ep");
      Testsubmissionemail_client_ep service = new Testsubmissionemail_client_ep(url, qname);
      port = service.getTestSubmissionEmail_pt();

      BindingProvider bp = (BindingProvider) port;
      Map<String, Object> context = bp.getRequestContext();
      Object oldAddress = context.get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
      context.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, surl);
    } catch (MalformedURLException e) {
      System.out.println("Failed to create wsdlLocationURL using " + surl);
    }
    return port;
  }
  private void importAppProperties(boolean request) {
    if (_bindingProvider == null) return;

    if (request) {
      _logicalContext.putAll(_bindingProvider.getRequestContext(), Scope.APPLICATION);
      _soapContext.putAll(_bindingProvider.getRequestContext(), Scope.APPLICATION);
    } else {
      _logicalContext.putAll(_bindingProvider.getResponseContext(), Scope.APPLICATION);
      _soapContext.putAll(_bindingProvider.getResponseContext(), Scope.APPLICATION);
    }
  }
  private NotificationProducer createPort() {
    NotificationProducer port =
        new NotificationProducerHttp(this.getClass().getResource(WSDL_LOCATION))
            .getNotificationProducerSoapHttp();
    BindingProvider bindingProvider = (BindingProvider) port;
    bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpoint);
    bindingProvider.getRequestContext().put(JAXWSProperties.CONNECT_TIMEOUT, connectTimeout);
    bindingProvider.getRequestContext().put(JAXWSProperties.REQUEST_TIMEOUT, requestTimeout);

    return port;
  }
Beispiel #14
0
  private Iti42PortType getClient(String wsdlLocation, String serviceURL) {
    URL wsdlURL = getClass().getClassLoader().getResource(wsdlLocation);
    Service service =
        Service.create(wsdlURL, ITI_42.getWsTransactionConfiguration().getServiceName());
    Iti42PortType client =
        (Iti42PortType) service.getPort(ITI_42.getWsTransactionConfiguration().getSei());

    BindingProvider bindingProvider = (BindingProvider) client;
    Map<String, Object> reqContext = bindingProvider.getRequestContext();
    reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serviceURL);
    return client;
  }
  public Otrs31TicketerPlugin() {
    m_configDao = new DefaultOtrsConfigDao();
    m_ticketConnector = new GenericTicketConnector().getGenericTicketConnectorPort();

    BindingProvider bindingProvider = (BindingProvider) m_ticketConnector;
    bindingProvider
        .getRequestContext()
        .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, m_configDao.getEndpoint());
    LOG.info(
        "Binding {} to value {}",
        BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
        m_configDao.getEndpoint());
  }
  private ManagementService getManagementService(String url, String user, String password)
      throws MalformedURLException {
    ManagementServiceService mgtServiceService =
        new ManagementServiceService(
            new URL(url + "/RAWS/ManagementService?wsdl"),
            new QName("http://service.web.rapidanalytics.de/", "ManagementServiceService"));

    ManagementService managementServicePort = mgtServiceService.getManagementServicePort();

    BindingProvider bp = (BindingProvider) managementServicePort;
    bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, user);
    bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, new String(password));
    return managementServicePort;
  }
Beispiel #17
0
  @org.junit.Test
  public void testUsernameOnBehalfOf() throws Exception {

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

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

    URL wsdl = UsernameOnBehalfOfTest.class.getResource("DoubleIt.wsdl");
    Service service = Service.create(wsdl, SERVICE_QNAME);
    QName portQName = new QName(NAMESPACE, "DoubleItOBOAsymmetricSAML2BearerPort");
    DoubleItPortType port = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port, test.getPort());

    TokenTestUtils.updateSTSPort((BindingProvider) port, test.getStsPort());

    if (test.isStreaming()) {
      SecurityTestUtil.enableStreaming(port);
    }

    // Transport port
    ((BindingProvider) port).getRequestContext().put("ws-security.username", "alice");
    doubleIt(port, 25);

    ((java.io.Closeable) port).close();

    DoubleItPortType port2 = service.getPort(portQName, DoubleItPortType.class);
    updateAddressPort(port2, test.getPort());

    TokenTestUtils.updateSTSPort((BindingProvider) port2, test.getStsPort());

    if (test.isStreaming()) {
      SecurityTestUtil.enableStreaming(port2);
    }

    ((BindingProvider) port2).getRequestContext().put("ws-security.username", "eve");
    // This time we expect a failure as the server validator doesn't accept "eve".
    try {
      doubleIt(port2, 30);
      fail("Failure expected on an unknown user");
    } catch (Exception ex) {
      // expected
    }

    ((java.io.Closeable) port2).close();
    bus.shutdown(true);
  }
  private Dispatch<SOAPMessage> createDispatch() throws Exception {
    URL wsdlURL = getWsdl();
    assertNotNull(wsdlURL);
    Service svc = Service.create(wsdlURL, serviceName);

    WebServiceFeature[] wsf = {new AddressingFeature(true)};

    Dispatch<SOAPMessage> dispatch =
        svc.createDispatch(portName, SOAPMessage.class, Service.Mode.MESSAGE, wsf);

    BindingProvider p = (BindingProvider) dispatch;
    p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointUrl);

    return dispatch;
  }
    public Dispatch<Source> getDispatch() {
      if (_dispatch == null) {
        QName portQName =
            new QName("http://service.agentservice.ewallet.esolutions.co.zw/", "AgentServiceSOAP");
        _dispatch = _service.createDispatch(portQName, Source.class, Service.Mode.MESSAGE);

        String proxyEndpointUrl = getEndpoint();
        BindingProvider bp = (BindingProvider) _dispatch;
        String dispatchEndpointUrl =
            (String) bp.getRequestContext().get(BindingProvider.ENDPOINT_ADDRESS_PROPERTY);
        if (!dispatchEndpointUrl.equals(proxyEndpointUrl))
          bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, proxyEndpointUrl);
      }
      return _dispatch;
    }
  public static void createSubscription(String Msýsdn) {
    PimsService ser = new PimsService();
    ObjectFactory o = new ObjectFactory();

    CreateSubscriptionRequest createSubscriptionRequest = o.createCreateSubscriptionRequest();

    PimsApiUserInformation pimsApiUserInformation = new PimsApiUserInformation();

    CrunchifyGetPropertyValues crunchifyGetPropertyValues = new CrunchifyGetPropertyValues();

    pimsApiUserInformation.setPimsApiUsername(crunchifyGetPropertyValues.getPimsApiUsername());
    // pimsApiUserInformation.setPimsApiUsername("MTQzNjI1Mzk4Mzg5N1NBUFBJS0FSR");
    pimsApiUserInformation.setPimsApiPassword(crunchifyGetPropertyValues.getPimsApiPassword());
    // pimsApiUserInformation.setPimsApiPassword("MTQzNjI1Mzk4NDE5N1NBUFBJS0FSR");

    SubscriptionOfferProfile subscriptionOfferProfile = new SubscriptionOfferProfile();

    subscriptionOfferProfile.setServiceProfileAttributeKey(
        crunchifyGetPropertyValues.getServiceProfileAttributeKey());
    subscriptionOfferProfile.setAttrValue("");

    Address address = new Address();
    address.setAsid("");
    address.setMsisdn(Msýsdn);

    NamedParam namedParam = new NamedParam();
    namedParam.setKey("");
    namedParam.setValue("");

    createSubscriptionRequest.setPimsApiUserInformation(pimsApiUserInformation);
    createSubscriptionRequest.setAddress(address);
    createSubscriptionRequest.setOfferKey(crunchifyGetPropertyValues.getOfferKey());
    createSubscriptionRequest.setPartnerReference(crunchifyGetPropertyValues.getPartnerReference());

    String endpointURL = crunchifyGetPropertyValues.getendpointURL();

    Pims port = ser.getPimsSoap11();

    BindingProvider bp = (BindingProvider) port;
    bp.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);

    try {
      CreateSubscriptionResponse response = port.createSubscription(createSubscriptionRequest);
      System.out.println(response.getResultCode());
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
 /**
  * create a client which can be used to make repeated invocations of the test web service methods
  */
 public XTSServiceTestClient() {
   // create a port and configure it with the WS context handler
   port = service.getXTSServiceTestPortType();
   List<Handler> handlerChain = new ArrayList<Handler>();
   handlerChain.add(new JaxWSHeaderContextProcessor());
   ((BindingProvider) port).getBinding().setHandlerChain(handlerChain);
 }
  public void init() {
    Bus oldbus = BusFactory.getThreadDefaultBus();
    BusFactory.setThreadDefaultBus(bus);
    try {
      GreeterService service =
          new GreeterService(GreeterTargetBean.class.getResource("/wsdl/hello_world.wsdl"));
      greeter = service.getGreeterPort();
      if (address != null) {
        ((BindingProvider) greeter)
            .getRequestContext()
            .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, address);
      }
      client = ClientProxy.getClient(greeter);
      System.out.println("Greeter endpoint: " + client.getEndpoint().getEndpointInfo());

    } catch (RuntimeException e) {
      e.printStackTrace();
      throw e;
    } catch (Error e) {
      e.printStackTrace();
      throw e;
    } finally {
      BusFactory.setThreadDefaultBus(oldbus);
    }
  }
  public PRPAIN201310UV02 pixConsumerPRPAIN201309UV(
      PRPAIN201309UV02 request, AssertionType assertion, NhinTargetSystemType target) {
    String url = null;
    PRPAIN201310UV02 resp = new PRPAIN201310UV02();

    // Get the URL to the Nhin Subject Discovery Service
    url = getUrl(target);

    if (NullChecker.isNotNullish(url)) {
      PIXConsumerPortType port = getPort(url);

      SamlTokenCreator tokenCreator = new SamlTokenCreator();
      Map requestContext =
          tokenCreator.CreateRequestContext(
              assertion, url, NhincConstants.SUBJECT_DISCOVERY_ACTION);

      ((BindingProvider) port).getRequestContext().putAll(requestContext);

      resp = port.pixConsumerPRPAIN201309UV(request);

    } else {
      log.error(
          "The URL for service: " + NhincConstants.SUBJECT_DISCOVERY_SERVICE_NAME + " is null");
    }

    return resp;
  }
  public void connect(TokenHolder tokenHolder) {
    for (Class<? extends PublicInterface> interface1 : interfaces) {
      JaxWsProxyFactoryBean cpfb = new JaxWsProxyFactoryBean();
      cpfb.setServiceClass(interface1);
      cpfb.setAddress(address + "/" + interface1.getSimpleName());
      Map<String, Object> properties = new HashMap<String, Object>();
      properties.put("mtom-enabled", Boolean.TRUE);
      cpfb.setProperties(properties);

      PublicInterface serviceInterface = (PublicInterface) cpfb.create();

      client = ClientProxy.getClient(serviceInterface);
      HTTPConduit http = (HTTPConduit) client.getConduit();
      http.getClient().setConnectionTimeout(360000);
      http.getClient().setAllowChunking(false);
      http.getClient().setReceiveTimeout(320000);

      if (!useSoapHeaderSessions) {
        ((BindingProvider) serviceInterface)
            .getRequestContext()
            .put(BindingProvider.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
      }
      add(interface1.getName(), serviceInterface);
    }
    tokenHolder.registerTokenChangeListener(this);
    notifyOfConnect();
  }
  private NotificationConsumer getPort(String url) {
    NotificationConsumer port = nhinService.getNotificationConsumerPort();

    log.info("Setting endpoint address to Nhin Hiem Notify Service to " + url);
    ((BindingProvider) port)
        .getRequestContext()
        .put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);

    return port;
  }
  private AdapterSubscriptionManagerPortType getPort(String url) {
    AdapterSubscriptionManagerPortType port = service.getAdapterSubscriptionManagerPortSoap();

    log.info("Setting endpoint address to Nhin Hiem Subscribe Service to " + url);
    ((BindingProvider) port)
        .getRequestContext()
        .put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);

    return port;
  }
Beispiel #27
0
  public static InitiatorPortType getInitiatorPort(MAP map, String action) {
    InitiatorService service = getInitiatorService();
    InitiatorPortType port =
        service.getPort(InitiatorPortType.class, new AddressingFeature(true, true));
    BindingProvider bindingProvider = (BindingProvider) port;
    String to = map.getTo();
    /*
           * we no longer have to add the JaxWS WSAddressingClientHandler because we can specify the WSAddressing feature
          List<Handler> customHandlerChain = new ArrayList<Handler>();
    customHandlerChain.add(new WSAddressingClientHandler());
    bindingProvider.getBinding().setHandlerChain(customHandlerChain);
           */
    Map<String, Object> requestContext = bindingProvider.getRequestContext();

    map.setAction(action);
    AddressingHelper.configureRequestContext(requestContext, map, to, action);

    return port;
  }
  private PIXConsumerPortType getPort(String url) {
    PIXConsumerPortType port = nhinService.getPIXConsumerPortSoap();

    log.info("Setting endpoint address to Nhin Subject Discovery Service to " + url);
    ((BindingProvider) port)
        .getRequestContext()
        .put(javax.xml.ws.BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);

    return port;
  }
  private static VboxPortType getPortType(String url) {
    if (null == port) {
      VboxService svc = new VboxService();
      port = svc.getVboxServicePort();
      ((BindingProvider) port)
          .getRequestContext()
          .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url);
    }

    return port;
  }
  private static VboxPortType getPortType() {
    if (null == port) {
      VboxService svc = new VboxService();
      port = svc.getVboxServicePort();
      ((BindingProvider) port)
          .getRequestContext()
          .put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:18083/");
    }

    return port;
  }