Uploaded image for project: 'ODE'
  1. ODE
  2. ODE-1050

Service call fails for http binding with "text/plain" content type

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.3.6
    • None
    • Axis2 Integration
    • None

    Description

      There is problem with service call for http binding with "text/plain" content type. Such call fails with following exception:

      java.lang.IllegalArgumentException: The content cannot be null
              at org.apache.commons.httpclient.methods.StringRequestEntity.<init>(StringRequestEntity.java:93)
              at org.apache.ode.axis2.httpbinding.HttpMethodConverter.prepareHttpMethod(HttpMethodConverter.java:214)
      

      It is caused by extract text content directly from partValue but probably should be done for the first child:

      org.apache.ode.axis2.httpbinding.HttpMethodConverter
       ...
        } else if (HttpUtils.isXml(contentType)) {
               if (log.isDebugEnabled()) log.debug("Content-Type [" + contentType + "] equivalent to 'text/xml'");
                // stringify the first element
               String xmlString = DOMUtils.domToString(DOMUtils.getFirstChildElement(partValue)); // <--should be like here
               requestEntity = new StringRequestEntity(xmlString, contentType, contentCharset);
        } else {
               if (log.isDebugEnabled())
               log.debug("Content-Type [" + contentType + "] NOT equivalent to 'text/xml'. The text content of part value will be sent as text");
               // encoding conversion is managed by StringRequestEntity if necessary
               requestEntity = new StringRequestEntity(DOMUtils.getTextContent(partValue), contentType, contentCharset); // <--get content directly
        }
       ...
      

      Attached example with operation name="Hello"

      Attachments

        1. response.txt
          0.1 kB
          Igor Vorobiov
        2. request.txt
          0.2 kB
          Igor Vorobiov
        3. HelloWorldWS.wsdl
          6 kB
          Igor Vorobiov

        Activity

          People

            Unassigned Unassigned
            ivorobiov Igor Vorobiov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: