字符串转换成SoapMessage对象

下面的代码可以把字符串转换成SoapMessage对象

/**
     * <把soap字符串格式化为SOAPMessage>
     * <功能详细描述>
     * @param soapString
     * @return
     * @see [类、类#方法、类#成员]
     */
    public static SOAPMessage formartSoapString(String soapString)
    {
        MessageFactory msgFactory;
        try
        {
            msgFactory = MessageFactory.newInstance();
            SOAPMessage reqMsg =
                msgFactory.createMessage(new MimeHeaders(),
                    new ByteArrayInputStream(soapString.getBytes(Charset.forName("UTF-8"))));
            reqMsg.saveChanges();
            return reqMsg;
        }
        catch (Exception e)
        {
            logger.error(EXCEPTION_NAME, e);
            return null;
        }
    }
 

你可能感兴趣的:(SSH框架,Java基础,其它文章)