Package javax.xml.soap

Examples of javax.xml.soap.SOAPBody


    private static class SoapSenderFaultServlet extends AbstractSoapServlet {

        @Override
        protected SOAPMessage onMessage(SOAPMessage message) throws SOAPException {
            SOAPMessage response = messageFactory.createMessage();
            SOAPBody body = response.getSOAPBody();
            body.addFault(SOAPConstants.SOAP_SENDER_FAULT, "Sender Fault");
            return response;
        }
View Full Code Here


        Assert.hasLength(faultString, "faultString cannot be empty");
        Assert.hasLength(faultCode.getLocalPart(), "faultCode's localPart cannot be empty");
        Assert.hasLength(faultCode.getNamespaceURI(), "faultCode's namespaceUri cannot be empty");
        try {
          getSaajBody().removeContents();
          SOAPBody body = getSaajBody();
          SOAPFault result;
          if (faultStringLocale == null) {
            result = body.addFault(faultCode, faultString);
          }
          else {
            result = body.addFault(faultCode, faultString, faultStringLocale);
          }
          SOAPFault saajFault = result;
            return new SaajSoap12Fault(saajFault);
        }
        catch (SOAPException ex) {
View Full Code Here

        if (!langAttributeOnSoap11FaultString) {
            faultStringLocale = null;
        }
        try {
          getSaajBody().removeContents();
          SOAPBody body = getSaajBody();
          SOAPFault result;
          if (faultStringLocale == null) {
            result = body.addFault(faultCode, faultString);
          }
          else {
            result = body.addFault(faultCode, faultString, faultStringLocale);
          }
          SOAPFault saajFault = result;
            return new SaajSoap11Fault(saajFault);
        }
        catch (SOAPException ex) {
View Full Code Here

    @Override
    public SoapBody getBody() {
        if (body == null) {
            try {
              SOAPBody saajBody = getSaajEnvelope().getBody();
              if (saajBody.getElementQName().getNamespaceURI()
                        .equals(SoapVersion.SOAP_11.getEnvelopeNamespaceUri())) {
                    body = new SaajSoap11Body(saajBody, langAttributeOnSoap11FaultString);
                }
                else {
                    body = new SaajSoap12Body(saajBody);
View Full Code Here

    {
        final SOAPMessage soapMessage = getSoapMessage();
        soapMessage.getSOAPBody().addChildElement("getSession", NAMESPACE_PREFIX);
        soapMessage.saveChanges();
       
        final SOAPBody responseBody = getSOAPResponseBody(soapMessage, getUserServiceUrl());

        String sid = null;

        final Node getSessionResponse = responseBody.getFirstChild();
        final Node returnResult = getSessionResponse.getFirstChild();

        final NodeList childNodes = returnResult.getChildNodes();
        sid = childNodes.item(5).getTextContent();
View Full Code Here

    private String login(final String sid, final String username,
        final String password) throws SOAPException, IOException
    {
        final SOAPMessage soapMessage = getSoapMessage();
        final SOAPBody soapBody = soapMessage.getSOAPBody();
        final SOAPElement loginElement =
            soapBody.addChildElement("loginUser", NAMESPACE_PREFIX);

        loginElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(sid);
        loginElement.addChildElement("username", NAMESPACE_PREFIX).addTextNode(
            username);
        loginElement.addChildElement("userpass", NAMESPACE_PREFIX).addTextNode(
            password);
        soapMessage.saveChanges();

        final SOAPBody soapResponseBody = getSOAPResponseBody(soapMessage, getUserServiceUrl());
        final String textContent = soapResponseBody.getFirstChild().getTextContent();
        if (!textContent.equals("1"))
            JOptionPane.showMessageDialog(null,
                    OpenmeetingsPluginActivator.resourceService
                    .getI18NString("plugin.openmeetings.ERROR_LOGIN_MSG")
                    + " - Reason: " + this.getErrorCode(sid, textContent));
View Full Code Here

    public String getInvitationHash(final String username,
        final String password, final String displayedName, final String RoomID)
            throws Exception
    {
        final SOAPMessage soapMessage = getSoapMessage();
        final SOAPBody soapBody = soapMessage.getSOAPBody();
        final SOAPElement requestElement =
            soapBody.addChildElement("getInvitationHash", NAMESPACE_PREFIX);

        logger.info(username + ":" + displayedName);

        String sid = getSID(username, password);
        String error_id = null;
        try
        {
            error_id = login(sid, username, password);
        }
        catch (Exception e)
        {
            logger.info(e.getMessage());
        }

        if (!error_id.equals("1"))
        {
            logger.info("User cant login!");
            return null;
        }

        String room_id = RoomID;
        if ((room_id == null) || (room_id.trim().isEmpty()))
            room_id = getAvailableRooms(sid);
        if (room_id == null)
        {
            logger.error("No rooms available in openmeetings");
            return null;
        } else
        {
            room_id = room_id.trim();
            logger.info("Found openmeetings conference room ID " + room_id);
        }

        requestElement.addChildElement("SID", NAMESPACE_PREFIX)
            .addTextNode(sid);
        requestElement.addChildElement("username", NAMESPACE_PREFIX)
            .addTextNode(displayedName);
        requestElement.addChildElement("room_id", NAMESPACE_PREFIX)
            .addTextNode(room_id);
        soapMessage.saveChanges();

        final SOAPBody soapResponseBody = getSOAPResponseBody(soapMessage, getJabberServiceUrl());
        final String textContent = soapResponseBody.getFirstChild().getTextContent();
        logger.info("INVITATION RESPONSE =  " + textContent);
        return textContent;
    }
View Full Code Here

        throws SOAPException,
        IOException,
        TransformerException
    {
        final SOAPMessage soapMessage = getSoapMessage();
        final SOAPBody soapBody = soapMessage.getSOAPBody();
        final SOAPElement elemCodeElement =
            soapBody.addChildElement("getAvailableRooms", NAMESPACE_PREFIX);
        elemCodeElement.addChildElement("SID", "rooms").addTextNode(sid);
        soapMessage.saveChanges();

        final SOAPBody soapResponseBody = getSOAPResponseBody(soapMessage, getJabberServiceUrl());
        final Node getFirstRoomResult = soapResponseBody.getFirstChild().getFirstChild();
        if (getFirstRoomResult == null)
            return null;

        String rooms_id = new String();
        final NodeList childNodes = getFirstRoomResult.getChildNodes();
View Full Code Here

    private String getErrorCode(final String sid, final String error_id)
        throws SOAPException,
        IOException
    {
        final SOAPMessage soapMessage = getSoapMessage();
        final SOAPBody soapBody = soapMessage.getSOAPBody();
        final SOAPElement errorCodeElement =
            soapBody.addChildElement("getErrorByCode", NAMESPACE_PREFIX);
        errorCodeElement.addChildElement("SID", NAMESPACE_PREFIX).addTextNode(
            sid);
        errorCodeElement.addChildElement("errorid", NAMESPACE_PREFIX)
            .addTextNode(error_id);
        errorCodeElement.addChildElement("language_id", NAMESPACE_PREFIX)
            .addTextNode("0");
        soapMessage.saveChanges();

        final SOAPBody soapResponseBody = getSOAPResponseBody(soapMessage, getUserServiceUrl());
        return soapResponseBody.getFirstChild().getTextContent();
    }
View Full Code Here

            throw new RuntimeException("No Operation Name");
        }
       
        SOAPMessage response = null;       
        try {
            SOAPBody body = request.getSOAPBody();
            Node n = body.getFirstChild();

            while (n.getNodeType() != Node.ELEMENT_NODE) {
                n = n.getNextSibling();
            }
            if (n.getLocalName().equals(sayHi.getLocalPart())) {
View Full Code Here

TOP

Related Classes of javax.xml.soap.SOAPBody

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.