Search in sources :

Example 1 with AxisFault

use of org.apache.axis2.AxisFault in project tdi-studio-se by Talend.

the class MSCRMClient method setServiceClientOptions.

private static void setServiceClientOptions(ServiceClient sc, SecurityData securityData) throws AxisFault, XMLStreamException {
    Options options = sc.getOptions();
    options.setMessageId("urn:uuid:" + UUID.randomUUID().toString());
    EndpointReference endPoint = new EndpointReference("http://www.w3.org/2005/08/addressing/anonymous");
    options.setReplyTo(endPoint);
    sc.setOptions(options);
    sc.addHeader(createCRMSecurityHeaderBlock(securityData));
    HttpTransportProperties.ProxyProperties proxyProps = getProxyProperties();
    if (proxyProps != null) {
        sc.getOptions().setProperty(HTTPConstants.PROXY, proxyProps);
    }
    try {
        sc.engageModule("addressing");
    } catch (AxisFault e) {
        logger.error(e.getMessage());
        throw e;
    }
}
Also used : AxisFault(org.apache.axis2.AxisFault) Options(org.apache.axis2.client.Options) HttpTransportProperties(org.apache.axis2.transport.http.HttpTransportProperties) ProxyProperties(org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties) EndpointReference(org.apache.axis2.addressing.EndpointReference)

Example 2 with AxisFault

use of org.apache.axis2.AxisFault in project tdi-studio-se by Talend.

the class MSCRMClient method getConfigurationContext.

private static ConfigurationContext getConfigurationContext() throws AxisFault {
    String workingDirectory = System.getProperty("user.dir");
    String fileSeperator = System.getProperty("file.separator");
    String pathToAxis2File = workingDirectory + fileSeperator + "src" + fileSeperator + "axis2.xml";
    logger.debug("Working directory: " + workingDirectory);
    logger.debug("Path to Axis2.xml file: " + pathToAxis2File);
    ConfigurationContext ctx;
    try {
        // ctx = ConfigurationContextFactory.createConfigurationContextFromFileSystem(workingDirectory,
        // pathToAxis2File);
        ctx = ConfigurationContextFactory.createConfigurationContextFromURIs(MSCRMClient.class.getClassLoader().getResource("org/talend/ms/crm/sdk/axis2_mscrm.xml"), null);
    } catch (AxisFault e) {
        logger.error(e.getMessage());
        throw e;
    }
    return ctx;
}
Also used : AxisFault(org.apache.axis2.AxisFault) ConfigurationContext(org.apache.axis2.context.ConfigurationContext)

Example 3 with AxisFault

use of org.apache.axis2.AxisFault in project jaggery by wso2.

the class JaggeryAppAdmin method uploadWebapp.

/**
     * Upload a webapp
     *
     * @param webappUploadDataList Array of data representing the webapps that are to be uploaded
     * @return true - if upload was successful
     * @throws org.apache.axis2.AxisFault If an error occurrs while uploading
     */
@SuppressFBWarnings({ "PATH_TRAVERSAL_IN", "PATH_TRAVERSAL_IN" })
public boolean uploadWebapp(WebappUploadData[] webappUploadDataList) throws AxisFault {
    AxisConfiguration axisConfig = getAxisConfig();
    String repoPath = axisConfig.getRepository().getPath();
    String jaggeryAppsPath = getWebappDeploymentDirPath();
    for (WebappUploadData uploadData : webappUploadDataList) {
        String fName = uploadData.getFileName();
        if (fName.contains(".")) {
            fName = fName.split("\\.")[0];
        }
        File webappsDir = new File(jaggeryAppsPath + File.separator + fName);
        File jaggeryAppsFile = new File(jaggeryAppsPath);
        if (webappsDir.exists()) {
            String msg = "Jaggery app with the same name already exists";
            log.error(msg);
            throw new AxisFault(msg);
        } else if (!jaggeryAppsFile.exists()) {
            //if deployment directory is not there we create it
            if (!jaggeryAppsFile.mkdir()) {
                String error = "Jaggery deployment directory not found and cannot be created when uploading";
                log.error(error);
                throw new AxisFault(error);
            }
        }
        ArchiveManipulator archiveManipulator = new ArchiveManipulator();
        try {
            archiveManipulator.extractFromStream(uploadData.getDataHandler().getInputStream(), jaggeryAppsPath + File.separator + fName);
        } catch (IOException e) {
            log.error("Could not unzip the Jaggery App Archive", e);
            throw new AxisFault(e.getMessage(), e);
        }
    }
    return true;
}
Also used : AxisFault(org.apache.axis2.AxisFault) AxisConfiguration(org.apache.axis2.engine.AxisConfiguration) ArchiveManipulator(org.wso2.carbon.utils.ArchiveManipulator) WebappUploadData(org.wso2.carbon.webapp.mgt.WebappUploadData) IOException(java.io.IOException) File(java.io.File) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings)

Aggregations

AxisFault (org.apache.axis2.AxisFault)3 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 File (java.io.File)1 IOException (java.io.IOException)1 EndpointReference (org.apache.axis2.addressing.EndpointReference)1 Options (org.apache.axis2.client.Options)1 ConfigurationContext (org.apache.axis2.context.ConfigurationContext)1 AxisConfiguration (org.apache.axis2.engine.AxisConfiguration)1 HttpTransportProperties (org.apache.axis2.transport.http.HttpTransportProperties)1 ProxyProperties (org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties)1 ArchiveManipulator (org.wso2.carbon.utils.ArchiveManipulator)1 WebappUploadData (org.wso2.carbon.webapp.mgt.WebappUploadData)1