Hi,
I am trying to use MTOM with XFire binding in my webservice as:
=======================================
<bean name="xfire.DocumentManagementService"
class="org.codehaus.xfire.spring.ServiceBean">
<property name="xfire" ref="xfire"/>
<property name="serviceFactory"><ref
bean="xfire.annotationServiceFactory"/></property>
<property
name="name"><value>DocumentManagementService</value></property>
<property name="serviceBean" ref="documentManagementService"/>
<property name="properties">
<map>
<entry key="mtom-enabled" value="true"/>
</map>
</property>
</bean>
===============================================
<sm:activationSpec
componentName="documentManagementHttpBinding"
service="xfire:httpBinding"
destinationService="xfire:DocumentManagementService">
<sm:component>
<bean class="org.apache.servicemix.components.http.HttpInOutBinding"
abstract="false" singleton="true" lazy-init="default"
autowire="default" dependency-check="default" />
</sm:component>
</sm:activationSpec>
<sm:activationSpec
componentName="documentManagementXFireBinding"
service="xfire:DocumentManagementService">
<sm:component>
<bean class="org.apache.servicemix.components.xfire.XFireBinding">
<property name="xfire" ref="xfire" />
</bean>
</sm:component>
</sm:activationSpec>
================================================
To test this I proxy an xfire client as:
Service serviceModel = new
ObjectServiceFactory().create(DocumentManagementServiceInterface.class,
serviceName, SERVICE_NAMESPACE, null);
DocumentManagementServiceInterface service =
(DocumentManagementServiceInterface) new
XFireProxyFactory().create(serviceModel, SERVICE_URL
+ serviceName);
Client client = ((XFireProxy)
Proxy.getInvocationHandler(service)).getClient();
client.setProperty("mtom-enabled", "true");
client.setProperty(HttpTransport.CHUNKING_ENABLED, "true");
byte[] source = service.GetDocumentById("0901187e8000051b",
"userid", "password");
===================================================
I keep getting the error:
com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character 'c' (code
99) in prolog; expected '<'
at [row,col {unknown-source}]: [1,1]
at
com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:600)
at
com.ctc.wstx.sr.BasicStreamReader.nextFromProlog(BasicStreamReader.java:1889)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1026)
at org.codehaus.xfire.util.STAXUtils.readDocElements(STAXUtils.java:556)
at org.codehaus.xfire.util.STAXUtils.read(STAXUtils.java:405)
at org.codehaus.xfire.util.dom.DOMInHandler.invoke(DOMInHandler.java:42)
at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java:110)
at
org.codehaus.xfire.transport.DefaultEndpoint.onReceive(DefaultEndpoint.java:61)
at
org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java:38)
at
org.apache.servicemix.components.xfire.XFireBinding.process(XFireBinding.java:62)
at
org.apache.servicemix.components.util.OutBinding.onMessageExchange(OutBinding.java:48)
at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:622)
at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:168)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:176)
at
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:226)
at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
at
EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
==============================================
I tried this with DataSource as the service method return type but I still
get the same error. I disabled MTOM on the client and the response is
returned correctly but then the client fails to read the response. I disable
MTOM on both client and server and it works fine. I am using ServiceMix
3.0-M2. Any ideas?
Cheers,
Hari.
--
View this message in context:
http://www.nabble.com/MTOM-with-XFire-binding-error-tf2142847.html#a5915217
Sent from the ServiceMix - User forum at Nabble.com.