Package org.apache.ws.axis2.tests

Examples of org.apache.ws.axis2.tests.EchoPort


    FileOutputStream fileOutputStream = new FileOutputStream(file);
    dataHandler.writeTo(fileOutputStream);
    fileOutputStream.flush();
    fileOutputStream.close();
   
    AttachmentResponse response = new AttachmentResponse();
    response.setAttachmentResponse("File saved succesfully.");
    return response;
  }
View Full Code Here


    FileOutputStream fileOutputStream = new FileOutputStream(file);
    dataHandler.writeTo(fileOutputStream);
    fileOutputStream.flush();
    fileOutputStream.close();
   
    AttachmentResponse response = new AttachmentResponse();
    response.setAttachmentResponse("File saved succesfully.");
    return response;
  }
View Full Code Here

  public org.apache.ws.axis2.mtomsample.AttachmentResponse attachment(
      org.apache.ws.axis2.mtomsample.AttachmentRequest param0)
      throws Exception

  {
    AttachmentType attachmentRequest = param0.getAttachmentRequest();
    Base64Binary binaryData = attachmentRequest.getBinaryData();
    DataHandler dataHandler = binaryData.getBase64Binary();
    File file = new File(
        attachmentRequest.getFileName());
    FileOutputStream fileOutputStream = new FileOutputStream(file);
    dataHandler.writeTo(fileOutputStream);
    fileOutputStream.flush();
    fileOutputStream.close();
   
View Full Code Here

  public org.apache.ws.axis2.mtomsample.AttachmentResponse attachment(
      org.apache.ws.axis2.mtomsample.AttachmentRequest param0)
      throws Exception

  {
    AttachmentType attachmentRequest = param0.getAttachmentRequest();
    Base64Binary binaryData = attachmentRequest.getBinaryData();
    DataHandler dataHandler = binaryData.getBase64Binary();
    File file = new File(
        attachmentRequest.getFileName());
    FileOutputStream fileOutputStream = new FileOutputStream(file);
    dataHandler.writeTo(fileOutputStream);
    fileOutputStream.flush();
    fileOutputStream.close();
   
View Full Code Here

  public static void transferFile(File file, String destination)
      throws RemoteException {
    // uncomment the following if you need to capture the messages from
    // TCPMON. Please look at http://ws.apache.org/commons/tcpmon/tcpmontutorial.html
    // to learn how to setup tcpmon
    MTOMSampleMTOMSampleSOAP11Port_httpStub serviceStub = new MTOMSampleMTOMSampleSOAP11Port_httpStub(
        //"http://localhost:8081/axis2/rest/MTOMSample"
    );

    // Enable MTOM in the client side
    serviceStub._getServiceClient().getOptions().setProperty(
        Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE);
    //Increase the time out when sending large attachments
    serviceStub._getServiceClient().getOptions().setTimeOutInMilliSeconds(10000);

    // Uncomment and fill the following if you want to have client side file
    // caching switched ON.
    /*
     * serviceStub._getServiceClient().getOptions().setProperty(
     * Constants.Configuration.CACHE_ATTACHMENTS, Constants.VALUE_TRUE);
     * serviceStub._getServiceClient().getOptions().setProperty(
     * Constants.Configuration.ATTACHMENT_TEMP_DIR, "your temp dir");
     * serviceStub._getServiceClient().getOptions().setProperty(
     * Constants.Configuration.FILE_SIZE_THRESHOLD, "4000");
     */

    // Populating the code generated beans
    MTOMSampleMTOMSampleSOAP11Port_httpStub.AttachmentRequest attachmentRequest = new MTOMSampleMTOMSampleSOAP11Port_httpStub.AttachmentRequest();
    MTOMSampleMTOMSampleSOAP11Port_httpStub.AttachmentType attachmentType = new MTOMSampleMTOMSampleSOAP11Port_httpStub.AttachmentType();
    MTOMSampleMTOMSampleSOAP11Port_httpStub.Base64Binary base64Binary = new MTOMSampleMTOMSampleSOAP11Port_httpStub.Base64Binary();

    // Creating a javax.activation.FileDataSource from the input file.
    FileDataSource fileDataSource = new FileDataSource(file);

    // Create a dataHandler using the fileDataSource. Any implementation of
    // javax.activation.DataSource interface can fit here.
    DataHandler dataHandler = new DataHandler(fileDataSource);
    base64Binary.setBase64Binary(dataHandler);
        MTOMSampleMTOMSampleSOAP11Port_httpStub.ContentType_type0 param = new MTOMSampleMTOMSampleSOAP11Port_httpStub.ContentType_type0();
        param.setContentType_type0(dataHandler.getContentType());
        base64Binary.setContentType(param);
    attachmentType.setBinaryData(base64Binary);
    attachmentType.setFileName(destination);
    attachmentRequest.setAttachmentRequest(attachmentType);

    MTOMSampleMTOMSampleSOAP11Port_httpStub.AttachmentResponse response = serviceStub.attachment(attachmentRequest);
    System.out.println(response.getAttachmentResponse());
  }
View Full Code Here

       
        Service service = Service.create(wsdlURL, new QName(namespaceURI, localPart));
        assertNotNull(service);
       
        QName validPortQName = new QName(namespaceURI, "EchoPort");
        EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
        assertNotNull(echoPort);
       
        BindingProvider bindingProvider = (BindingProvider)Proxy.getInvocationHandler(echoPort);
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
View Full Code Here

        Service service = Service.create(null, new QName(namespaceURI, localPart));
        assertNotNull(service);
       
        QName validPortQName = new QName(namespaceURI, "EchoPort");
        EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
        assertNotNull(echoPort);
       
        BindingProvider bindingProvider = (BindingProvider)Proxy.getInvocationHandler(echoPort);
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
        assertNotNull(serviceDelegate);
View Full Code Here

        Service service = Service.create(null, new QName(namespaceURI, localPart));
        assertNotNull(service);
       
        QName validPortQName = new QName(namespaceURI, "EchoPort");
        EchoPort echoPort = service.getPort(validPortQName, EchoPort.class);
        Dispatch<String> dispatch = service.createDispatch(validPortQName, String.class, null);
        assertNotNull(dispatch);
       
        BindingProvider bindingProvider = (BindingProvider) dispatch;
        ServiceDelegate serviceDelegate = bindingProvider.getServiceDelegate();
View Full Code Here

        QName serviceQN = new QName(VALID_SERVICE_NAMESPACE, VALID_SERVICE_LOCALPART_3);
        Service service = Service.create(wsdlURL, serviceQN);
        assertNotNull(service);
        // There should be no ports in the service that use this SEI!
        try {
            EchoPort selectPort = service.getPort(EchoPort.class);
            fail("Shouldn't have found a port for the given SEI!");
        }
        catch (WebServiceException ex) {
            // Expected code path
        }
View Full Code Here

    // EndpointDescription Tests
    // ========================================================================
   
    public void testValidGetPortWithClass() {
        try {
            EchoPort echoPort = service.getPort(EchoPort.class);
        }
        catch (Exception e) {
            fail("Caught unexpected exception");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.ws.axis2.tests.EchoPort

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.