Search in sources :

Example 1 with WebServiceException

use of javax.xml.ws.WebServiceException in project camel by apache.

the class AbstractCxfWsdlFirstTest method testInvokingServiceFromCXFClient.

@Test
public void testInvokingServiceFromCXFClient() throws Exception {
    JaxwsTestHandler fromHandler = getMandatoryBean(JaxwsTestHandler.class, "fromEndpointJaxwsHandler");
    fromHandler.reset();
    JaxwsTestHandler toHandler = getMandatoryBean(JaxwsTestHandler.class, "toEndpointJaxwsHandler");
    toHandler.reset();
    URL wsdlURL = getClass().getClassLoader().getResource("person.wsdl");
    PersonService ss = new PersonService(wsdlURL, new QName("http://camel.apache.org/wsdl-first", "PersonService"));
    Person client = ss.getSoap();
    ((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:" + getPort2() + "/" + getClass().getSimpleName() + "/PersonService/");
    Holder<String> personId = new Holder<String>();
    personId.value = "hello";
    Holder<String> ssn = new Holder<String>();
    Holder<String> name = new Holder<String>();
    client.getPerson(personId, ssn, name);
    assertEquals("we should get the right answer from router", "Bonjour", name.value);
    personId.value = "";
    try {
        client.getPerson(personId, ssn, name);
        fail("We expect to get the UnknowPersonFault here");
    } catch (UnknownPersonFault fault) {
    // We expect to get fault here
    }
    personId.value = "Invoking getPerson with invalid length string, expecting exception...xxxxxxxxx";
    try {
        client.getPerson(personId, ssn, name);
        fail("We expect to get the WebSerivceException here");
    } catch (WebServiceException ex) {
        // Caught expected WebServiceException here
        assertTrue("Should get the xml vaildate error! " + ex.getMessage(), ex.getMessage().indexOf("MyStringType") > 0 || ex.getMessage().indexOf("Could not parse the XML stream") != -1);
    }
    verifyJaxwsHandlers(fromHandler, toHandler);
}
Also used : UnknownPersonFault(org.apache.camel.wsdl_first.UnknownPersonFault) WebServiceException(javax.xml.ws.WebServiceException) QName(javax.xml.namespace.QName) PersonService(org.apache.camel.wsdl_first.PersonService) Holder(javax.xml.ws.Holder) JaxwsTestHandler(org.apache.camel.wsdl_first.JaxwsTestHandler) Person(org.apache.camel.wsdl_first.Person) URL(java.net.URL) Test(org.junit.Test)

Example 2 with WebServiceException

use of javax.xml.ws.WebServiceException in project camel by apache.

the class EchoServiceSessionImpl method echo.

public String echo(String text) {
    // Find the HttpSession
    MessageContext mc = context.getMessageContext();
    HttpSession session = ((javax.servlet.http.HttpServletRequest) mc.get(MessageContext.SERVLET_REQUEST)).getSession();
    if (session == null) {
        throw new WebServiceException("No HTTP Session found");
    }
    if (session.getAttribute("foo") == null) {
        session.setAttribute("foo", "bar");
        return "New " + text;
    }
    return "Old " + text;
}
Also used : WebServiceException(javax.xml.ws.WebServiceException) HttpSession(javax.servlet.http.HttpSession) MessageContext(javax.xml.ws.handler.MessageContext)

Example 3 with WebServiceException

use of javax.xml.ws.WebServiceException in project cxf by apache.

the class ProviderImpl method createEndpoint.

// new in 2.2
public Endpoint createEndpoint(String bindingId, Object implementor, WebServiceFeature... features) {
    EndpointImpl ep = null;
    if (EndpointUtils.isValidImplementor(implementor)) {
        Bus bus = BusFactory.getThreadDefaultBus();
        ep = createEndpointImpl(bus, bindingId, implementor, features);
        return ep;
    }
    throw new WebServiceException(new Message("INVALID_IMPLEMENTOR_EXC", LOG).toString());
}
Also used : Bus(org.apache.cxf.Bus) WebServiceException(javax.xml.ws.WebServiceException) Message(org.apache.cxf.common.i18n.Message) EndpointImpl(org.apache.cxf.jaxws.EndpointImpl)

Example 4 with WebServiceException

use of javax.xml.ws.WebServiceException in project tmdm-studio-se by Talend.

the class DefaultDeployCommand method doExecute.

private IStatus doExecute(Object params, IProgressMonitor monitor) {
    ERepositoryObjectType type = getViewObjectType();
    String objectName = getLabel();
    IInteractiveHandler handler = InteractiveService.findHandler(type);
    if (handler != null) {
        String typeLabel = handler.getLabel();
        monitor.subTask(Messages.bind(Messages.Deploy_text, typeLabel));
        try {
            boolean isOK = handler.deploy(this);
            if (getDeployStatus() != null) {
                return getDeployStatus();
            }
            if (isOK) {
                if (getCommandType() == CMD_MODIFY) {
                    return DeployStatus.getOKStatus(this, Messages.bind(Messages.Deploy_successfully_text, typeLabel, objectName));
                }
                return DeployStatus.getOKStatus(this, Messages.bind(Messages.Create_successfully_text, typeLabel, objectName));
            } else {
                return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_fail_text, typeLabel, objectName));
            }
        } catch (OperationIgnoredException e) {
            return null;
        } catch (OperationCanceledException e) {
            return DeployStatus.getInfoStatus(this, Messages.bind(Messages.Deploy_cancel_text, typeLabel, objectName));
        } catch (WebServiceException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        } catch (XtentisException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        } catch (RuntimeException e) {
            return getDetailErrorMsg(Messages.Deploy_fail_cause_text, typeLabel, objectName, e);
        }
    } else {
        return DeployStatus.getErrorStatus(this, Messages.bind(Messages.Deploy_notSupport_text, objectName));
    }
}
Also used : OperationIgnoredException(com.amalto.workbench.utils.OperationIgnoredException) WebServiceException(javax.xml.ws.WebServiceException) OperationCanceledException(org.eclipse.core.runtime.OperationCanceledException) IInteractiveHandler(org.talend.mdm.repository.core.service.IInteractiveHandler) ERepositoryObjectType(org.talend.core.model.repository.ERepositoryObjectType) XtentisException(com.amalto.workbench.utils.XtentisException)

Example 5 with WebServiceException

use of javax.xml.ws.WebServiceException in project tmdm-studio-se by Talend.

the class ExportDataClusterAction method doRun.

@Override
protected void doRun() {
    List<Object> selectedObject = getSelectedObject();
    if (!selectedObject.isEmpty()) {
        IRepositoryViewObject viewObj = (IRepositoryViewObject) selectedObject.get(0);
        SelectServerDefDialog dialog = new SelectServerDefDialog(getShell());
        if (dialog.open() == IDialogConstants.OK_ID) {
            MDMServerDef serverDef = dialog.getSelectedServerDef();
            MDMServerObjectItem item = (MDMServerObjectItem) viewObj.getProperty().getItem();
            String dName = item.getMDMServerObject().getName();
            try {
                FileDialog fd = new FileDialog(getShell(), SWT.SAVE);
                // $NON-NLS-1$
                fd.setFilterExtensions(new String[] { "*.zip" });
                String fPath = fd.open();
                if (fPath != null) {
                    TMDMService service = RepositoryWebServiceAdapter.getMDMService(serverDef);
                    service.ping(new WSPing(Messages.ExportDataClusterAction_exportContent));
                    DataClusterService dataClusterService = DataClusterService.getIntance();
                    if (dataClusterService.isExistDataCluster(service, dName)) {
                        File tempFolder = IOUtil.getTempFolder();
                        String tempFolderPath = tempFolder.getAbsolutePath();
                        dataClusterService.storeIndexFile(tempFolderPath, dName);
                        // 
                        IDataContentProcess process = dataClusterService.getNewExportContentProcess(service, tempFolderPath, dName, fPath);
                        try {
                            process.run();
                        } catch (InterruptedException e) {
                            // do nothing
                            return;
                        }
                        MultiStatus status = process.getResult();
                        if (status != null && status.getChildren().length > 0) {
                            MessageDialog.openError(getShell(), Messages._Error, Messages.bind(Messages.ExportDataClusterAction_failedExportContent, dName));
                        } else {
                            MessageDialog.openInformation(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.bind(Messages.ExportDataClusterAction_successExport, dName));
                        }
                    } else {
                        MessageDialog.openInformation(getShell(), Messages.Common_Warning, Messages.bind(Messages.ExportDataClusterAction_noContainerFound, dName));
                    }
                }
            } catch (XtentisException e) {
                log.error(e.getMessage(), e);
            } catch (WebServiceException e) {
                MessageDialog.openError(getShell(), Messages.ExportDataClusterAction_exportContent, Messages.AbstractDataClusterAction_ConnectFailed);
            }
        }
    }
}
Also used : WSPing(com.amalto.workbench.webservices.WSPing) DataClusterService(org.talend.mdm.repository.core.service.DataClusterService) WebServiceException(javax.xml.ws.WebServiceException) MDMServerObjectItem(org.talend.mdm.repository.model.mdmproperties.MDMServerObjectItem) IDataContentProcess(org.talend.mdm.repository.core.datacontent.IDataContentProcess) MultiStatus(org.eclipse.core.runtime.MultiStatus) TMDMService(com.amalto.workbench.webservices.TMDMService) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) SelectServerDefDialog(org.talend.mdm.workbench.serverexplorer.ui.dialogs.SelectServerDefDialog) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) FileDialog(org.eclipse.swt.widgets.FileDialog) File(java.io.File) MDMServerDef(org.talend.mdm.repository.model.mdmmetadata.MDMServerDef) XtentisException(com.amalto.workbench.utils.XtentisException)

Aggregations

WebServiceException (javax.xml.ws.WebServiceException)378 Test (org.junit.Test)115 SOAPException (javax.xml.soap.SOAPException)59 SOAPFaultException (javax.xml.ws.soap.SOAPFaultException)59 SOAPMessage (javax.xml.soap.SOAPMessage)57 ConnectException (java.net.ConnectException)48 ErrorCode (org.olat.modules.vitero.model.ErrorCode)48 URL (java.net.URL)46 SOAPElement (javax.xml.soap.SOAPElement)46 IOException (java.io.IOException)43 SOAPBody (javax.xml.soap.SOAPBody)34 ArrayList (java.util.ArrayList)32 SOAPBodyElement (javax.xml.soap.SOAPBodyElement)32 BindingProvider (javax.xml.ws.BindingProvider)31 Retry (io.github.resilience4j.retry.Retry)29 Service (javax.xml.ws.Service)29 QName (javax.xml.namespace.QName)27 SOAPMessageContext (javax.xml.ws.handler.soap.SOAPMessageContext)21 DataHandler (javax.activation.DataHandler)17 RetryConfig (io.github.resilience4j.retry.RetryConfig)16