You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Brian Shields <br...@geminga.it.nuigalway.ie> on 2006/03/13 14:09:41 UTC

Re: [Axis2] EchoNonBlockingDualClient problem

Tony,
Apologies for jumping into this thread on an unrelated issue but i 
notice you have axis2 deployed on JBoss 4.0. I am about to undertake 
this task and was wondering if there was any resources on the web to 
help in it. I dont have a lot of experience with JBoss so not looking 
forward to it!!
Regards,
Brian

Antony Wilson wrote:

>
> I have not been able to get the EchonNonBlockingDualClient example to 
> work as described in the documentation.  In my setup, I have Axis2 
> deployed to JBoss 4.0.3 and I have modified the 
> userguide.example1.MyService to delay for about 10 seconds before 
> responding (leaving the 'echo' method).  After packaging and deploying 
> the MyService.aar to Axis2, I run EchoNonBlockingDualClient 
> example...slightly modified to add a print statement within the while 
> loop...like so
>
>    public static void main(String[] args) {
>        try {
>            OMElement payload = ClientUtil.getEchoOMElement();
>
>            Options options = new Options();
>            options.setTo(targetEPR);
>            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
>            options.setUseSeparateListener(true);
>
>            //Callback to handle the response
>            Callback callback = new Callback() {
>                public void onComplete(AsyncResult result) {
>                    try {
>                        StringWriter writer = new StringWriter();
>                        
> result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
>                                .createXMLStreamWriter(writer));
>                        writer.flush();
>                        System.out.println(writer.toString());
>
>
>                    } catch (XMLStreamException e) {
>                        onError(e);
>                    }
>                }
>
>                public void onError(Exception e) {
>                    e.printStackTrace();
>                }
>            };
>
>            //Non-Blocking Invocation
>            ServiceClient sender = new ServiceClient();
>            sender.setOptions(options);
>            sender.sendReceiveNonblocking(payload, callback);
>
>            //Wait till the callback receives the response.
>            while (!callback.isComplete()) {
>                System.out.println("waiting...");
>                Thread.sleep(1000);
>            }
>            //Need to close the Client Side Listener.
>
> We I run it the code appears to block/wait at the 
> "sender.sendRecieveNonBlocking(...)" line for about 10 seconds. When 
> the program continues,  I never see any print statements since the 
> "callback.isComplete()" is true by the time it gets to that point in 
> the code.  The really bizarre part is that if I use 
> "options.setUseSeparateListener(false)"...the behavior is exactly what 
> I was originally expecting...I see several "waiting..." print 
> statements before the callback's onComplete is invoked.  My 
> operational scenario requires a dual channel transport since my 
> webservice calls can be really long...therefore using a single two-way 
> transport (e.g., options.setUseSeparateListener(false)) is not a 
> viable option.
>
> Bottomline, I can't seem to get the two-way dual channel stuff 
> (EchoNonBlockingDualClient) to work for me.  I must be missing 
> something obvious...but I don't see what it is.  Any help would be 
> appreciated.
>
> Thanks,
> Tony
>
>

-- 
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology,
National University of Ireland,
Galway,
Ireland.

Re: [Axis2] EchoNonBlockingDualClient problem

Posted by robert lazarski <ro...@gmail.com>.
Going back to .93 - my dual transport code (a bit rough considering the time
context) looked like:

public class RCServiceClient {

    /** Access point inside the servlet container. **/
    private static EndpointReference targetEPR =
        new EndpointReference(
                "http://127.0.0.1:8080/swa_ws_test/services/RCService");

    /**
     * Chama o web service com main() - fora do Servlet Container.
     *
     * @param args Main
     */
    public static void main(String[] args) {
        try {

            OMElement payload = ClientUtil.getRCExecuteOMElement();
            Options options = new Options();
            options.setTo(targetEPR);
            /** TODO  axis2 API change
            options.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
            */
            options.setUseSeparateListener(true);

            Call call = new Call();
            call.setClientOptions(options);

            //Callback to handle the response
            Callback callback = new Callback() {
                public void onComplete(AsyncResult result) {
                    try {
                        SOAPEnvelope env = result.getResponseEnvelope();
                        env.toString();
                        StringWriter writer = new StringWriter();
                        env.serialize(writer);
                        System.out.println("inside onComplete...");
                        writer.flush();
                        System.out.println(writer.toString());
                    } catch (XMLStreamException e) {
                        reportError(e);
                    }
                }

                public void reportError(Exception e) {
                    e.printStackTrace();
                }
            };

            //Non-Blocking Invocation
            call.invokeNonBlocking("rcExecute", payload, callback);

            //Wait till the callback receives the response.
            System.out.println("RC Service executed, "
                    + "sleeping until completion, DO SOMETHING ELSE
HERE...");

            while (!callback.isComplete()) {
                Thread.sleep(1000);
            }
            //Need to close the Client Side Listener.
            call.close();
            System.out.println("RC Service completed");

        } catch (AxisFault axisFault) {
            axisFault.printStackTrace();

        } catch (Exception ex) {
            ex.printStackTrace();
        }

    }
}

Where my ClientUtil code was:

public static OMElement getRCExecuteOMElement() {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace omNs = fac.createOMNamespace(
                "http://example1.org/example1", "example1");
                // "http://siemens.com/radioCommander", "radioCommander");
        OMElement method = fac.createOMElement("rcExecute", omNs);
        OMElement value = fac.createOMElement("Text", omNs);
        value.addChild(fac.createText(value, "Axis2 Echo String "));
        method.addChild(value);

        return method;
    }

Worked for me at the time.

HTH,
Robert
http://www.braziloutsource.com/

On 3/14/06, Diego <di...@tiscalinet.it> wrote:
>
> Hi everybody!
>
> I'm also experiencing the same problem.  I run axis2 v0.93 on tomcat
> 5.5.7.  My code is slightly different than the EchoNonBlockingDualClient
> but it's basically the same:
>
>
> public void
> startinsertMappingAnnotations(InsertMappingAnnotationsDocument requestDoc,
>                                           final
> AstrodasPeerCallbackHandler callback)
>             throws RemoteException {
>     Call call = new Call(_serviceContext);
>     call.setClientOptions(_clientOptions);
>     MessageContext messageContext = getMessageContext();
>     _clientOptions.setSoapAction("insertMappingAnnotations");
>     // Uses two separate listeners: dual transport.
>     call.engageModule(new QName(Constants.MODULE_ADDRESSING));
>     _clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
>     _clientOptions.setUseSeparateListener(true);
>     // Sets the exception throwing status.
>     _clientOptions.setExceptionToBeThrownOnSOAPFault(true);
>     // Sets the properties.
>     SOAPEnvelope envelope = createEnvelope();
>
> setValueDoc(envelope,
> AstrodasPeerinsertMappingAnnotationsDatabindingSupporter.toOM
> (requestDoc));
>     messageContext.setEnvelope(envelope);
>     call.invokeNonBlocking(operations[0], messageContext,
>         new Callback() {
>             public void onComplete(AsyncResult result) {
>                 Object object =
> AstrodasPeerinsertMappingAnnotationsDatabindingSupporter
>
> .fromOM(getElement(result.getResponseEnvelope(),"doc"),
>
> InsertMappingAnnotationsResponseDocument.class);
>
> callback.receiveResultinsertMappingAnnotations
> ((InsertMappingAnnotationsResponseDocument)
> object);
>             }
>             public void reportError(Exception e) {
>                 callback.receiveErrorinsertMappingAnnotations(e);
>             }
>         });
> }
>
>
> I also get the same problem using a dual transport blocking client:
>
>
> public InsertMappingAnnotationsResponseDocument
> insertMappingAnnotations(InsertMappingAnnotationsDocument requestDoc)
>                                                  throws RemoteException {
>      MessageContext messageContext = getMessageContext();
>      Call call = new Call(_serviceContext);
>      _clientOptions.setSoapAction("insertMappingAnnotations");
>      call.setClientOptions(_clientOptions);
>      // Uses two separate listeners: dual transport.
>      call.engageModule(new QName(Constants.MODULE_ADDRESSING));
>      _clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP
> );
>      _clientOptions.setUseSeparateListener(true);
>      // Sets the exception throwing status.
>      // Sets the properties.
>      populateModules(call);
>      SOAPEnvelope envelope = createEnvelope();
>      // Style is Doc.
>
> setValueDoc(envelope,
> AstrodasPeerinsertMappingAnnotationsDatabindingSupporter.toOM
> (requestDoc));
>      messageContext.setEnvelope(envelope);
>      MessageContext responseMessageContext =
> call.invokeBlocking(operations[0],messageContext);
>      SOAPEnvelope responseEnvelope = responseMessageContext.getEnvelope();
>      Object obj = AstrodasPeerinsertMappingAnnotationsDatabindingSupporter
>
> .fromOM(getElement(responseEnvelope,"doc"),
> InsertMappingAnnotationsResponseDocument.class);
>      return (InsertMappingAnnotationsResponseDocument)obj;
> }
>
>
> The request arrives to the client and is executed successfully but the
> client doesn't get any response.  Actually, the server sends a response
> to the client, here it is:
>
>
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>
>    <soapenv:Header />
>    <soapenv:Body>
>      <soapenv:Fault>
>        <faultcode>Client</faultcode>
>        <faultstring>
>           For input string: "0:0:0:0:0:0:1:6060"; nested exception is:
>          .java.net.MalformedURLException: For input string:
> "0:0:0:0:0:0:1:6060"; nested exception is:
>          .org.apache.axis2.AxisFault: For input string:
> "0:0:0:0:0:0:1:6060"; nested exception is:
>          .java.net.MalformedURLException: For input string:
> "0:0:0:0:0:0:1:6060"
>        </faultstring>
>
>
>        <faultactor>http://myAxisServer/role/default</faultactor>
>        <detail>
>          <soapenv:Exception>
>            org.apache.axis2.AxisFault: For input string:
> "0:0:0:0:0:0:1:6060"; nested exception is:
>            .java.net.MalformedURLException: For input string: "
>            0:0:0:0:0:0:1:6060"; nested exception is:
>            .org.apache.axis2.AxisFault: For input string:
> "0:0:0:0:0:0:1:6060"; nested exception is:
>            .java.net.MalformedURLException: For input string:
> "0:0:0:0:0:0:1:6060"
>            .at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
> CommonsHTTPTransportSender.java:265)
>            .at
> org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:93)
>
>            .at
> org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(
> AbstractInOutSyncMessageReceiver.java:42)
>            .at
> org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:158)
>            .at
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(
> HTTPTransportUtils.java:211)
>            .at
> org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:181)
>            .at javax.servlet.http.HttpServlet.service(HttpServlet.java
> :709)
>            .at javax.servlet.http.HttpServlet.service(HttpServlet.java
> :802)
>            .at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(
> ApplicationFilterChain.java:252)
>            .at org.apache.catalina.core.ApplicationFilterCha
>            in.doFilter(ApplicationFilterChain.java:173)
>            .at
> org.apache.catalina.core.StandardWrapperValve.invoke(
> StandardWrapperValve.java:214)
>
>            .at
> org.apache.catalina.core.StandardContextValve.invoke(
> StandardContextValve.java:178)
>            .at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :126)
>            .at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :105)
>            .at
> org.apache.catalina.core.StandardEngineValve.invoke(
> StandardEngineValve.java:107)
>            .at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java
> :148)
>            .at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
>            .at
>
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection
> (Http11Protocol.java:738)
>            .at
> org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(
> PoolTcpEndpoint.java:526)
>            .at
> org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(
> LeaderFollowerWorkerThread.java:80)
>            .at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:684)
>
>            .at java.
>            lang.Thread.run(Thread.java:552)
>            Caused by: org.apache.axis2.AxisFault: For input string:
> "0:0:0:0:0:0:1:6060"; nested exception is:
>            .java.net.MalformedURLException: For input string:
> "0:0:0:0:0:0:1:6060"
>            .at
>
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons
> (CommonsHTTPTransportSender.java:320)
>            .at
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(
> CommonsHTTPTransportSender.java:233)
>            .... 21 more
>            Caused by: java.net.MalformedURLException: For input string:
> "0:0:0:0:0:0:1:6060"
>            .at java.net.URL.&lt;init>(URL.java:571)
>            .at java.net.URL.&lt;init>(URL.java:434)
>
>
>            .at java.net.URL.&lt;init>(URL.java:383)
>            .at
>
> org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons
> (CommonsHTTPTransportSender.java:291)
>            .... 22 more
>          </soapenv:Exception>
>        </detail>
>      </soapenv:Fault>
>    </soapenv:Body>
> </soapenv:Envelope>
>
>
> Is this a bug or are we doing something wrong?
>
> Thanks!
>
> Diego
>
>
> Ali Sadik Kumlali wrote:
> > Hi,
> >
> > I have the same problem with Tomcat 5.5 and have two questions:
> >
> > 1) Why does my client HTTP server is immediately closed and i get I/O
> > exception when server tries to post the response?
> >
> > 2) Why does it print "waiting" when options.setUseSeparateListener() is
> > passed false? (This is Antony Wilson's question actually)
> >
> > Thanks a lot.
> >
> > Ali Sadik Kumlali
> >
> > ------------------------------------------------------------------------
> > FIRST CASE
> >     + Original EchoNonBlockingDualClient.java
> >     + System.out.println("waiting..."); in while loop
> > ------------------------------------------------------------------------
> > Client Log
> > -----------
> > testEchoNonBlockingDualClient:
> >      [java] - Deploying module : addressing
> >      [java] - Starting to process SOAP 1.1 message
> >      [java] <?xml version='1.0' encoding='utf-8'?><soapenv:E nvelope
> > xmlns:soapen
> > v="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:wsa="http://schemas.xmlsoap.
> > org/ws/2004/08/addressing"><soapenv:Header><wsa:To
> > xmlns:wsa="http://schemas.xml
> > soap.org/ws/2004/08/addressing">
> http://10.10.10.103:6060/axis2/services/__ANONYM
> > OUS_SERVICE__/__OPERATION_OUT_IN__</wsa:To><wsa:ReplyTo
> > xmlns:wsa="http://schema
> > s.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>
> http://schemas.xmlsoap.org/ws/
> > 2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From
> > xmlns:wsa
> > ="http://schemas.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>
> http://127.0.0.
> > 1:8080/axis2/services/MyService</wsa:Address></wsa:From><wsa:MessageID
> > xmlns:wsa
> > ="http://schemas.xmlsoap.org/ws/2004/08/addressing
> ">D3C49495E884E3019B1142337591
> > 1122</wsa:MessageID><wsa:RelatesTo
> > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004
> > /08/addressing"
> > wsa:RelationshipType="wsa:Reply">975BF946D7CFA918C61142337583721
> > 1</wsa:RelatesTo></soapenv:Header><soapenv:Body><example1:echo
> > xmlns:example1="h
> > ttp://example1.org/example1"><example1:Text>Axis2 Echo String
> > </example1:Text></
> > example1:echo></soapenv:Body></soapenv:Envelope>
> >      [java] [SimpleHTTPServer] Stop called
> >
> > Server Log
> > ----------
> > - Deploying module : addressing
> > - Deploying module : security
> > - Starting to process SOAP 1.1 message
> > - I/O exception (org.apache.commons.httpclient.NoHttpResponseException)
> > caught
> >   when processing request: The server 10.10.10.103 failed to respond
> > - Retrying request
> >
> >
> >
> > ------------------------------------------------------------------------
> > SECOND CASE:
> >     + Original EchoNonBlockingDualClient.java
> >     + System.out.println("waiting..."); in while loop
> >   &nbs p; + options.setUseSeparateListener(false);
> > ------------------------------------------------------------------------
> > Client Log
> > -----------
> > testEchoNonBlockingDualClient:
> >      [java] - Deploying module : addressing
> >      [java] waiting...
> >      [java] - Starting to process SOAP 1.1 message
> >      [java] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope
> > xmlns:soapen
> > v="http://schemas.xmlsoap.org/soap/envelope/"
> > xmlns:wsa="http://schemas.xmlsoap.
> > org/ws/2004/08/addressing"><soapenv:Header><wsa:To
> > xmlns:wsa="http://schemas.xml
> > soap.org/ws/2004/08/addressing">
> http://schemas.xmlsoap.org/ws/2004/08/addressing
> > /role/anonymous</wsa:To><wsa:ReplyTo
> > xmlns:wsa="http://schemas.xmlsoap.org/ws/20
> > 04/08/addressing"><wsa:Address>
> http://schemas.xmlsoap.org/ws/2004/08/addressing/
> > role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From
> > xmlns:wsa="http://schemas.xm
> > lsoap.org/ws/2004/08/addressing"><wsa:Address>
> http://127.0.0.1:8080/axis2/servic
> > es/MyService</wsa:Address></wsa:From><wsa:MessageID
> > xmlns:wsa="http://schemas.xm
> > lsoap.org/ws/2004/08/addressing
> ">D3C49495E884E3019B11423376489274</wsa:MessageID
> >  ><wsa:RelatesTo
> > xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" wsa
> >
> :RelationshipType="wsa:Reply">6439FE16DCA2252A8E11423376486611</wsa:RelatesTo></
> > soapenv:Header><soapenv:Body><example1:echo
> > xmlns:example1="http://example1.org/
> > example1"><example1:Text>Axis2 Echo String
> > </example1:Text></example1:echo></soa
> > penv:Body></soapenv:Envelope>
> >
> > Server Log
> > ----------
> > - De ploying module : addressing
> > - Deploying module : security
> > - Starting to process SOAP 1.1 message
> >
> >
> >
> >
> >
> > */robert lazarski <ro...@gmail.com>/* wrote:
> >
> >     Could you start another thread with an axis2 prefix mentioning jboss
> >     ? I know jboss with web services ok, but it was with either axis 1
> >     or jwsdp - not axis2 . Are you using wsdl and ejb ?
> >
> >     Robert
> >     http://www.braziloutsource.com/
> >
> >     On 3/13/06, *Brian Shields* < brian.shields@geminga.it.nuigalway.ie
> >     <ma...@geminga.it.nuigalway.ie>> wrote:
> >
> >         Tony,
> >         Apologies for jumping into this thread on an unr elated issue
> but i
> >         notice you have axis2 deployed on JBoss 4.0. I am about to
> undertake
> >         this task and was wondering if there was any resources on the
> web to
> >         help in it. I dont have a lot of experience with JBoss so not
> >         looking
> >         forward to it!!
> >         Regards,
> >         Brian
> >
> >         Antony Wilson wrote:
> >
> >          >
> >          > I have not been able to get the EchonNonBlockingDualClient
> >         example to
> >          > work as described in the documentation.  In my setup, I have
> >         Axis2
> >          > deployed to JBoss 4.0.3 and I have modified the
> >          > userguide.example1.MyService to delay for about 10 seconds
> before
> >          > responding (leaving the 'echo' method).  After packaging and
> >         deploying
> >          > the MyService.aar to Axis2, I run EchoNonBlockingDualClient
> >          > example...slightly modified to add a print statement within
> >         the while
> >          > loop...like so
> >          >
> >          >    public static void main(String[] args) {
> >          >        try {
> >          >            OMElement payload = ClientUtil.getEchoOMElement();
> >          >
> >          >            Options options = new Options();
> >          >            options.setTo(targetEPR);
> >          >            options.setTransportInProtocol
> >         (Constants.TRANSPORT_HTTP);
> >          >            options.setUseSeparateListener(true);
> >          >
> >          >            //Callback to handle the response
> >          >            Callback callback = new Callback() {
> >          >                public void onComplete(AsyncResult result) {
> >          >                    try {
> >          >                        StringWriter writer = new
> StringWriter();
> >          >
> >          >
> >         result.getResponseEnvelope().serialize(
> XMLOutputFactory.newInstance()
>
> >          >                                .createXMLStreamWriter(writer));
> >          >                        writer.flush ();
> >          >                        System.out.println(writer.toString());
> >          >
> >          >
> >          >                    } catch (XMLStreamException e) {
> >          >                        onError(e);
> >          >                    }
> >          >                }
> >          >
> >          >                public void onError(Exception e) {
> >          >                    e.printStackTrace();
> >          >                }
> >          >            };
> >          >
> >          >            //Non-Blocking Invocation
> >          >            ServiceClient sender = new ServiceClient();
> >          >            sender.setOptions(options);
> >          >            sender.sendReceiveNonblocking(payload, callback);
> >          >
> >          >            //Wait till the callback receives the response.
> >          >            while (!callback.isComplete()) {
> >          >                System.out.println("waiting...");
> >          >                Thread.sleep(1000);
> >          >            }
> >          >            //Need to close the Client Side Listener.
> >          >
> >          > We I run it the code appears to block/wait at the
> >          > "sender.sendRecieveNonBlocking(...)" line for about 10
> >         seconds. When
> >          > the program continues,  I never see any print statements
> >         since the
> >          > "callback.isComplete()" is true by the time it gets to that
> >         point in
> >          > the code.  The really bizarre part is that if I use
> >          > "options.setUseSeparateListener(false)"...the behavior is
> >         exactly what
> >          > I was originally expecting...I see several "waiting..." print
> >          > statements before the callback's onComplete is invoked.  My
> >          > operational scenario requires a dual channel transport since
> my
> >          > webservice calls can be really long...therefore using a
> >         single two-way
> >          > transport (e.g., options.setUseSeparateListener(false)) is
> not a
> >          > viable option.
> >          >
> >          > Bottomline, I can't seem to get the two-way dual channel
> stuff
> >          > (EchoNonBlockingDualClient) to work for me.  I must be
> missing
> >          > something obvious...but I don't see what it is.  Any help
> >         would be
> >          > appreciated.
> >          >
> >          > Thanks,
> >          > Tony
> >          >
> >          >
> >
> >         --
> >         Brian Shields BSc. MSc.,
> >         PhD Candidate,
> >         Department of Information Technology,
> >         National University of Ireland,
> >         Galway,
> >         Ireland.
> >
> >
> >
> > < p>
> > ------------------------------------------------------------------------
> > Yahoo! Mail
> > Use Photomail
> > <
> http://us.rd.yahoo.com/mail_us/taglines/pmall2/*http://photomail.mail.yahoo.com
> >
> > to share photos without annoying attachments.
> >
> > ------------------------------------------------------------------------
> > Yahoo! Mail
> > Bring photos to life! New PhotoMail
> > <
> http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=39174/*http://photomail.mail.yahoo.com
> >
> > makes sharing a breeze.
>

Re: [Axis2] EchoNonBlockingDualClient problem

Posted by Diego <di...@tiscalinet.it>.
Hi everybody!

I'm also experiencing the same problem.  I run axis2 v0.93 on tomcat 
5.5.7.  My code is slightly different than the EchoNonBlockingDualClient 
but it's basically the same:


public void 
startinsertMappingAnnotations(InsertMappingAnnotationsDocument requestDoc,
                                          final 
AstrodasPeerCallbackHandler callback)
            throws RemoteException {
    Call call = new Call(_serviceContext);
    call.setClientOptions(_clientOptions);
    MessageContext messageContext = getMessageContext();
    _clientOptions.setSoapAction("insertMappingAnnotations");
    // Uses two separate listeners: dual transport.
    call.engageModule(new QName(Constants.MODULE_ADDRESSING));
    _clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
    _clientOptions.setUseSeparateListener(true);
    // Sets the exception throwing status.
    _clientOptions.setExceptionToBeThrownOnSOAPFault(true);
    // Sets the properties.
    SOAPEnvelope envelope = createEnvelope();
 
setValueDoc(envelope,AstrodasPeerinsertMappingAnnotationsDatabindingSupporter.toOM(requestDoc));
    messageContext.setEnvelope(envelope);
    call.invokeNonBlocking(operations[0], messageContext,
        new Callback() {
            public void onComplete(AsyncResult result) {
                Object object = 
AstrodasPeerinsertMappingAnnotationsDatabindingSupporter
 
.fromOM(getElement(result.getResponseEnvelope(),"doc"),
 
InsertMappingAnnotationsResponseDocument.class);
 
callback.receiveResultinsertMappingAnnotations((InsertMappingAnnotationsResponseDocument) 
object);
            }
            public void reportError(Exception e) {
                callback.receiveErrorinsertMappingAnnotations(e);
            }
        });
}


I also get the same problem using a dual transport blocking client:


public InsertMappingAnnotationsResponseDocument 
insertMappingAnnotations(InsertMappingAnnotationsDocument requestDoc)
                                                 throws RemoteException {
     MessageContext messageContext = getMessageContext();
     Call call = new Call(_serviceContext);
     _clientOptions.setSoapAction("insertMappingAnnotations");
     call.setClientOptions(_clientOptions);
     // Uses two separate listeners: dual transport.
     call.engageModule(new QName(Constants.MODULE_ADDRESSING));
     _clientOptions.setListenerTransportProtocol(Constants.TRANSPORT_HTTP);
     _clientOptions.setUseSeparateListener(true);
     // Sets the exception throwing status.
     // Sets the properties.
     populateModules(call);
     SOAPEnvelope envelope = createEnvelope();
     // Style is Doc.
 
setValueDoc(envelope,AstrodasPeerinsertMappingAnnotationsDatabindingSupporter.toOM(requestDoc));
     messageContext.setEnvelope(envelope);
     MessageContext responseMessageContext = 
call.invokeBlocking(operations[0],messageContext);
     SOAPEnvelope responseEnvelope = responseMessageContext.getEnvelope();
     Object obj = AstrodasPeerinsertMappingAnnotationsDatabindingSupporter
 
.fromOM(getElement(responseEnvelope,"doc"),InsertMappingAnnotationsResponseDocument.class);
     return (InsertMappingAnnotationsResponseDocument)obj;
}


The request arrives to the client and is executed successfully but the 
client doesn't get any response.  Actually, the server sends a response 
to the client, here it is:


<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> 

   <soapenv:Header />
   <soapenv:Body>
     <soapenv:Fault>
       <faultcode>Client</faultcode>
       <faultstring>
          For input string: "0:0:0:0:0:0:1:6060"; nested exception is:
         .java.net.MalformedURLException: For input string: 
"0:0:0:0:0:0:1:6060"; nested exception is:
         .org.apache.axis2.AxisFault: For input string: 
"0:0:0:0:0:0:1:6060"; nested exception is:
         .java.net.MalformedURLException: For input string: 
"0:0:0:0:0:0:1:6060"
       </faultstring> 
 

       <faultactor>http://myAxisServer/role/default</faultactor>
       <detail>
         <soapenv:Exception>
           org.apache.axis2.AxisFault: For input string: 
"0:0:0:0:0:0:1:6060"; nested exception is:
           .java.net.MalformedURLException: For input string: "
           0:0:0:0:0:0:1:6060"; nested exception is:
           .org.apache.axis2.AxisFault: For input string: 
"0:0:0:0:0:0:1:6060"; nested exception is:
           .java.net.MalformedURLException: For input string: 
"0:0:0:0:0:0:1:6060"
           .at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:265)
           .at 
org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:93) 

           .at 
org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver.receive(AbstractInOutSyncMessageReceiver.java:42)
           .at 
org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:158)
           .at 
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:211)
           .at 
org.apache.axis2.transport.http.AxisServlet.doPost(AxisServlet.java:181)
           .at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
           .at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
           .at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
           .at org.apache.catalina.core.ApplicationFilterCha
           in.doFilter(ApplicationFilterChain.java:173)
           .at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214) 

           .at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
           .at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
           .at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
           .at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
           .at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
           .at 
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
           .at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
           .at 
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
           .at 
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
           .at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) 

           .at java.
           lang.Thread.run(Thread.java:552)
           Caused by: org.apache.axis2.AxisFault: For input string: 
"0:0:0:0:0:0:1:6060"; nested exception is:
           .java.net.MalformedURLException: For input string: 
"0:0:0:0:0:0:1:6060"
           .at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:320)
           .at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:233)
           .... 21 more
           Caused by: java.net.MalformedURLException: For input string: 
"0:0:0:0:0:0:1:6060"
           .at java.net.URL.&lt;init>(URL.java:571)
           .at java.net.URL.&lt;init>(URL.java:434) 
 

           .at java.net.URL.&lt;init>(URL.java:383)
           .at 
org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:291)
           .... 22 more
         </soapenv:Exception>
       </detail>
     </soapenv:Fault>
   </soapenv:Body>
</soapenv:Envelope>


Is this a bug or are we doing something wrong?

Thanks!

Diego


Ali Sadik Kumlali wrote:
> Hi,
> 
> I have the same problem with Tomcat 5.5 and have two questions:
> 
> 1) Why does my client HTTP server is immediately closed and i get I/O 
> exception when server tries to post the response?
> 
> 2) Why does it print "waiting" when options.setUseSeparateListener() is 
> passed false? (This is Antony Wilson's question actually)
> 
> Thanks a lot.
> 
> Ali Sadik Kumlali
> 
> ------------------------------------------------------------------------
> FIRST CASE
>     + Original EchoNonBlockingDualClient.java
>     + System.out.println("waiting..."); in while loop
> ------------------------------------------------------------------------
> Client Log
> -----------
> testEchoNonBlockingDualClient:
>      [java] - Deploying module : addressing
>      [java] - Starting to process SOAP 1.1 message
>      [java] <?xml version='1.0' encoding='utf-8'?><soapenv:E nvelope 
> xmlns:soapen
> v="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:wsa="http://schemas.xmlsoap.
> org/ws/2004/08/addressing"><soapenv:Header><wsa:To 
> xmlns:wsa="http://schemas.xml
> soap.org/ws/2004/08/addressing">http://10.10.10.103:6060/axis2/services/__ANONYM
> OUS_SERVICE__/__OPERATION_OUT_IN__</wsa:To><wsa:ReplyTo 
> xmlns:wsa="http://schema
> s.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>http://schemas.xmlsoap.org/ws/
> 2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From 
> xmlns:wsa
> ="http://schemas.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>http://127.0.0.
> 1:8080/axis2/services/MyService</wsa:Address></wsa:From><wsa:MessageID 
> xmlns:wsa
> ="http://schemas.xmlsoap.org/ws/2004/08/addressing">D3C49495E884E3019B1142337591
> 1122</wsa:MessageID><wsa:RelatesTo 
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004
> /08/addressing" 
> wsa:RelationshipType="wsa:Reply">975BF946D7CFA918C61142337583721
> 1</wsa:RelatesTo></soapenv:Header><soapenv:Body><example1:echo 
> xmlns:example1="h
> ttp://example1.org/example1"><example1:Text>Axis2 Echo String 
> </example1:Text></
> example1:echo></soapenv:Body></soapenv:Envelope>
>      [java] [SimpleHTTPServer] Stop called
> 
> Server Log
> ----------
> - Deploying module : addressing
> - Deploying module : security
> - Starting to process SOAP 1.1 message
> - I/O exception (org.apache.commons.httpclient.NoHttpResponseException) 
> caught
>   when processing request: The server 10.10.10.103 failed to respond
> - Retrying request
> 
> 
> 
> ------------------------------------------------------------------------
> SECOND CASE:
>     + Original EchoNonBlockingDualClient.java
>     + System.out.println("waiting..."); in while loop
>   &nbs p; + options.setUseSeparateListener(false);
> ------------------------------------------------------------------------
> Client Log
> -----------
> testEchoNonBlockingDualClient:
>      [java] - Deploying module : addressing
>      [java] waiting...
>      [java] - Starting to process SOAP 1.1 message
>      [java] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope 
> xmlns:soapen
> v="http://schemas.xmlsoap.org/soap/envelope/" 
> xmlns:wsa="http://schemas.xmlsoap.
> org/ws/2004/08/addressing"><soapenv:Header><wsa:To 
> xmlns:wsa="http://schemas.xml
> soap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing
> /role/anonymous</wsa:To><wsa:ReplyTo 
> xmlns:wsa="http://schemas.xmlsoap.org/ws/20
> 04/08/addressing"><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/
> role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From 
> xmlns:wsa="http://schemas.xm
> lsoap.org/ws/2004/08/addressing"><wsa:Address>http://127.0.0.1:8080/axis2/servic
> es/MyService</wsa:Address></wsa:From><wsa:MessageID 
> xmlns:wsa="http://schemas.xm
> lsoap.org/ws/2004/08/addressing">D3C49495E884E3019B11423376489274</wsa:MessageID
>  ><wsa:RelatesTo 
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" wsa
> :RelationshipType="wsa:Reply">6439FE16DCA2252A8E11423376486611</wsa:RelatesTo></
> soapenv:Header><soapenv:Body><example1:echo 
> xmlns:example1="http://example1.org/
> example1"><example1:Text>Axis2 Echo String 
> </example1:Text></example1:echo></soa
> penv:Body></soapenv:Envelope>
> 
> Server Log
> ----------
> - De ploying module : addressing
> - Deploying module : security
> - Starting to process SOAP 1.1 message
> 
> 
> 
> 
> 
> */robert lazarski <ro...@gmail.com>/* wrote:
> 
>     Could you start another thread with an axis2 prefix mentioning jboss
>     ? I know jboss with web services ok, but it was with either axis 1
>     or jwsdp - not axis2 . Are you using wsdl and ejb ?
> 
>     Robert
>     http://www.braziloutsource.com/
> 
>     On 3/13/06, *Brian Shields* < brian.shields@geminga.it.nuigalway.ie
>     <ma...@geminga.it.nuigalway.ie>> wrote:
> 
>         Tony,
>         Apologies for jumping into this thread on an unr elated issue but i
>         notice you have axis2 deployed on JBoss 4.0. I am about to undertake
>         this task and was wondering if there was any resources on the web to
>         help in it. I dont have a lot of experience with JBoss so not
>         looking
>         forward to it!!
>         Regards,
>         Brian
> 
>         Antony Wilson wrote:
> 
>          >
>          > I have not been able to get the EchonNonBlockingDualClient
>         example to
>          > work as described in the documentation.  In my setup, I have
>         Axis2
>          > deployed to JBoss 4.0.3 and I have modified the
>          > userguide.example1.MyService to delay for about 10 seconds before
>          > responding (leaving the 'echo' method).  After packaging and
>         deploying
>          > the MyService.aar to Axis2, I run EchoNonBlockingDualClient
>          > example...slightly modified to add a print statement within
>         the while
>          > loop...like so
>          >
>          >    public static void main(String[] args) {
>          >        try {
>          >            OMElement payload = ClientUtil.getEchoOMElement();
>          >
>          >            Options options = new Options();
>          >            options.setTo(targetEPR);
>          >            options.setTransportInProtocol
>         (Constants.TRANSPORT_HTTP);
>          >            options.setUseSeparateListener(true);
>          >
>          >            //Callback to handle the response
>          >            Callback callback = new Callback() {
>          >                public void onComplete(AsyncResult result) {
>          >                    try {
>          >                        StringWriter writer = new StringWriter();
>          >
>          >
>         result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
>          >                                .createXMLStreamWriter(writer));
>          >                        writer.flush ();
>          >                        System.out.println(writer.toString());
>          >
>          >
>          >                    } catch (XMLStreamException e) {
>          >                        onError(e);
>          >                    }
>          >                }
>          >
>          >                public void onError(Exception e) {
>          >                    e.printStackTrace();
>          >                }
>          >            };
>          >
>          >            //Non-Blocking Invocation
>          >            ServiceClient sender = new ServiceClient();
>          >            sender.setOptions(options);
>          >            sender.sendReceiveNonblocking(payload, callback);
>          >
>          >            //Wait till the callback receives the response.
>          >            while (!callback.isComplete()) {
>          >                System.out.println("waiting...");
>          >                Thread.sleep(1000);
>          >            }
>          >            //Need to close the Client Side Listener.
>          >
>          > We I run it the code appears to block/wait at the
>          > "sender.sendRecieveNonBlocking(...)" line for about 10
>         seconds. When
>          > the program continues,  I never see any print statements
>         since the
>          > "callback.isComplete()" is true by the time it gets to that
>         point in
>          > the code.  The really bizarre part is that if I use
>          > "options.setUseSeparateListener(false)"...the behavior is
>         exactly what
>          > I was originally expecting...I see several "waiting..." print
>          > statements before the callback's onComplete is invoked.  My
>          > operational scenario requires a dual channel transport since my
>          > webservice calls can be really long...therefore using a
>         single two-way
>          > transport (e.g., options.setUseSeparateListener(false)) is not a
>          > viable option.
>          >
>          > Bottomline, I can't seem to get the two-way dual channel stuff
>          > (EchoNonBlockingDualClient) to work for me.  I must be missing
>          > something obvious...but I don't see what it is.  Any help
>         would be
>          > appreciated.
>          >
>          > Thanks,
>          > Tony
>          >
>          >
> 
>         --
>         Brian Shields BSc. MSc.,
>         PhD Candidate,
>         Department of Information Technology,
>         National University of Ireland,
>         Galway,
>         Ireland.
> 
> 
> 
> < p>
> ------------------------------------------------------------------------
> Yahoo! Mail
> Use Photomail 
> <http://us.rd.yahoo.com/mail_us/taglines/pmall2/*http://photomail.mail.yahoo.com> 
> to share photos without annoying attachments.
> 
> ------------------------------------------------------------------------
> Yahoo! Mail
> Bring photos to life! New PhotoMail 
> <http://pa.yahoo.com/*http://us.rd.yahoo.com/evt=39174/*http://photomail.mail.yahoo.com> 
> makes sharing a breeze.

Re: [Axis2] EchoNonBlockingDualClient problem

Posted by Ali Sadik Kumlali <as...@yahoo.com>.
Hi,

I have the same problem with Tomcat 5.5 and have two questions:

1) Why does my client HTTP server is immediately closed and i get  I/O exception when server tries to post the response? 

2) Why does it print "waiting" when options.setUseSeparateListener() is passed false? (This is Antony Wilson's question actually) 

Thanks a lot.

Ali Sadik Kumlali

------------------------------------------------------------------------
FIRST CASE
    + Original EchoNonBlockingDualClient.java
    + System.out.println("waiting..."); in while loop
------------------------------------------------------------------------
Client Log
-----------
testEchoNonBlockingDualClient:
     [java] - Deploying module : addressing
     [java] - Starting to process SOAP 1.1 message
     [java] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapen
v="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.
org/ws/2004/08/addressing"><soapenv:Header><wsa:To xmlns:wsa="http://schemas.xml
soap.org/ws/2004/08/addressing">http://10.10.10.103:6060/axis2/services/__ANONYM
OUS_SERVICE__/__OPERATION_OUT_IN__</wsa:To><wsa:ReplyTo xmlns:wsa="http://schema
s.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>http://schemas.xmlsoap.org/ws/
2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From xmlns:wsa
="http://schemas.xmlsoap.org/ws/2004/08/addressing"><wsa:Address>http://127.0.0.
1:8080/axis2/services/MyService</wsa:Address></wsa:From><wsa:MessageID xmlns:wsa
="http://schemas.xmlsoap.org/ws/2004/08/addressing">D3C49495E884E3019B1142337591
1122</wsa:MessageID><wsa:RelatesTo xmlns:wsa="http://schemas.xmlsoap.org/ws/2004
/08/addressing" wsa:RelationshipType="wsa:Reply">975BF946D7CFA918C61142337583721
1</wsa:RelatesTo></soapenv:Header><soapenv:Body><example1:echo xmlns:example1="h
ttp://example1.org/example1"><example1:Text>Axis2 Echo String </example1:Text></
example1:echo></soapenv:Body></soapenv:Envelope>
     [java] [SimpleHTTPServer] Stop called

Server Log
----------
- Deploying module : addressing
- Deploying module : security
- Starting to process SOAP 1.1 message
- I/O exception (org.apache.commons.httpclient.NoHttpResponseException) caught 
  when processing request: The server 10.10.10.103 failed to respond
- Retrying request



------------------------------------------------------------------------
SECOND CASE:
     + Original EchoNonBlockingDualClient.java
     + System.out.println("waiting..."); in while loop
     + options.setUseSeparateListener(false);
 ------------------------------------------------------------------------
Client Log
-----------
testEchoNonBlockingDualClient:
     [java] - Deploying module : addressing
     [java] waiting...
     [java] - Starting to process SOAP 1.1 message
     [java] <?xml version='1.0' encoding='utf-8'?><soapenv:Envelope xmlns:soapen
v="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://schemas.xmlsoap.
org/ws/2004/08/addressing"><soapenv:Header><wsa:To xmlns:wsa="http://schemas.xml
soap.org/ws/2004/08/addressing">http://schemas.xmlsoap.org/ws/2004/08/addressing
/role/anonymous</wsa:To><wsa:ReplyTo xmlns:wsa="http://schemas.xmlsoap.org/ws/20
04/08/addressing"><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/
role/anonymous</wsa:Address></wsa:ReplyTo><wsa:From xmlns:wsa="http://schemas.xm
lsoap.org/ws/2004/08/addressing"><wsa:Address>http://127.0.0.1:8080/axis2/servic
es/MyService</wsa:Address></wsa:From><wsa:MessageID xmlns:wsa="http://schemas.xm
lsoap.org/ws/2004/08/addressing">D3C49495E884E3019B11423376489274</wsa:MessageID
><wsa:RelatesTo xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" wsa
:RelationshipType="wsa:Reply">6439FE16DCA2252A8E11423376486611</wsa:RelatesTo></
soapenv:Header><soapenv:Body><example1:echo xmlns:example1="http://example1.org/
example1"><example1:Text>Axis2 Echo String </example1:Text></example1:echo></soa
penv:Body></soapenv:Envelope>

Server Log
----------
- Deploying module : addressing
- Deploying module : security
- Starting to process SOAP 1.1 message





robert lazarski <ro...@gmail.com> wrote: Could you start another thread with an axis2 prefix mentioning jboss ? I know jboss with web services ok, but it was with either axis 1 or jwsdp - not axis2 . Are you using wsdl and ejb ? 
 
 Robert
 http://www.braziloutsource.com/

On 3/13/06, Brian Shields < brian.shields@geminga.it.nuigalway.ie> wrote:Tony,
Apologies for jumping into this thread on an unrelated issue but i 
notice you have axis2 deployed on JBoss 4.0. I am about to undertake
this task and was wondering if there was any resources on the web to
help in it. I dont have a lot of experience with JBoss so not looking
 forward to it!!
Regards,
Brian

Antony Wilson wrote:

>
> I have not been able to get the EchonNonBlockingDualClient example to
> work as described in the documentation.  In my setup, I have Axis2 
> deployed to JBoss 4.0.3 and I have modified the
> userguide.example1.MyService to delay for about 10 seconds before
> responding (leaving the 'echo' method).  After packaging and deploying
> the  MyService.aar to Axis2, I run EchoNonBlockingDualClient
> example...slightly modified to add a print statement within the while
> loop...like so
>
>    public static void main(String[] args) {
>        try { 
>            OMElement payload = ClientUtil.getEchoOMElement();
>
>            Options options = new Options();
>            options.setTo(targetEPR);
>            options.setTransportInProtocol (Constants.TRANSPORT_HTTP);
>            options.setUseSeparateListener(true);
>
>            //Callback to handle the response
>            Callback callback = new Callback() {
>                public void onComplete(AsyncResult result) {
>                    try {
>                        StringWriter writer = new StringWriter();
>
> result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
>                                .createXMLStreamWriter(writer));
>                        writer.flush ();
>                        System.out.println(writer.toString());
>
>
>                    } catch (XMLStreamException e) {
>                        onError(e);
>                    }
>                }
>
>                public void onError(Exception e) {
>                    e.printStackTrace();
>                }
>            };
>
>            //Non-Blocking Invocation
>            ServiceClient sender = new ServiceClient(); 
>            sender.setOptions(options);
>            sender.sendReceiveNonblocking(payload, callback);
>
>            //Wait till the callback receives the response.
>            while (!callback.isComplete()) { 
>                System.out.println("waiting...");
>                Thread.sleep(1000);
>            }
>            //Need to close the Client Side Listener.
>
> We I run it the code appears to block/wait at the 
> "sender.sendRecieveNonBlocking(...)" line for about 10 seconds. When
> the program continues,  I never see any print statements since the
> "callback.isComplete()" is true by the time it gets to that point in 
> the code.  The really bizarre part is that if I use
> "options.setUseSeparateListener(false)"...the behavior is exactly what
> I was originally expecting...I see several "waiting..." print 
> statements before the callback's onComplete is invoked.  My
> operational scenario requires a dual channel transport since my
> webservice calls can be really long...therefore using a single two-way
 > transport (e.g., options.setUseSeparateListener(false)) is not a
> viable option.
>
> Bottomline, I can't seem to get the two-way dual channel stuff
> (EchoNonBlockingDualClient) to work for me.  I must be missing 
> something obvious...but I don't see what it is.  Any help would be
> appreciated.
>
> Thanks,
> Tony
>
>

--
Brian Shields BSc. MSc.,
PhD Candidate,
Department of Information Technology, 
National University of Ireland,
Galway,
Ireland.


 

			
---------------------------------
 Yahoo! Mail
 Use Photomail to share photos without annoying attachments.
		
---------------------------------
Yahoo! Mail
Bring photos to life! New PhotoMail  makes sharing a breeze. 

Re: [Axis2] EchoNonBlockingDualClient problem

Posted by robert lazarski <ro...@gmail.com>.
Could you start another thread with an axis2 prefix mentioning jboss ? I
know jboss with web services ok, but it was with either axis 1 or jwsdp -
not axis2 . Are you using wsdl and ejb ?

Robert
http://www.braziloutsource.com/

On 3/13/06, Brian Shields <br...@geminga.it.nuigalway.ie> wrote:
>
> Tony,
> Apologies for jumping into this thread on an unrelated issue but i
> notice you have axis2 deployed on JBoss 4.0. I am about to undertake
> this task and was wondering if there was any resources on the web to
> help in it. I dont have a lot of experience with JBoss so not looking
> forward to it!!
> Regards,
> Brian
>
> Antony Wilson wrote:
>
> >
> > I have not been able to get the EchonNonBlockingDualClient example to
> > work as described in the documentation.  In my setup, I have Axis2
> > deployed to JBoss 4.0.3 and I have modified the
> > userguide.example1.MyService to delay for about 10 seconds before
> > responding (leaving the 'echo' method).  After packaging and deploying
> > the MyService.aar to Axis2, I run EchoNonBlockingDualClient
> > example...slightly modified to add a print statement within the while
> > loop...like so
> >
> >    public static void main(String[] args) {
> >        try {
> >            OMElement payload = ClientUtil.getEchoOMElement();
> >
> >            Options options = new Options();
> >            options.setTo(targetEPR);
> >            options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> >            options.setUseSeparateListener(true);
> >
> >            //Callback to handle the response
> >            Callback callback = new Callback() {
> >                public void onComplete(AsyncResult result) {
> >                    try {
> >                        StringWriter writer = new StringWriter();
> >
> > result.getResponseEnvelope().serialize(XMLOutputFactory.newInstance()
> >                                .createXMLStreamWriter(writer));
> >                        writer.flush();
> >                        System.out.println(writer.toString());
> >
> >
> >                    } catch (XMLStreamException e) {
> >                        onError(e);
> >                    }
> >                }
> >
> >                public void onError(Exception e) {
> >                    e.printStackTrace();
> >                }
> >            };
> >
> >            //Non-Blocking Invocation
> >            ServiceClient sender = new ServiceClient();
> >            sender.setOptions(options);
> >            sender.sendReceiveNonblocking(payload, callback);
> >
> >            //Wait till the callback receives the response.
> >            while (!callback.isComplete()) {
> >                System.out.println("waiting...");
> >                Thread.sleep(1000);
> >            }
> >            //Need to close the Client Side Listener.
> >
> > We I run it the code appears to block/wait at the
> > "sender.sendRecieveNonBlocking(...)" line for about 10 seconds. When
> > the program continues,  I never see any print statements since the
> > "callback.isComplete()" is true by the time it gets to that point in
> > the code.  The really bizarre part is that if I use
> > "options.setUseSeparateListener(false)"...the behavior is exactly what
> > I was originally expecting...I see several "waiting..." print
> > statements before the callback's onComplete is invoked.  My
> > operational scenario requires a dual channel transport since my
> > webservice calls can be really long...therefore using a single two-way
> > transport (e.g., options.setUseSeparateListener(false)) is not a
> > viable option.
> >
> > Bottomline, I can't seem to get the two-way dual channel stuff
> > (EchoNonBlockingDualClient) to work for me.  I must be missing
> > something obvious...but I don't see what it is.  Any help would be
> > appreciated.
> >
> > Thanks,
> > Tony
> >
> >
>
> --
> Brian Shields BSc. MSc.,
> PhD Candidate,
> Department of Information Technology,
> National University of Ireland,
> Galway,
> Ireland.
>