Title: error in example ?

Hi dear devellopers !

I think, but I am not sure, that there is an error in the example coming with the distribution.

I have encapsulated the echostring client example in a JSP page, the error I get is that when running the example for the

first time I get as response "echo1echo2echo3", but on the second time I get "echo1echo2echo3echo1echo2echo3".

Is it an error or have I misunderstood the example ? Moreover I get the following warning message :

[29/05/06 15:06:12:948 CEST] 25d8f329 TraceNLS      u No message text associated with key WARNING:.Cannot.set.header..Response.already.committed. in bundle com.ibm.ejs.resources.seriousMessages

[29/05/06 15:06:12:948 CEST] 25d8f329 SRTServletRes W WARNING: Cannot set header. Response already committed.

here is the example encapsulated in a JSP page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<HTML>
<HEAD>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
        pageEncoding="ISO-8859-1"%>

<%@ page import="java.io.File"%>
<%@ page import="javax.xml.namespace.QName"%>
<%@ page import="org.apache.axiom.om.OMAbstractFactory"%>
<%@ page import="org.apache.axiom.om.OMElement"%>
<%@ page import="org.apache.axiom.om.OMFactory"%>
<%@ page import="org.apache.axiom.om.OMNamespace"%>
<%@ page import="org.apache.axiom.soap.SOAPBody"%>
<%@ page import="org.apache.axis2.Constants"%>
<%@ page import="org.apache.axis2.addressing.EndpointReference"%>
<%@ page import="org.apache.axis2.client.Options"%>
<%@ page import="org.apache.axis2.client.ServiceClient"%>
<%@ page import="org.apache.axis2.client.async.AsyncResult"%>
<%@ page import="org.apache.axis2.client.async.Callback"%>
<%@ page import="org.apache.axis2.context.ConfigurationContext"%>
<%@ page import="org.apache.axis2.context.ConfigurationContextFactory"%>

<%@ page import="org.apache.sandesha2.client.SandeshaClientConstants"%>
<%@ page import="org.apache.sandesha2.client.SandeshaClient"%>



<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<META name="GENERATOR" content="IBM Software Development Platform">
<META http-equiv="Content-Style-Type" content="text/css">
<LINK href="theme/Master.css" rel="stylesheet"
        type="text/css">
<TITLE>index.jsp</TITLE>
</HEAD>
<BODY>
<h1> Test Technique Web Services</h1>
<h2> AXIS 2.0 Web Service Reliable Messaging Client</h2>
<P>Placez le contenu ici.</P>


<%!
    private final static String applicationNamespaceName = "http://tempuri.org/";
    private final static String echoString = "echoString";
    private final static String Text = "Text";
    private final static String Sequence = "Sequence";
    private final static String echoStringResponse = "echoStringResponse";
    private final static String EchoStringReturn = "EchoStringReturn";
    private static String toEPR = "http://127.0.0.1:9080/axis2/services/RMSampleService";
    private static String CLIENT_REPO_PATH = "c:\\Winprog\\WorkspacesRSA\\WSRMClient";
 %>

<%!
private static OMElement getEchoOMBlock(String text, String sequenceKey) {
        OMFactory fac = OMAbstractFactory.getOMFactory();
        OMNamespace applicationNamespace = fac.createOMNamespace(applicationNamespaceName,"ns1");
        OMElement echoStringElement = fac.createOMElement(echoString, applicationNamespace);
        OMElement textElem = fac.createOMElement(Text,applicationNamespace);
        OMElement sequenceElem = fac.createOMElement(Sequence,applicationNamespace);

        textElem.setText(text);
        sequenceElem.setText(sequenceKey);
        echoStringElement.addChild(textElem);
        echoStringElement.addChild(sequenceElem);

        return echoStringElement;
    }

    static class TestCallback extends Callback {

        String name = null;
        public TestCallback (String name) {
            this.name = name;
        }

        public void onComplete(AsyncResult result) {
            SOAPBody body = result.getResponseEnvelope().getBody();

            OMElement echoStringResponseElem = body.getFirstChildWithName(new QName (applicationNamespaceName,echoStringResponse));

            OMElement echoStringReturnElem = echoStringResponseElem.getFirstChildWithName(new QName (applicationNamespaceName,EchoStringReturn));

            String resultStr = echoStringReturnElem.getText();
            System.out.println("Callback '" + name +  "' got result:" + resultStr);
        }

        public void onError (Exception e) {
            System.out.println("Error reported for test call back");
            e.printStackTrace();
        }
    }
%>

<% 
        String axis2_xml = CLIENT_REPO_PATH + File.separator +"client_axis2.xml";
        ServiceClient serviceClient = null;
try{
            System.out.println("-- Creation of context");       
        ConfigurationContext configContext = org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(CLIENT_REPO_PATH,axis2_xml);

                      
            System.out.println("-- Service client");       
            serviceClient = new ServiceClient (configContext,null);
        System.out.println("Options");

        Options clientOptions = new Options ();
        System.out.println("-- YOP");
        clientOptions.setTo(new EndpointReference(toEPR));
        clientOptions.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        clientOptions.setUseSeparateListener(true);
        serviceClient.setOptions(clientOptions);

//      serviceClient.engageModule(new QName ("sandesha2"));
//      serviceClient.engageModule(new QName ("addressing"));

         System.out.println("-- Set Callback");
        Callback callback1 = new TestCallback ("Callback 1");
        serviceClient.sendReceiveNonBlocking (getEchoOMBlock("echo1","sequence1"),callback1);
        Callback callback2 = new TestCallback ("Callback 2");
        serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo2","sequence1"),callback2);

        clientOptions.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
        Callback callback3 = new TestCallback ("Callback 3");
        serviceClient.sendReceiveNonBlocking(getEchoOMBlock("echo3","sequence1"),callback3);

         System.out.println("-- before last while");
        while (!callback3.isComplete()) {
            Thread.sleep(1000);
        }
                 System.out.println("-- before sleep");
       
        Thread.sleep(4000);
                 System.out.println("-- after sleep");
                
       
      
                
     }catch (Exception e){
                 System.out.println("ERROR !!!!");
        e.printStackTrace();
     }finally {
            try {
                //SandeshaClient.terminateSequence (serviceClient, "sequence1");                  
           
                serviceClient.finalizeInvoke();
                System.out.println("-- serviceClient.finalized call succeeded");
            } catch (Exception e) {
                System.out.println("ERROR in finalize");
                e.printStackTrace();
            }
        }
    

 %>

</BODY>
</HTML>


kinds regards,
Michel

= = = = = = = = = = = = = = = = = = = = = = = = =
Fortis Bank disclaimer :
http://www.fortisbank.be/legal/disclaimer.htm

Fortis Bank privacy policy :
http://www.fortisbank.be/legal/privacy_policy.htm
= = = = = = = = = = = = = = = = = = = = = = = = =


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to