You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ode.apache.org by "Igor Vorobiov (JIRA)" <ji...@apache.org> on 2016/03/31 11:59:25 UTC
[jira] [Updated] (ODE-1050) Service call fails for http binding
with "text/plain" content type
[ https://issues.apache.org/jira/browse/ODE-1050?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vorobiov updated ODE-1050:
-------------------------------
Description:
There is problem with service call for http binding with "text/plain" content type. Such call fails with following exception:
{code}
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)
{code}
It is caused by extract text content directly from partValue but probably should be done for the first child:
{code:title=org.apache.ode.axis2.httpbinding.HttpMethodConverter|borderStyle=solid}
...
} 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
}
...
{code}
Attached example with *operation name="Hello"*
was:
There is problem with service call for http binding with "text/plain" content type. Such call fails with following exception:
{code}
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)
{code}
It caused by extract text content directly from partValue but should be done for the first child:
{code:title=org.apache.ode.axis2.httpbinding.HttpMethodConverter|borderStyle=solid}
...
} 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));
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);
}
...
{code}
> Service call fails for http binding with "text/plain" content type
> ------------------------------------------------------------------
>
> Key: ODE-1050
> URL: https://issues.apache.org/jira/browse/ODE-1050
> Project: ODE
> Issue Type: Bug
> Components: Axis2 Integration
> Affects Versions: 1.3.6
> Reporter: Igor Vorobiov
>
> There is problem with service call for http binding with "text/plain" content type. Such call fails with following exception:
> {code}
> 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)
> {code}
> It is caused by extract text content directly from partValue but probably should be done for the first child:
> {code:title=org.apache.ode.axis2.httpbinding.HttpMethodConverter|borderStyle=solid}
> ...
> } 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
> }
> ...
> {code}
> Attached example with *operation name="Hello"*
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)