The main difference is that if you use the XFire client code directly, your
service
(the orchestration one) is dependant on the protocol and location of the
services
it references, whereas if you use the JBI proxy, you could change one of the
service
to be itself a router on the bus, use JMS instead of HTTP ...
This is all about decoupled services and only reference the interface of a
service rather
than the binding.

On 4/30/07, Bummer <[EMAIL PROTECTED]> wrote:


I have tried the jsr181 ochestration example(citytime) which invokes
localtime and uszip webservices.
It kind of worked except that I got the error saying :

org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested
exception is org.codehaus.xfire.fault.XFireFault: Current state not
START_ELEMENT, END_ELEMENT or ENTITY_REFERENCE ....

But when I looked at the debug log, I found out that it actually invoked
uszip webservice sucessfully and the localtime webservices was invoked ok
at
the server side.

Instead using proxy in the xbean.xml, I have tried xfire proxy code (using
generated LocalTimeClient class), and it worked great !!

What is the difference between using proxy in the xbean.xml and client
stub
code ?


Following is the my xbean.xml and debug log.

--------
<beans xmlns:jsr181="http://servicemix.apache.org/jsr181/1.0";
       xmlns:localtime="http://ripedev.com/xsd/ZipCodeResults.xsd";
       xmlns:uszip="http://www.webserviceX.NET";>

   <jsr181:endpoint pojo="#citytime"
                    wsdlResource="classpath:service.wsdl"
                    typeMapping="jaxb2"
                    annotations="jsr181"
                    style="document" />

   <bean id="citytime"
class="org.apache.servicemix.samples.citytime.CityTimeImpl">
      <property name="usZip">
         <jsr181:proxy context="#context"
                       type="net.webservicex.USZipSoap"
                       service="uszip:USZip" />
      </property>
      <property name="localTime">
         <jsr181:proxy context="#context"
                       type="com.ripedev.xsd.zipcoderesults.LocalTimeSoap"
                       service="localtime:LocalTime" />
      </property>
   </bean>

</beans>

--------
...

DEBUG - header                         - << "X-AspNet-Version:
2.0.50727[\r][\n]"
DEBUG - header                         - << "Cache-Control:
no-cache[\r][\n]"
DEBUG - header                         - << "Pragma: no-cache[\r][\n]"
DEBUG - header                         - << "Expires: -1[\r][\n]"
DEBUG - header                         - << "Content-Type: text/xml;
charset=utf-8[\r][\n]"
DEBUG - header                         - << "Content-Length: 427[\r][\n]"
DEBUG - content                        - << "<?xml version="1.0"
encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlso
ap.org/soap/envelope/" xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";><soap:Bo
dy><LocalTimeByZipCodeResponse
xmlns="http://ripedev.com/xsd/ZipCodeResults.xsd
"><LocalTimeByZipCodeResult>4/30/2007
10:38:07 AM</

LocalTimeByZipCodeResult></LocalTimeByZipCodeResponse></soap:Body></soap:Envelope>"
DEBUG - Client                         - Received message to
urn:xfire:transport:jbi:1177929498140101796597126
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase pre-dispatch
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase dispatch
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase dispatch
DEBUG - HandlerPipeline                - Invoking phase transport
DEBUG - HandlerPipeline                - Invoking phase parse
DEBUG - HandlerPipeline                - Invoking phase pre-dispatch
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.client.CorrelatorHandler in phase pre-dispatch
DEBUG - Client                         - Correlating context with ID
1177929498140111480716151
DEBUG - Client                         - Found correlated context with ID
1177929498140111480716151
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase service
DEBUG - HandlerPipeline                - Invoking phase dispatch
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.handler.LocateBindingHandler in phase dispatch
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.soap.handler.SoapBodyHandler in phase dispatch
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase user
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase pre-dispatch
DEBUG - HandlerPipeline                - Invoking phase transport
DEBUG - HandlerPipeline                - Invoking phase parse
DEBUG - HandlerPipeline                - Invoking phase pre-dispatch
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.client.CorrelatorHandler in phase pre-dispatch
DEBUG - Client                         - Correlating context with ID
1177929498140111480716151
DEBUG - Client                         - Found correlated context with ID
1177929498140111480716151
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase service
DEBUG - HandlerPipeline                - Invoking phase dispatch
DEBUG - HandlerPipeline                - Invoking phase policy
DEBUG - HandlerPipeline                - Invoking phase user
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.client.ClientFaultConverter in phase user
DEBUG - HandlerPipeline                - Invoking phase pre-invoke
DEBUG - HandlerPipeline                - Invoking phase service
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.client.ClientReceiveHandler in phase service
ERROR - DefaultFaultHandler            - Fault occurred!
org.codehaus.xfire.XFireRuntimeException: Could not invoke service..
Nested
exception is org.codehaus.xfire.fault.XFireFault: Curr
ent state not START_ELEMENT, END_ELEMENT or ENTITY_REFERENCE
org.codehaus.xfire.fault.XFireFault: Current state not START_ELEMENT,
END_ELEMENT or ENTITY_REFERENCE
        at
org.codehaus.xfire.fault.XFireFault.createFault(XFireFault.java:89)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:391)
        at
org.apache.servicemix.jsr181.xfire.JbiChannel.send(JbiChannel.java:123)
        at
org.codehaus.xfire.handler.OutMessageSender.invoke(OutMessageSender.java
:26)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java
:131)
        at org.codehaus.xfire.client.Invocation.invoke(Invocation.java:75)
        at org.codehaus.xfire.client.Client.invoke(Client.java:335)
        at
org.apache.servicemix.jsr181.xfire.JbiProxy$JAXWSJBIClient.invoke(
JbiProxy.java:199)
        at
org.codehaus.xfire.client.XFireProxy.handleRequest(XFireProxy.java:77)
        at org.codehaus.xfire.client.XFireProxy.invoke(XFireProxy.java:57)
        at
org.apache.servicemix.jsr181.xfire.JbiProxyFactoryBean$1.invoke(
JbiProxyFactoryBean.java:75)
        at $Proxy38.localTimeByZipCode(Unknown Source)
        at
org.apache.servicemix.samples.citytime.CityTimeImpl.getCityTime(
CityTimeImpl.java:36)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java
:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(
DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at
org.codehaus.xfire.service.invoker.AbstractInvoker.invoke(
AbstractInvoker.java:54)
        at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.sendMessage(
ServiceInvocationHandler.java:322)
        at
org.codehaus.xfire.service.binding.ServiceInvocationHandler$1.run(
ServiceInvocationHandler.java:86)
        at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.execute(
ServiceInvocationHandler.java:134)
        at
org.codehaus.xfire.service.binding.ServiceInvocationHandler.invoke(
ServiceInvocationHandler.java:109)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java
:131)
        at
org.codehaus.xfire.transport.DefaultEndpoint.onReceive(
DefaultEndpoint.java:64)
        at
org.codehaus.xfire.transport.AbstractChannel.receive(AbstractChannel.java
:38)
        at
org.apache.servicemix.jsr181.Jsr181ExchangeProcessor.process(
Jsr181ExchangeProcessor.java:110)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.doProcess(
AsyncBaseLifeCycle.java:489)
        at
org.apache.servicemix.common.AsyncBaseLifeCycle.processExchange(
AsyncBaseLifeCycle.java:441)
        at
org.apache.servicemix.common.BaseLifeCycle.onMessageExchange(
BaseLifeCycle.java:46)
        at
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(
DeliveryChannelImpl.java:593)
        at
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(
AbstractFlow.java:174)
        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
:134)
        at

edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.runTask
(ThreadPoolExecutor.java:665)
        at

edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run
(ThreadPoolExecutor.java:690)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.IllegalStateException: Current state not
START_ELEMENT,
END_ELEMENT or ENTITY_REFERENCE
        at
com.ctc.wstx.sr.BasicStreamReader.getLocalName(BasicStreamReader.java:708)
        at
org.codehaus.xfire.util.stax.DepthXMLStreamReader.getLocalName(
DepthXMLStreamReader.java:101)
        at
org.codehaus.xfire.aegis.stax.ElementReader.<init>(ElementReader.java:56)
        at
org.codehaus.xfire.aegis.stax.ElementReader.<init>(ElementReader.java:67)
        at

org.apache.servicemix.jsr181.xfire.ServiceFactoryHelper$FixedJAXWSOperationBinding.readMessage
(ServiceFactoryHelper.jav
a:383)
        at
org.codehaus.xfire.soap.handler.SoapBodyHandler.invoke(
SoapBodyHandler.java:42)
        at
org.codehaus.xfire.handler.HandlerPipeline.invoke(HandlerPipeline.java
:131)
        at org.codehaus.xfire.client.Client.onReceive(Client.java:387)
        ... 34 more
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase send
DEBUG - HandlerPipeline                - adding handler
[EMAIL PROTECTED] to phase user
DEBUG - HandlerPipeline                - Invoking phase post-invoke
DEBUG - HandlerPipeline                - Invoking phase policy
DEBUG - HandlerPipeline                - Invoking phase user
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.jaxws.handler.WebFaultHandler in phase user
DEBUG - HandlerPipeline                - Invoking phase transport
DEBUG - HandlerPipeline                - Invoking phase send
DEBUG - HandlerPipeline                - Invoking handler
org.codehaus.xfire.fault.FaultSender in phase send
DEBUG - jetty                          - resume continuation
[EMAIL PROTECTED]
2
DEBUG - jetty                          - REQUEST /citytime/ on
[EMAIL PROTECTED]
DEBUG - jetty                          - servlet=jbiServlet
DEBUG - jetty                          - chain=null
DEBUG - jetty                          - servelet holder=jbiServlet
DEBUG - jetty                          - RESPONSE /citytime/  400
DEBUG - jetty                          - continuation
[EMAIL PROTECTED]



--
View this message in context:
http://www.nabble.com/jsr181-ochestration-tf3669039s12049.html#a10251698
Sent from the ServiceMix - User mailing list archive at Nabble.com.




--
Cheers,
Guillaume Nodet
------------------------
Principal Engineer, IONA
Blog: http://gnodet.blogspot.com/

Reply via email to