Is the data returned by the http POST request a valid xml ?
If no, you will certainly have such an error.
Btw, a jbi message must have a valid xml content.
Cheers,
Guillaume Nodet
On 6/22/06, apinke <[EMAIL PROTECTED]> wrote:
Hi All ,
I am facing a problem while using the servicemix-http component to invoke
a
URL..
I am creating a InOut message as follows :
InOut inout = createInOutExchange(new QName(Constants.MY_NAMESPACE
,
Constants.HSERVICE), null, null);
inout.setProperty(Constants.PROPERTY_CORRELATIONID, id);
NormalizedMessage msg = inout.createMessage();
inout.setInMessage(msg);
send(inout);
Since I want to just invoke the URL that is defined for the HSERVICE
component and get the data , I am not setting any Content.
I get the following error :
ERROR - HttpSpringComponent - Error processing exchange
org.apache.servicemix.jbi.messagi
[EMAIL PROTECTED]
java.lang.IllegalStateException: Trying to write END_DOCUMENT when
document
has no root (ie. trying
to output empty document).
at
com.ctc.wstx.sw.BaseStreamWriter.writeEndDocument(BaseStreamWriter.java
:471)
at
org.apache.servicemix.soap.marshalers.SoapWriter.writeSimpleMessage(
SoapWriter.java:114)
at
org.apache.servicemix.soap.marshalers.SoapWriter.write(SoapWriter.java:80)
at
org.apache.servicemix.http.processors.ProviderProcessor.writeMessage(
ProviderProcessor.ja
va:216)
at
org.apache.servicemix.http.processors.ProviderProcessor.process(
ProviderProcessor.java:11
--
Do I need to add some content to the message ?
Just for testing , I then proceeded to add some content to the Message :
msg.setContent(new StringSource("<value>TEST</value>"));
This worked and the data was returned but while processing the POST result
,
I get this error :
DEBUG - HttpSpringComponent - Received exchange: status:
Active,
role: Provider
DEBUG - header - >> "POST
/ServiceMixTest/MockServlet?TEST=VALUE HTTP/1.1[\r][\n]"
DEBUG - header - >> "Content-Type:
text/xml[\r][\n]"
DEBUG - header - >> "Content-Length: 60[\r][\n]"
DEBUG - header - >> "User-Agent: Jakarta
Commons-HttpClient/3.0[\r][\n]"
DEBUG - header - >> "Host: localhost:8080[\r][\n]"
DEBUG - header - >> "[\r][\n]"
DEBUG - content - >> "<?xml version='1.0'
encoding='utf-8'?><value>TEST</v
alue>"
DEBUG - header - << "HTTP/1.1 200 OK[\r][\n]"
DEBUG - header - << "Server: Resin/3.0.19[\r][\n]"
DEBUG - header - << "Transfer-Encoding:
chunked[\r][\n]"
DEBUG - header - << "Date: Wed, 21 Jun 2006
12:26:53
GMT[\r][\n]"
DEBUG - DeliveryChannel - Sending
ID:blrkec72278D-4514-1150892807947-5:0 in DeliveryC
hannel{ID:blrkec72278D-4514-1150892807947-0:0}
DEBUG - content - << "0"
DEBUG - content - << "0"
DEBUG - content - << "0"
DEBUG - content - << "8"
DEBUG - content - << "[\r]"
DEBUG - content - << "[\n]"
DEBUG - content - << "W"
[Fatal Error] :1:1: Content is not allowed in prolog.
DEBUG - content - << "[\r]"
DEBUG - content - << "[\n]"
DEBUG - DeliveryChannel - Unable to display message
org.xml.sax.SAXParseException: Content is not allowed in prolog.
at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown
Source)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSourceFromStream
(SourceTransformer.
java:234)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMSource(
SourceTransformer.java:146)
at
org.apache.servicemix.jbi.jaxp.SourceTransformer.toDOMNode(
SourceTransformer.java:288)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.traceMessageExchange
(DeliveryChan
nelImpl.java:311)
Has this been encountered before ?
Is the "Content is not allowed in prolog" due to the content
(<value>TEST</v
alue>) thats been inserted in the header ?
Thanks
Pat
--
View this message in context:
http://www.nabble.com/setContent%28%29-mandatory-for-HTTPComponent---t1828477.html#a4987948
Sent from the ServiceMix - User forum at Nabble.com.