Java Examples for com.sun.xml.ws.transport.http.client.HttpTransportPipe

The following java examples will help you to understand the usage of com.sun.xml.ws.transport.http.client.HttpTransportPipe. These source code samples are taken from different open source projects.

Example 1
Project: glassfish-master  File: Client.java View source code
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws javax.servlet.ServletException {
    try {
        com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump = true;
        SubtractNumbers port2 = service.getSubtractNumbersPort();
        ((BindingProvider) port2).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/webserviceref-cobundle/SubtractNumbersService?WSDL");
        int ret = port2.subtractNumbers(9999, 4444);
        PrintWriter out = resp.getWriter();
        resp.setContentType("text/html");
        out.println("<html>");
        out.println("<head>");
        out.println("<title>TestServlet</title>");
        out.println("</head>");
        out.println("<body>");
        out.println("<p>");
        out.println("So the RESULT OF SUBTRACT SERVICE IS :");
        out.println("</p>");
        out.println("[" + ret + "]");
        out.println("</body>");
        out.println("</html>");
        out.flush();
        out.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Example 2
Project: siu-master  File: ImportChargeITest.java View source code
@Before
public void setUp() throws Exception {
    pnzr01581 = new InfoSystem("8201", "Комплексная система предоставления государственных и муниципальных услуг Пензенской области");
    CryptoProvider cryptoProvider = new CryptoProvider();
    XmlNormalizer xmlNormalizer = new XmlNormalizerImpl();
    rev111111 = new ClientRev111111(new ServiceDefinitionParser(), cryptoProvider, xmlNormalizer, null);
    client = new GMPClient3572();
    client.bindCryptoProvider(cryptoProvider);
    HttpTransportPipe.dump = true;
    ClientRev111111.validate = true;
}
Example 3
Project: jaxws-master  File: BasicAuthTest.java View source code
/*
     * Tests Standard HTTP Authorization header on server side
     */
public void testHttpMsgCtxt() throws Exception {
    final String prop = "com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump";
    String oldV = System.getProperty(prop);
    oldV = (oldV == null) ? "" : oldV;
    System.setProperty(prop, "true");
    Hello proxy = new HelloService().getHelloPort();
    BindingProvider bp = (BindingProvider) proxy;
    bp.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "auth-user");
    bp.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "auth-pass");
    PrintStream ps = System.err;
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    System.setErr(new PrintStream(baos));
    try {
        proxy.testHttpProperties();
    } catch (Exception ex) {
        ex.printStackTrace();
        assertTrue("The exception can not be soapfault exception", !(ex instanceof javax.xml.ws.ProtocolException));
    } finally {
        System.setErr(ps);
        System.setProperty(prop, oldV);
    }
    String dumpStr = baos.toString();
    System.out.println(dumpStr);
    boolean has403 = false;
    StringTokenizer tokenizer = new StringTokenizer(dumpStr, "\n");
    while (tokenizer.hasMoreTokens()) {
        String token = tokenizer.nextToken();
        if (token.indexOf("HTTP status code") != -1) {
            System.out.println("HTTP status code:" + token);
            if (token.indexOf("403") > 0)
                has403 = true;
        }
    }
    assertTrue("Server does not return 403 code", has403);
}
Example 4
Project: sf-api-connector-master  File: MetadataConnectionImplTest.java View source code
@Before
public void setUp() throws ApiException {
    this.username = ConnectionTestSfUserProps.getPropVal("com.palominolabs.test.crm.sf.conn.metadata.user");
    String password = ConnectionTestSfUserProps.getPropVal("com.palominolabs.test.crm.sf.conn.metadata.password");
    this.bundle = TestConnectionUtils.getConnectionBundle(username, password);
    this.mdconn = bundle.getMetadataConnection();
//        com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump = true;
}
Example 5
Project: erechnung.gv.at-webservice-client-master  File: WS200Sender.java View source code
/**
   * This is the main sending routine. It can be invoked multiple times with
   * different invoices.
   *
   * @param aOriginalInvoice
   *        The original invoice in an XML representation. May not be
   *        <code>null</code>. It may be in any of the formats supported by
   *        ER>B (ebInterface 3.0, 3.02, 4.0, 4.1 or UBL 2.0, 2.1).
   * @param aAttachments
   *        An optional list of attachments to this invoice. If the list is non-
   *        <code>null</code> it must contain only non-<code>null</code>
   *        elements.
   * @param aSettings
   *        The settings element as specified by the ER>B Webservice 1.2.
   *        Within this settings element e.g. the test-flag can be set. May not
   *        be <code>null</code>.
   * @return A non-<code>null</code> upload status as returned by the ER>B
   *         Webservice. In case of an internal error, a corresponding error
   *         structure is created.
   */
@Nonnull
public DeliveryResponseType deliverInvoice(@Nonnull final Node aOriginalInvoice, @Nullable final List<DeliveryEmbeddedAttachmentType> aAttachments, @Nonnull final DeliverySettingsType aSettings) {
    ValueEnforcer.notNull(aOriginalInvoice, "OriginalInvoice");
    ValueEnforcer.notNull(aSettings, "Settings");
    // Some debug output
    SystemProperties.setPropertyValue("com.sun.xml.ws.transport.http.client.HttpTransportPipe.dump", isDebugMode());
    SystemProperties.setPropertyValue("com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.dump", isDebugMode());
    // Convert XML node to a String
    final XMLWriterSettings aXWS = new XMLWriterSettings().setCharset(getInvoiceEncoding());
    final String sInvoiceString = XMLWriter.getNodeAsString(aOriginalInvoice, aXWS);
    if (sInvoiceString == null) {
        s_aLogger.error("Failed to serialize the specified XML document to a String!");
        return _createError("document", "Failed to serialize the specified XML document to a String!");
    }
    // Prepare document
    final DeliveryType aDelivery = new DeliveryType();
    // Main invoice
    final DeliveryInvoiceType aInvoice = new DeliveryInvoiceType();
    aInvoice.setValue(sInvoiceString.getBytes(getInvoiceEncoding()));
    aInvoice.setEncoding(getInvoiceEncoding().name());
    aDelivery.setInvoice(aInvoice);
    // Embedded attachments
    aDelivery.setEmbeddedAttachment(aAttachments);
    // ER>B does not support external attachments!
    // Settings
    aDelivery.setSettings(aSettings);
    try {
        final WSClientConfig aWSClientConfig = new WSClientConfig(isTestVersion() ? ENDPOINT_URL_TEST : ENDPOINT_URL_PRODUCTION);
        if (isTrustAllCertificates()) {
            // Maybe required to trust txm.portal.at depending on the installed OS
            // root certificates.
            aWSClientConfig.setSSLSocketFactoryTrustAll();
        }
        if (isTrustAllHostnames())
            aWSClientConfig.setHostnameVerifierTrustAll();
        // Ensure the WSSE headers are added using our handler
        aWSClientConfig.addHandler(new SOAPAddWSSEHeaderHandler(getWebserviceUsername(), getWebservicePassword()));
        // Invoke WS
        final WSInvoiceDeliveryService aService = new WSInvoiceDeliveryService();
        final WSInvoiceDeliveryPort aPort = aService.getWSInvoiceDeliveryPort();
        aWSClientConfig.applyWSSettingsToBindingProvider((BindingProvider) aPort);
        // Main sending
        final DeliveryResponseType aResult = aPort.deliverInvoice(aDelivery);
        return aResult;
    } catch (final DeliverInvoiceFaultInvoice ex) {
        s_aLogger.error("Error uploading the document to ER>B Webservice 2.0!", ex);
        return _createError("document", ex.getFaultInfo() != null ? ex.getFaultInfo().getMessage() : CollectionHelper.newList(ex.getMessage()));
    } catch (final WebServiceException ex) {
        s_aLogger.error("Error transmitting the document to ER>B Webservice 2.0!", ex);
        return _createError("webservice", ex.getMessage());
    } catch (final Throwable t) {
        s_aLogger.error("Generic error invoking ER>B Webservice 2.0", t);
        return _createError("general", t.getMessage());
    }
}