[mule-user] RE: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'C' (code 67) in prolog; expected '

879 views
Skip to first unread message

Tomas Blohm

unread,
Mar 22, 2012, 3:59:20 AM3/22/12
to us...@mule.codehaus.org
Hi,

I guess CXF has a hard time parsing the string "hello" as SOAP. You need to pass a valid SOAP to use it this way.

/Tomas Blohm --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

lee jimmy

unread,
Mar 22, 2012, 5:34:21 AM3/22/12
to us...@mule.codehaus.org
Hi Tomas, thanks your reply, and i tried ur suggestion, it doesn't work, and i got the same error.
i tried two method.
1. send SOAP as a String
...
File file = new File("c:/muleMessage.xml");
char[] b = new char[(int) file.length()];
BufferedReader br = new BufferedReader(new FileReader(file));
br.read(b,0,b.length);
br.close();
String str = String.valueOf(b);
MuleMessage message = mc.send("vm://test1", str, null);
....

2. send SOAP file directly
....
File file = new File("c:/muleMessage.xml");
MuleMessage message = mc.send("vm://test1", file, null);
...

content of muleMessage.xml is

2342342342

do you have any other idea? thanks. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

lee jimmy

unread,
Mar 22, 2012, 5:35:22 AM3/22/12
to us...@mule.codehaus.org
muleMessage.xml is

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ws="http://ws.lp.com/">
<soapenv:Header/>
<soapenv:Body>
<ws:sayHello>
<str>2342342342</str>
</ws:sayHello>
</soapenv:Body>
</soapenv:Envelope>

lee jimmy

unread,
Mar 22, 2012, 5:43:21 AM3/22/12
to us...@mule.codehaus.org
it doesn't show my code, i attached it below.

Tomas Blohm

unread,
Mar 22, 2012, 6:04:21 AM3/22/12
to us...@mule.codehaus.org
Looking once more at your config I see that you have an outbound endpoint where cxf is registered with. If you simply want to call a webservice and return an answer that should be on the inbound endpoint.
Make your inbound a http one and add the cxf component to that one. Or do you really want the webservice to listen on vm?

/Tomas Blohm --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

lee jimmy

unread,
Mar 22, 2012, 6:18:21 AM3/22/12
to us...@mule.codehaus.org
that webservice created by mule, and i deploy it on weblogic, now i want to call it in another application. this is precondition.

do you mean this config it like below?

<flow name="external">
<inbound-endpoint address="http://localhost:65081/services/echoUMO" exchange-pattern="request-response">
<cxf:jaxws-client serviceClass="com.lp.ws.IHello" operation="sayHello" />
</inbound-endpoint>
<component>
<singleton-object class="com.lp.ws.Hello"/>
</component>
</flow>


this can run, but couldn't get correct output, i got this:
received from external mule webservice->org.mule.transport.http.ReleasingInputStream@10fb9bd

do i need add a transformer? or is this also wrong? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Tomas Blohm

unread,
Mar 22, 2012, 7:14:22 AM3/22/12
to us...@mule.codehaus.org
Yes, that's how I meant. Just add a object-to-string transformer or call getPayloadAsString() and you should be fine...

/Tomas Blohm --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

lee jimmy

unread,
Mar 22, 2012, 8:10:22 AM3/22/12
to us...@mule.codehaus.org
i followed ur advice, i call getPayloadAsString(),

MuleMessage message = mc.send("http://localhost:65081/services/echoUMO", "hello", null);
Object obj = message.getPayloadAsString();
...
System.out.println("received from external mule webservice->"+obj);

i got classcastexception, please see below
[03-22 19:56:38] WARN PhaseInterceptorChain [connector.http.mule.default.receiver.02]: Interceptor for {http://ws.lp.com/}IHelloService#{http... has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:121)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:322)
at org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:222)
at org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:125)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.processor.chain.DefaultMessageProcessorChain.doProcess(DefaultMessageProcessorChain.java:99)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.doProcess(InterceptingChainLifecycleWrapper.java:56)
at org.mule.processor.chain.AbstractMessageProcessorChain.process(AbstractMessageProcessorChain.java:66)
at org.mule.processor.chain.InterceptingChainLifecycleWrapper.process(InterceptingChainLifecycleWrapper.java:87)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:195)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:163)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:150)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:299)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:258)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String
at com.lp.ws.jaxws_asm.SayHello_WrapperTypeHelper1.createWrapperObject(Unknown Source)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
... 25 more
[03-22 19:56:38] ERROR DefaultSystemExceptionStrategy [connector.http.mule.default.receiver.02]:
********************************************************************************
Message : org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String (org.apache.cxf.interceptor.Fault)
Type : org.mule.api.DefaultMuleException
Code : MULE_ERROR-10999
JavaDoc : http://www.mulesoft.org/docs/site/cur...
********************************************************************************
Exception stack is:
1. org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String (java.lang.ClassCastException)
com.lp.ws.jaxws_asm.SayHello_WrapperTypeHelper1:104 (null)
2. org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String (org.apache.cxf.interceptor.Fault)
org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor:121 (null)
3. org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String (org.apache.cxf.interceptor.Fault) (org.mule.api.DefaultMuleException)
org.mule.module.cxf.CxfOutboundMessageProcessor:139 (http://www.mulesoft.org/docs/site/cur...)
********************************************************************************
Root Exception stack trace:
java.lang.ClassCastException: org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String
at com.lp.ws.jaxws_asm.SayHello_WrapperTypeHelper1.createWrapperObject(Unknown Source)
at org.apache.cxf.jaxws.interceptors.WrapperClassOutInterceptor.handleMessage(WrapperClassOutInterceptor.java:105)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:255)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:322)
at org.mule.module.cxf.CxfOutboundMessageProcessor.doSendWithClient(CxfOutboundMessageProcessor.java:222)
at org.mule.module.cxf.CxfOutboundMessageProcessor.process(CxfOutboundMessageProcessor.java:125)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:195)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:163)
at org.mule.transport.AbstractMessageReceiver.routeMessage(AbstractMessageReceiver.java:150)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.doRequest(HttpMessageReceiver.java:299)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.processRequest(HttpMessageReceiver.java:258)
at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:163)
at org.mule.work.WorkerContext.run(WorkerContext.java:310)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)

********************************************************************************

received from external mule webservice->org.apache.commons.httpclient.ContentLengthInputStream cannot be cast to java.lang.String (org.apache.cxf.interceptor.Fault) --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

lee jimmy

unread,
Mar 22, 2012, 8:15:22 AM3/22/12
to us...@mule.codehaus.org
and i tried to add a transformer,

<flow name="external">
<inbound-endpoint address="http://localhost:65081/services/echoUMO" exchange-pattern="request-response">
<cxf:jaxws-client serviceClass="com.lp.ws.IHello" operation="sayHello" />
</inbound-endpoint>
<component>
<singleton-object class="com.lp.ws.Hello"/>
</component>
<object-to-string-transformer name="ObjectToString" />
</flow>

i got similiar exception, see below
[03-22 20:06:10] WARN PhaseInterceptorChain [connector.http.mule.default.receiver.02]: Interceptor for {http://ws.lp.com/}IHelloService#{http... has thrown exception, unwinding now
[03-22 20:06:10] ERROR DefaultSystemExceptionStrategy [connector.http.mule.default.receiver.02]:
received from external mule webservice->org.mule.transport.http.ReleasingInputStream@114fc36 --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email

Tomas Blohm

unread,
Mar 22, 2012, 8:38:22 AM3/22/12
to us...@mule.codehaus.org
You ??re using jaxws-client, that's for consuming a webservice. You should use jaxws-service or simple-service.
Did you take a look at:
http://www.mulesoft.org/documentation...

/Tomas Blohm --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email
Reply all
Reply to author
Forward
0 new messages