WSRequest.send gives 'AxisFault The input stream for an incoming message is null.'
darabi opened this issue · 7 comments
I'm running this code inside a WSO2 Application Server version 5.0.0
function insertTextContent(obj) {
var operation = "_insertTextContent";
var log = new Log();
var ws = require("ws");
var version = new ws.WSRequest();
var options = new Array();
options.useSOAP = 1.2;
options.action = "urn:" + operation;
var payload = null;
var result;
var url = application.get('dataServiceUrl') + operation;
var value = decodeURIComponent(escape(obj.value));
var description = decodeURIComponent(escape(obj.description));
log.debug("value: " + value);
var currentDate = xsdDateTime(new Date());
try {
version.open(options, url, false);
version.send(
<shop:_insertTextContent xmlns:shop='http://shop.acme.com' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
<modification_date>{currentDate}</modification_date>
<creation_date>{currentDate}</creation_date>
<created_by>admin</created_by>
<category>{obj.category}</category>
<mime_type>{obj.mime_type}</mime_type>
<modified_by>admin</modified_by>
<description>{description}</description>
<locale>de</locale>
<value>{value}</value>
<key>{obj.key}</key>
</shop:_insertTextContent>
);
result = version.responseE4X;
} catch (e) {
log.error(e.toString());
return e.toString();
}
return result;
}
although the web service call is obviously performed (successfully), I see the following error upon each request:
Error occured while invoking the service {org.jaggeryjs.host
objects.ws.WSRequestHostObject}
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
You can find the full stack trace below.
The service which I'm invoking is a WSO2 data service whose definition I also paste below.
I know that the service returns successfully from logging the result
object which contains the new value of _oid
.
Is there something I can do to avoid the AxisFault?
Thank you
Kambiz
Data Service:
<query id="my_insert_text_content_query" useConfig="default" returnGeneratedKeys="true" keyColumns="_oid">
<sql>INSERT INTO text_content(_oid,created_by,modified_by,creation_date,modification_date,key,category,mime_type,locale,description,value) VALUES(nextval('_instance_id'),?,?,?,?,?,?,?,?,?,?)</sql>
<result element="GeneratedKeys" rowName="Entry" useColumnNumbers="true">
<element name="_oid" column="1" xsdType="xs:long" />
</result>
<param name="created_by" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="2" />
<param name="modified_by" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="3" />
<param name="creation_date" paramType="SCALAR" sqlType="TIMESTAMP" type="IN" ordinal="4" />
<param name="modification_date" paramType="SCALAR" sqlType="TIMESTAMP" type="IN" ordinal="5" />
<param name="key" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="6" />
<param name="category" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="7" />
<param name="mime_type" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="8" />
<param name="locale" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="9" />
<param name="description" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="10" />
<param name="value" paramType="SCALAR" sqlType="STRING" type="IN" ordinal="11" />
</query>
<operation name="_insertTextContent">
<call-query href="my_insert_text_content_query">
<with-param name="modification_date" query-param="modification_date" />
<with-param name="creation_date" query-param="creation_date" />
<with-param name="created_by" query-param="created_by" />
<with-param name="category" query-param="category" />
<with-param name="mime_type" query-param="mime_type" />
<with-param name="modified_by" query-param="modified_by" />
<with-param name="description" query-param="description" />
<with-param name="locale" query-param="locale" />
<with-param name="value" query-param="value" />
<with-param name="key" query-param="key" />
</call-query>
</operation>
Full stack trace:
[Application Server] [2012-10-26 11:30:00,466] ERROR {org.jaggeryjs.hostobjects.ws.WSRequestHostObject} - Error occured while invoking the service {org.jaggeryjs.host
objects.ws.WSRequestHostObject}
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:92)
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:555)
at org.jaggeryjs.hostobjects.ws.WSRequestHostObject.jsFunction_send(WSRequestHostObject.java:371)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.mozilla.javascript.MemberBox.invoke(MemberBox.java:160)
at org.mozilla.javascript.FunctionObject.call(FunctionObject.java:411)
at org.mozilla.javascript.optimizer.OptRuntime.call1(OptRuntime.java:66)
at org.jaggeryjs.rhino.rest.text_content.c0._c4(/rest/text-content/index.jag:148)
at org.jaggeryjs.rhino.rest.text_content.c0.call(/rest/text-content/index.jag)
at org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:97)
at org.jaggeryjs.rhino.rest.text_content.c0._c0(/rest/text-content/index.jag:230)
at org.jaggeryjs.rhino.rest.text_content.c0.call(/rest/text-content/index.jag)
at org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:401)
at org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3003)
at org.jaggeryjs.rhino.rest.text_content.c0.call(/rest/text-content/index.jag)
at org.jaggeryjs.rhino.rest.text_content.c0.exec(/rest/text-content/index.jag)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.execScript(RhinoEngine.java:441)
at org.jaggeryjs.scriptengine.engine.RhinoEngine.exec(RhinoEngine.java:191)
at org.jaggeryjs.jaggery.core.manager.WebAppManager.execute(WebAppManager.java:269)
at org.jaggeryjs.jaggery.core.JaggeryServlet.doPost(JaggeryServlet.java:29)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:641)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:225)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:168)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:98)
at org.wso2.carbon.tomcat.ext.valves.CompositeValve.invoke(CompositeValve.java:179)
at org.wso2.carbon.tomcat.ext.valves.CarbonStuckThreadDetectionValve.invoke(CarbonStuckThreadDetectionValve.java:156)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:927)
at org.wso2.carbon.tomcat.ext.valves.CarbonContextCreatorValve.invoke(CarbonContextCreatorValve.java:49)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:407)
If this operation is an "in-only" operation, please specify options.mep = "in-only";
The operation is in-out:
<wsdl:operation name="_insertTextContent"><wsdl:documentation/>
<wsdl:input message="ns0:_insertTextContentRequest" wsaw:Action="urn:_insertTextContent"/>
<wsdl:output message="ns0:_insertTextContentResponse" wsaw:Action="urn:_insertTextContentResponse"/>
<wsdl:fault message="ns0:DataServiceFault" name="DataServiceFault" wsaw:Action="urn:_insertTextContentDataServiceFault"/>
</wsdl:operation>
Its request has such a body:
<body>
<p:_insertTextContent xmlns:p="http://shop.acme.com">
<p:created_by>admin</p:created_by>
<p:modified_by>admin</p:modified_by>
<p:creation_date>2012-10-27T04:09:00Z</p:creation_date>
<p:modification_date>2012-10-27T04:09:00Z</p:modification_date>
<p:key>key-1</p:key>
<p:category>WEB-TEXT</p:category>
<p:mime_type>text/plain</p:mime_type>
<p:locale>en</p:locale>
<p:description>testing</p:description>
<p:value>testing</p:value>
</p:_insertTextContent>
</body>
and this is a sample response body:
<GeneratedKeys xmlns="http://shop.acme.com">
<Entry>
<_oid>2128</_oid>
</Entry>
</GeneratedKeys>
Thanks
Kambiz
What are your http response headers when invoking this service ?
Thanks for looking into this:
HTTP/1.1 200 OK
Content-Type: application/soap+xml;charset=UTF-8
Transfer-Encoding: chunked
Date: Fri, 26 Oct 2012 11:07:24 GMT
Server: WSO2 Carbon Server
<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
<soapenv:Body>
<GeneratedKeys xmlns="http://shop.acme.com">
<Entry>
<_oid xmlns="http://shop.acme.com">2126</_oid>
</Entry>
</GeneratedKeys>
</soapenv:Body>
</soapenv:Envelope>
Any news on this issue?
I agree that we are talking about an alpha release and don't want to be too pushy, but on the other hand 3 months should be enough for some feedback.
Thank you
SiteKey keyObj = new SiteKey();
keyObj.setSiteKey(wsEndPointsFactory.getSiteKey());
SecurityToken tokenObj = new SecurityToken();
tokenObj.setSecurityToken(sessionID);
EproofServiceStub stub1 = new EproofServiceStub(eproofService);
DoImportComponent importFile = new DoImportComponent(); // operation
// name
ImPortClass importClass = new ImPortClass();
importClass.setUserID(userId);
importClass.setStrStickyId(String.valueOf(stickyId));
importClass.setStrAdNumber(String.valueOf(adNumber));
importClass.setIsPrePrint(preprint);
importClass.setExt("png");
FileDataSource dataSource = new FileDataSource(
"C:/Users/mananvm/Desktop/iglpayment.png");
DataHandler dataHandler = new DataHandler(dataSource);
importClass.setContent(dataHandler);
importFile.setObj(importClass);
DoImportComponentResponse response = stub1.doImportComponent(
importFile, keyObj, tokenObj);
I m also getting same error
org.apache.axis2.AxisFault: The input stream for an incoming message is null.
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:92) ~[axis2-1.6.1.jar:na]
at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUtils.java:67) ~[axis2-1.6.1.jar:na]
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:354) ~[axis2-1.6.1.jar:na]
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:421) ~[axis2-1.6.1.jar:na]
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:229) ~[axis2-1.6.1.jar:na]
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:165) ~[axis2-1.6.1.jar:na]
at com.atex.www.services.adbase.selfservice.EproofServiceStub.doImportComponent(EproofServiceStub.java:3458) ~[eproof-stubs.jar:na]
at com.atex.selfservice.repository.impl.eproof.EproofRepositoryImpl.uploadComponent(EproofRepositoryImpl.java:631) ~[EproofRepositoryImpl.class:na]
at com.atex.selfservice.services.impl.eproof.EproofServiceImpl.uploadComponent(EproofServiceImpl.java:277) ~[EproofServiceImpl.class:na]
at com.atex.selfservice.rest.controllers.eproof.EproofController.uploadComponent(EproofController.java:296) ~[EproofController.class:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.7.0_25]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) ~[na:1.7.0_25]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.7.0_25]
at java.lang.reflect.Method.invoke(Method.java:606) ~[na:1.7.0_25]
Closing due to inactivity.