Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • Step1: JAX-WS client invokes a service, in this manner for example:
    Code Block
    borderStylesolid
            URL wsdlURL = this.getClass().getResource("/HelloWorld.wsdl");
            HelloWorldService service = new HelloWorldService(wsdlURL, SERVICE_NAME);        
            HelloWorld hw = service.getHelloWorldPort();       
            String result = hw.sayHi(TEST_REQUEST); }}
    
  • Step2: CXF runtime selects the correct TransportFactory based on some criteria (described below)
  • Step3: CXF runtime calls TransportFactory.getConduit() method to obtain the conduit
  • Step4: CXF runtime invokes Conduit.prepare() and passes outgoing message as argument
  • Step5: Conduit sets own OutputStream (normally extended CachedOutputStream) as outgoing message content
  • Step6: CXF runtime processes outgoing message, calls the interceptor chain and invokes Conduit.close(Message) method for the outgoing message.
  • Step7: Finally, OutputStream.doClose() for the outgoing message is invoked
  • Step8: In the doClose() method, the OutputStream class has access to the marshalled outgoing message and exchange and will send this message to the service using the corresponding transport protocol
  • Step9: In case of one-way communication exchange will be closed. Skip to Step 14
  • Step10: In case of request-response communication, the conduit will wait for the service response in synchronous or asynchronous manner
  • Step11: When response is received, the conduit creates a new message, sets its context and puts it as In-Message in the exchange as an incoming message
  • Step12: When fault is received, Conduit creates a new Message, sets its context and puts it as fault message in exchange as in-fault message
  • Step13: Conduit notifies any incomingObserver(ClientImpl) about the response using incomingObserver.onMessage() call
  • Step14: Conduit.close(Message) method is invoked for incoming message. Normally the conduit implementation decreases the reference count with the service, potentially closing the network connection if the count is zero.
  • Step15: JAX-WS client code receives the response in sync or async style

...

  • Step1: JAX-WS service is registered for example in this way:
    Code Block
    borderStylesolid
    	HelloWorldImpl serverImpl = new HelloWorldImpl();
    	Endpoint.publish("udp://localhost:9000/hello", serverImpl);
    
  • Step2: CXF runtime selects correct TransportFactory based on some criteria (described below)
  • Step3: CXF runtime calls TransportFactory.getDestination() method to obtain the destination
  • Step4: As far as service is registered destination will be activated using soon as CXF runtime activates endpoint (adds listener, etc) Destination.activate() method is automatically invoked
  • Step5: Implementation of Destination.activate() normally opens network transport connections and listens to incoming requests
  • Step6: When a request comes, the destination creates a message, sets the content and notifies any message observers via getMessageObserverobserver (ChainInitializationObserver) via incomingObserver.onMessage() about request. Normally an incoming connection is saved in a correlation map to be extracted for the appropriate response.
  • Step7: The business service implementation will be called with the request message. In case of one-way communication the exchange is now finished. In case of request-response, the business implementation either returns a response or throws a fault exception.
  • Step8: The CXF Runtime requests a back-channel conduit from the destination via Destination.getInbuiltBackChannel()
  • Step9: The Back-channel conduit's prepare() method will be called with a response message as argument
  • Step10: Back-channel conduit sets its own OutputStream as a message context
  • Step11: CXF runtime processes the response message, calls the interceptor chain and invokes Conduit.close(Message) for the response message.
  • Step12. Finally OutputStream.doClose() method for the response message is invoked
  • Step13: In doClose() method the OutputStream class has access to the marshalled response message and will send this message through the network as a response to the client. Appropriate incoming connection normally is extracted from correlation map.

...

Code Block
xml
xml
<wsdl:definitions 
    xmlns:transport="http://cxf.apache.org/transports/TRANSPORT_PREFIX" …> …
…
<wsdl:binding name="GreeterPortBinding" type="tns: GreeterPortType">
        <soap:binding style="document" transport="http://cxf.apache.org/transports/TRANSPORT_PREFIX"/>
…
<wsdl:service name="GreeterService">
       <wsdl:port binding="tns:GreeterPortBinding" name="GreeterPort">
           <transport:address location="TRANSPORT_PREFIX://localhost:9000/hello/">

Conduit and Destination Lifecycle

...