You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Crack_David <ko...@christian-busch.com> on 2012/10/18 18:32:19 UTC
java.lang.IndexOutOfBoundsException in processing
Hey there,
Finally I created my SAP WebService-Call. The only problem is that the
HolderInInterceptor throws a IndexOutOfBoundsException by processing the
reply of the SAP WebService. I've enabled Outbound and Inbound-Logging to
see if the XMLs are sent correctly.
The problem accurs in HolderInInterceptor.class:67 where part->concreteName
= "ETColumnDescription".
*Index=2 and outHolders only contains one Element that is null.*
Holder holder = (Holder)outHolders.get(*part.getIndex() - 1*);
Any suggestions?
*Stacktrace:*
Cheers,
Chris
--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: java.lang.IndexOutOfBoundsException in processing
Posted by Crack_David <ko...@christian-busch.com>.
Thank you very much!
That solved all my problems. Thanks for the great support!
--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948p5716993.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: java.lang.IndexOutOfBoundsException in processing
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Your code should be like
public void handleMessage(Message message) throws Fault {
InputStream is = message.getContent(InputStream.class);
if (is != null) {
CachedOutputStream bos = new CachedOutputStream();
try {
IOUtils.copy(is, bos);
bos.flush();
is.close();
bos.close();
String soapMessage = new String(bos.getBytes());
//change this soapMesage what ever you want and set as message Content
} catch (IOException e) {
throw new Fault(e);
}
}
}
NOTE, this interceptor will impact the performance as it break the stream
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
On 2012-10-19, at 下午5:11, Crack_David wrote:
> Thanks for your help!
> I've added an interceptor in thereceive-Phase but sadly the message-object
> doesn't contain my XML-Stream. Is this the wrong interceptor-phase or do I
> have to do something more?
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948p5716990.html
> Sent from the cxf-user mailing list archive at Nabble.com.
Re: java.lang.IndexOutOfBoundsException in processing
Posted by Crack_David <ko...@christian-busch.com>.
Thanks for your help!
I've added an interceptor in thereceive-Phase but sadly the message-object
doesn't contain my XML-Stream. Is this the wrong interceptor-phase or do I
have to do something more?
--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948p5716990.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: java.lang.IndexOutOfBoundsException in processing
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
Yeah, you can always register an interceptor yourself on client side at very early stage(like Phase.RECEIVE) and change the InputStream to anything else you want.
However, the main problem here is that CXF and SAP webservice are not on same page, CXF is jaxws implementation which clearly defined how to use Holder, I'm not sure how Sap webservice handle Holder.
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
On 2012-10-19, at 下午3:39, Crack_David wrote:
> Jep, You've got the point. After creating a cxf-Server by myself everything
> worked fine. But that doesn't solve my problem ;) Is it maybe possible to
> catch the incoming xml-string and process it by myself?
> Any other ideas how to bypass this issue?
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948p5716981.html
> Sent from the cxf-user mailing list archive at Nabble.com.
Re: java.lang.IndexOutOfBoundsException in processing
Posted by Crack_David <ko...@christian-busch.com>.
Jep, You've got the point. After creating a cxf-Server by myself everything
worked fine. But that doesn't solve my problem ;) Is it maybe possible to
catch the incoming xml-string and process it by myself?
Any other ideas how to bypass this issue?
--
View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948p5716981.html
Sent from the cxf-user mailing list archive at Nabble.com.
Re: java.lang.IndexOutOfBoundsException in processing
Posted by Freeman Fang <fr...@gmail.com>.
Hi,
I suggest you create a CXF server and dump onwire message from CXF server, and compare it with the one from SAP webservice server.
My gut feeling is that SAP webservice may not follow the JAXWS spec about the Holder class.
-------------
Freeman(Yue) Fang
Red Hat, Inc.
FuseSource is now part of Red Hat
Web: http://fusesource.com | http://www.redhat.com/
Twitter: freemanfang
Blog: http://freemanfang.blogspot.com
http://blog.sina.com.cn/u/1473905042
weibo: http://weibo.com/u/1473905042
On 2012-10-19, at 上午12:32, Crack_David wrote:
> Hey there,
> Finally I created my SAP WebService-Call. The only problem is that the
> HolderInInterceptor throws a IndexOutOfBoundsException by processing the
> reply of the SAP WebService. I've enabled Outbound and Inbound-Logging to
> see if the XMLs are sent correctly.
> The problem accurs in HolderInInterceptor.class:67 where part->concreteName
> = "ETColumnDescription".
>
> *Index=2 and outHolders only contains one Element that is null.*
>
> Holder holder = (Holder)outHolders.get(*part.getIndex() - 1*);
>
>
> Any suggestions?
>
>
> *Stacktrace:*
>
>
>
> Cheers,
> Chris
>
>
>
> --
> View this message in context: http://cxf.547215.n5.nabble.com/java-lang-IndexOutOfBoundsException-in-processing-tp5716948.html
> Sent from the cxf-user mailing list archive at Nabble.com.