You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by ychawla <pr...@gmail.com> on 2015/11/24 23:32:50 UTC

Soap Body is Empty or Partial XML

Hello All,
I am using Camel 2.14.4 and deploy to Apache Karaf 3.0.5 with Java 8.  I
have a web service that I am exposing over HTTP and it worked fine in Camel
2.10.7.  When I hit the service now, it returns a WoodStox error when trying
to convertBodyTo a String or Document:

Caused by: com.ctc.wstx.exc.WstxEOFException: Unexpected EOF; was expecting
a close tag for element <er-ext:AttributeXPath>
 at [row,col {unknown-source}]: [53,88]
	at com.ctc.wstx.sr.StreamScanner.throwUnexpectedEOF(StreamScanner.java:685)
	at
com.ctc.wstx.sr.BasicStreamReader.throwUnexpectedEOF(BasicStreamReader.java:5519)
	at
com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2722)
	at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1073)

I have turned on CXFLogging on the endpoint and I see the entire message.  I
opened in an XML editor and it is schema valid and well formed.

I tried different streamcache options on the route and context but those
didn't make a difference.

I have debugged into the DefaultCxfBinding.  I find some interesting results
here.  When it calls the method to get the payload body elements, the soap
body is empty:

else if (dataFormat == DataFormat.PAYLOAD) {
                List<SoapHeader> headers =
CastUtils.cast((List<?>)message.get(Header.HEADER_LIST));
                Map<String, String> nsMap = new HashMap<String, String>();
                *answer = new CxfPayload<SoapHeader>(headers,
getPayloadBodyElements(message, nsMap), nsMap);*
                
            }

I confirm that in getPayloadBodyElements:

    protected static List<Source> getPayloadBodyElements(Message message,
Map<String, String> nsMap) {
        // take the namespace attribute from soap envelop
        Document soapEnv = (Document) message.getContent(Node.class);

The soapEnv document is only the soap envelope, complete header, and empty
body:

<?xml version="1.0" encoding="UTF-8"?><soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Header>
        <Action
xmlns="http://www.w3.org/2005/08/addressing">Submit-Entity-Merge</Action>
        <MessageID
xmlns="http://www.w3.org/2005/08/addressing">580417e4-8590-4c2a-8715-b5ac100d9e74</MessageID>
        <To
xmlns="http://www.w3.org/2005/08/addressing">http://localhost:18002/NIJ/EntityResolutionService</To>
        <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
           
<Address>http://localhost:18003/OJB/MergeNotificationService/PersonSearchRequestServiceIntermediary</Address>
        </ReplyTo>
    </soap:Header>
    <soap:Body/>
</soap:Envelope>

Does anyone have any idea why the Soap Body is empty here?  And why I am
getting a woodstox parsing error?  The simplest solution is that the payload
is wrong when calling the service.  However, the CXF logging interceptors
confirm that the Soap message is complete and that the body is schema valid.

Any ideas?

Thanks!
Yogesh 




--
View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Soap Body is Empty or Partial XML

Posted by ychawla <pr...@gmail.com>.
Thanks Aki,
My first step in the Camel Route is to convert the body to a string.  I was
able to work around it by turning off streaming and since I need to modify
the payload, I don't need streaming in this use case.  Is it possible that
the default for Streaming in older versions of Camel like 2.10.7 was false? 
That would explain the anamolies when we upgraded to Camel 2.14.x

Thanks,
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364p5774840.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Soap Body is Empty or Partial XML

Posted by Aki Yoshida <el...@gmail.com>.
i think something is consuming the payload stream somewhere before
your other processing step is trying to consume/convert the data.
when using streaming, either you can consume the data once or must
convert it to something else if it needs to be consumed again.

CAMEL-8663 is not related to this behavior.

2015-12-02 21:55 GMT+01:00 ychawla <pr...@gmail.com>:
> Hello All,
> I added the parameter: allowStreaming=false to the CXF endpoints that were
> causing an issue and then they started to work normally.  It definitely
> seems like a bug because I would send consecutive schema valid messages and
> one would fail with the WoodStox exception and the other would not.
>
> Disabling streaming works but I believe there is a bug with the stream being
> sent from CXF to Camel.  Maybe it could be related to this JIRA issue:
>
> https://issues.apache.org/jira/browse/CAMEL-8663
>
> In my use case, I need to modify the payload and extract elements from it so
> it needs to be converted to a DOM anyway.
>
> Hopefully this helps the next person who sees this issue.
>
> However, does anyone know how to set the allowStreaming property globally
> for all CXF endpoints?
>
> Thanks,
> Yogesh
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364p5774624.html
> Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Soap Body is Empty or Partial XML

Posted by ychawla <pr...@gmail.com>.
Hello All,
I added the parameter: allowStreaming=false to the CXF endpoints that were
causing an issue and then they started to work normally.  It definitely
seems like a bug because I would send consecutive schema valid messages and
one would fail with the WoodStox exception and the other would not.

Disabling streaming works but I believe there is a bug with the stream being
sent from CXF to Camel.  Maybe it could be related to this JIRA issue:

https://issues.apache.org/jira/browse/CAMEL-8663

In my use case, I need to modify the payload and extract elements from it so
it needs to be converted to a DOM anyway.

Hopefully this helps the next person who sees this issue.

However, does anyone know how to set the allowStreaming property globally
for all CXF endpoints?

Thanks,
Yogesh



--
View this message in context: http://camel.465427.n5.nabble.com/Soap-Body-is-Empty-or-Partial-XML-tp5774364p5774624.html
Sent from the Camel - Users mailing list archive at Nabble.com.