Examples of SOAPFault


Examples of com.arjuna.webservices.SoapFault

                    TerminationParticipantClient.getClient().sendFaulted(endpoint, responseAddressingProperties, instanceIdentifier) ;
                }
                catch (final UnknownTransactionException ute)
                {
                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                    final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_1")) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
                    return ;
                }
                catch (final SystemException se)
                {
                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                    final String pattern = WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_2") ;
                    final String message = MessageFormat.format(pattern, new Object[] {se}) ;
                    final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNERROR_ERROR_CODE_QNAME, message) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
                    return ;
                }
                catch (final Throwable th)
                {
                    if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                    {
                        WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_3", th) ;
                    }
                    final AddressingProperties faultAddressingProperties = AddressingHelper.createFaultContext(addressingProperties, messageId) ;
                    final SoapFault soapFault = new SoapFault11(th) ;
                    TerminationParticipantClient.getClient().sendSoapFault(endpoint, faultAddressingProperties, soapFault, instanceIdentifier) ;
                    return ;
                }
                final AddressingProperties responseAddressingProperties = AddressingHelper.createNotificationContext(messageId) ;
                TerminationParticipantClient.getClient().sendCancelled(endpoint, responseAddressingProperties, instanceIdentifier) ;
            }
            else
            {
                if (WSTLogger.arjLoggerI18N.isDebugEnabled())
                {
                    WSTLogger.arjLoggerI18N.debug("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_4", new Object[] {instanceIdentifier}) ;
                }
                final AddressingProperties faultAddressingProperties =
                        AddressingHelper.createFaultContext(addressingProperties, MessageId.getMessageId()) ;
                final SoapFault soapFault = new SoapFault11(SoapFaultType.FAULT_SENDER, ArjunaTXConstants.UNKNOWNTRANSACTION_ERROR_CODE_QNAME,
                        WSTLogger.log_mesg.getString("com.arjuna.wst11.messaging.TerminationCoordinatorProcessorImpl_5")) ;
                 TerminationParticipantClient.getClient().sendSoapFault(soapFault, faultAddressingProperties, instanceIdentifier) ;
            }
        }
        catch (Throwable throwable)
View Full Code Here

Examples of com.consol.citrus.ws.message.SoapFault

        Map<String, Object> requestHeaders = new HashMap<String, Object>();
        requestHeaders.put(SoapMessageHeaders.SOAP_ACTION, "sayHello");
        final Message requestMessage = new DefaultMessage("<?xml version=\"1.0\" encoding=\"UTF-8\"?><TestRequest><Message>Hello World!</Message></TestRequest>", requestHeaders);

        final SoapFault responseMessage = new SoapFault();
        responseMessage.setFaultCode("SERVER");
        responseMessage.setFaultString("Invalid request, because of unknown error");

        endpoint.setEndpointAdapter(new StaticEndpointAdapter() {
            public Message handleMessageInternal(Message message) {
                Assert.assertEquals(message.copyHeaders().size(), requestMessage.copyHeaders().size());

                Assert.assertNotNull(message.getHeader(SoapMessageHeaders.SOAP_ACTION));
                Assert.assertEquals(message.getHeader(SoapMessageHeaders.SOAP_ACTION), "sayHello");

                Assert.assertEquals(message.getPayload(), requestMessage.getPayload());

                return responseMessage;
            }
        });

        org.springframework.ws.soap.SoapMessage soapRequest = EasyMock.createMock(org.springframework.ws.soap.SoapMessage.class);
        SoapHeader soapRequestHeader = EasyMock.createMock(SoapHeader.class);

        org.springframework.ws.soap.SoapMessage soapResponse = EasyMock.createMock(org.springframework.ws.soap.SoapMessage.class);
        SoapHeader soapResponseHeader = EasyMock.createMock(SoapHeader.class);
        SoapBody soapResponseBody = EasyMock.createMock(SoapBody.class);
        final org.springframework.ws.soap.SoapFault soapFault = EasyMock.createMock(org.springframework.ws.soap.SoapFault.class);
       
        StringResult soapResponsePayload = new StringResult();
       
        reset(messageContext, soapRequest, soapRequestHeader, soapResponse, soapResponseHeader, soapResponseBody);
       
        expect(messageContext.getRequest()).andReturn(soapRequest).anyTimes();
       
        expect(soapRequest.getPayloadSource()).andReturn(new StringSource("<TestRequest><Message>Hello World!</Message></TestRequest>")).times(2);
       
        expect(messageContext.getPropertyNames()).andReturn(new String[]{}).once();
       
        expect(soapRequest.getSoapHeader()).andReturn(soapRequestHeader).once();
        expect(soapRequestHeader.getSource()).andReturn(null).once();
       
        Set<SoapHeaderElement> emptyHeaderSet = Collections.emptySet();
        expect(soapRequestHeader.examineAllHeaderElements()).andReturn(emptyHeaderSet.iterator()).once();
       
        expect(soapRequest.getSoapAction()).andReturn("sayHello").anyTimes();
       
        Set<Attachment> emptyAttachmentSet = Collections.emptySet();
        expect(soapRequest.getAttachments()).andReturn(emptyAttachmentSet.iterator()).once();
       
        expect(messageContext.getResponse()).andReturn(soapResponse).once();

        expect(soapResponse.getSoapHeader()).andReturn(soapResponseHeader).anyTimes();
       
        expect(soapResponse.getSoapBody()).andReturn(soapResponseBody).once();
       
        expect(soapResponseBody.addServerOrReceiverFault((String)anyObject(), (Locale)anyObject())).andAnswer(new IAnswer<org.springframework.ws.soap.SoapFault>() {
            public org.springframework.ws.soap.SoapFault answer() throws Throwable {
                Assert.assertEquals(EasyMock.getCurrentArguments()[0], "Invalid request, because of unknown error");
               
                return soapFault;
            }
        });
       
        replay(messageContext, soapRequest, soapRequestHeader, soapResponse, soapResponseHeader, soapResponseBody);
       
        endpoint.invoke(messageContext);
       
        Assert.assertEquals(soapResponsePayload.toString(), responseMessage.getPayload());
       
        verify(messageContext, soapRequest, soapRequestHeader, soapResponse, soapResponseHeader, soapResponseBody);
    }
View Full Code Here

Examples of com.izforge.soapdtc.SoapFault

        if (endpointHandler == null) return;

        try
        {
            SoapMessage inMessage = SoapMessageUtils.readSoapMessageFromStream(request.getInputStream(), documentFactory);
            SoapFault headerFault = processHeaders(inMessage, endpointHandler);
            SoapMessage outMessage;
            if (headerFault != null)
            {
                outMessage = new SoapMessage(documentFactory);
                outMessage.getBodyElement().add(headerFault.toXmlElement());
            }
            else
            {
                outMessage = endpointHandler.handleRequestResponse(inMessage, request.getParameter("SOAPAction"));
            }
View Full Code Here

Examples of com.sun.xml.internal.ws.wsdl.writer.document.soap.SOAPFault

            }
        }
        for (CheckedExceptionImpl exception : method.getCheckedExceptions()) {
            Fault fault = operation.fault().name(exception.getMessageName());
            extension.addBindingOperationFaultExtension(fault, method, exception);
            SOAPFault soapFault = fault._element(SOAPFault.class).name(exception.getMessageName());
            soapFault.use(LITERAL);
        }
    }
View Full Code Here

Examples of com.sun.xml.ws.wsdl.writer.document.soap.SOAPFault

            }
        }
        for (CheckedExceptionImpl exception : method.getCheckedExceptions()) {
            Fault fault = operation.fault().name(exception.getMessageName());
            extension.addBindingOperationFaultExtension(fault, method, exception);
            SOAPFault soapFault = fault._element(SOAPFault.class).name(exception.getMessageName());
            soapFault.use(LITERAL);
        }
    }
View Full Code Here

Examples of javax.wsdl.extensions.soap.SOAPFault

    private void setSoapFaultExtElement(BindingFault bf) throws ToolException {
        if (extReg == null) {
            extReg = wsdlFactory.newPopulatedExtensionRegistry();
        }
        SOAPFault soapFault = null;
        try {
            soapFault = (SOAPFault)extReg.createExtension(BindingFault.class, WSDLConstants.NS_SOAP_FAULT);
        } catch (WSDLException wse) {
            Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
            throw new ToolException(msg, wse);
        }
        soapFault.setName(bf.getName());
        soapFault.setUse((String)env.get(ToolConstants.CFG_USE));
        if (WSDLConstants.RPC.equalsIgnoreCase((String)env.get(ToolConstants.CFG_STYLE))
            && env.optionSet(ToolConstants.CFG_NAMESPACE)) {
            soapFault.setNamespaceURI((String)env.get(ToolConstants.CFG_NAMESPACE));
        }
        bf.addExtensibilityElement(soapFault);
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

       * Step 4.1: If message is fault message, set status to false and send fault information.
       */
      if (message.isFault()) {
        // Access SOAP fault.
        try {
          SOAPFault faultObj = message.readAsSOAPMessage().getSOAPBody().getFault();
          HashMap<String,Object> detail = new HashMap<String, Object>();
          try {
            fillChildElementInfo(faultObj.getDetail().getChildNodes(),4,detail);
          } catch(Throwable th){/*Dont mind about custom message set fail*/}
          responseJSONMap.put(FAULT,new JSONFault(faultObj.getFaultCodeAsQName().getLocalPart().toUpperCase(),
              faultObj.getFaultString(),faultObj.getFaultActor(),detail));
         
        } catch (SOAPException e) {
          LOG.log(Level.WARNING, "Failed to read soap fault message", e);
          responseJSONMap.put(FAULT, new JSONFault("Server.json",
              "Failed to read soap fault message","Codec",null));
View Full Code Here

Examples of javax.xml.soap.SOAPFault

                                                        String prefix,
                                                        String namespace,
                                                        String reason)
        throws SOAPException {
        SOAPFactory factory = getSOAPFactory();
        SOAPFault fault = factory.createFault();
        Name qname = factory.createName(localName, prefix, namespace);
        fault.setFaultCode(qname);
        fault.setFaultString(reason);
        return new SOAPFaultException(fault);
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

        assertNotNull(xmlNode);
        assertEquals(1, xmlNode.getChildNodes().getLength());
       
        assertTrue(msg.getSOAPBody().hasFault());
       
        SOAPFault fault = msg.getSOAPBody().getFault();
        assertNotNull(fault);
        assertTrue(fault.hasChildNodes());
       
        //For Celtix Runtime Exceptions - SOAPFault will not have a Detail Node
        Detail detail = fault.getDetail();
        if (detail != null) {
            assertFalse("Detail should be non-existent or empty", detail.hasChildNodes());
        }
    }
View Full Code Here

Examples of javax.xml.soap.SOAPFault

                              String faultString) throws Exception {
       
        SOAPMessage msg = MessageFactory.newInstance().createMessage(null,  bais);
        assertNotNull(msg);
        assertTrue(msg.getSOAPBody().hasFault());
        SOAPFault fault = msg.getSOAPBody().getFault();
        assertNotNull(fault);
       
        StringBuffer str = new StringBuffer(clazz.getName());
        str.append(": ");
        str.append(faultString);
        assertEquals(str.toString(), fault.getFaultString());
        assertTrue(fault.hasChildNodes());
        Detail detail = fault.getDetail();
        assertNotNull(detail);
       
        NodeList list = detail.getChildNodes();
        assertEquals(1, list.getLength());
       
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.