ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chamikara Jayalath" <chamikar...@gmail.com>
Subject Re: [MTOM/XOP+WSRM] servlet error
Date Wed, 19 Jul 2006 23:43:17 GMT
Hi Elodie,

Please see my comments below.

On 7/19/06, Mancinelli Elodie <elodie.mancinelli@bull.net> wrote:
>
> Hi Chamikara,
>
> Your solution is correct.  Can you explain me what is this property and
> why it allows to pass the bug?



In WSRM the messages that belong to a sequence are numbered starting from
one. If this InvokeInOrder property is set to true, Sandesha2 will make sure
that the messages get invoked in the order of these message numbers. This is
a delivery assurance provided by Sadesha2 which is not a must to comply with
the WSRM specification. So you can safely set it to false if you do not
worry abt ardering. Infact disabling this will improve the performance.

In implementation wise, we achieve ordering using a seperate thread. If
InvokeInORder is set to true, messages will be paused at the RM handlers and
invocation will be done in the order of message numbers using our thread.
When a message get paused the current thread get returned and the incoming
sockets with the client get closed.

The bug is with axis2 not reading the attachments from the stream before
this closing of the socket.

Change this property, make other mistake:
> The problem is when I implement method addressable (i.e. I define the
> ReplyTo and AcksTo value for WSRM implementation). I have also the same
> problem in MTOMRM implementation.
> These values change with this code:
> String acksTo =
> serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
> options.setProperty(SandeshaClientConstants.AcksTo,acksTo);
> and
> options.setUseSeparateListener(true);
> In this case, for a RequestResponse method I see only the CreateSequence
> and the first message, others messages never sent. The client never
> receive the server response and the  server method is never called.
>
> For OneWay method, in TCPMon, there are all soap messages, but no server
> reactions. The  server method is never called.
>
> Have you an idea?



I guess this is the bug i fixed yested day. Please try the latest SNAPSHOT
from
http://people.apache.org/repository/sandesha2/mars/


Chamikara


Thanks for your help.
>
> Regards,
>
> Elodie
>
> Chamikara Jayalath wrote:
>
> > Hi Elodie,
> >
> > I just fixed a bug in Sandesha2 not-in-order case is working properly
> now.
> >
> > Currently MTOM+RM will not work when InOrderInvocation property is set
> > to true. This is due to a bug in OM  (
> > https://issues.apache.org/jira/browse/WSCOMMONS-52 ).
> >
> > But it perfectly works when InOrderInvocation is set to false. I just
> > added a test case to sandesha2 to demonstrate this (MTOMRMTest).
> > Currentlly the code in the test method is commented till the previous
> > bug is fixed. But it passes when InOrderInvation is disabled.
> >
> > Hope this will help you.
> >
> > Chamikara
> >
> >
> >
> > On 7/17/06, *Mancinelli Elodie* <elodie.mancinelli@bull.net
> > <mailto:elodie.mancinelli@bull.net>> wrote:
> >
> >     Hi,
> >
> >     Can you think the problem is due to the tomcat version? Or the
> >     sandesha2
> >     version? I download jars and war on
> >     http://people.apache.org/repository/sandesha2/
> >     <http://people.apache.org/repository/sandesha2/>.
> >
> >     To configure the server,I have only change the axis2.xml. I can't
> >     change
> >     the module.xml because I intente to create a common server for all
> >     independante client (WSRM only, MTOM only, MTOM-WSRM).
> >
> >     Sorry to insit.
> >     Regards
> >
> >     Elodie
> >
> >
> >     Mancinelli Elodie wrote:
> >
> >     > Hi Chamikara,
> >     >
> >     > I use tomcat in the server side and its version is the
> >     > apache-tomcat-5.5.15.
> >     > I join in attachment my client code.
> >     >
> >     > Thanks for your help.
> >     >
> >     > Regards
> >     >
> >     > Elodie
> >     >
> >     >
> >     >
> >     > Chamikara Jayalath wrote:
> >     >
> >     >> Hi Elodie,
> >     >>
> >     >> Are you using tomcat in the server side. If so which version?
> >     >> Can u send your client code as well.
> >     >>
> >     >> Chamikara
> >     >>
> >     >>
> >     >> On 7/13/06, *Mancinelli Elodie* <elodie.mancinelli@bull.net
> >     <mailto:elodie.mancinelli@bull.net>
> >     >> <mailto:elodie.mancinelli@bull.net
> >     <mailto:elodie.mancinelli@bull.net>>> wrote:
> >     >>
> >     >>     Hi all,
> >     >>
> >     >>     I want to realise an client-server which supports MTOM and
> >     WSRM. I
> >     >>     created separatly a client-server with MTOM and a
> client-server
> >     >>     with WSRM.
> >     >>
> >     >>     My server has two methods: OneWay and RequestResponse.
> >     >>
> >     >>     - When I launch my client to test the RequestResponse method:
> >     >>     In TCPMon, I see, the CreateSequence and the
> >     >>     CreateSequenceResponse. My
> >     >>     first message is sent and it is accpeted.
> >     >>     But my client never receives the response and there is no
> >     trace
> >     >> on my
> >     >>     server, the method seems not be executed.
> >     >>
> >     >>     - When I launch my client to test the OneWay method:
> >     >>     In TCPMon, I see:
> >     >>     - CreateSequence, CreateSequenceResponse
> >     >>     - Three messages have send and three acknowledgments
> >     >>     But no TerminateSequence.
> >     >>     And on the server, there is an error:
> >     >>     - "Servlet.service()" pour la servlet AxisServlet a généré
> une
> >     >>     exception
> >     >>     java.lang.IllegalStateException: Impossible de créer une
> >     >> sessionaprès
> >     >>     que la réponse ait été envoyée
> >     >>             at
> >     >>
> >     >>
> >     org.apache.catalina.connector.Request.doGetSession(Request.java
> :2214)
> >     >>             at
> >     >>
> >     org.apache.catalina.connector.Request.getSession(Request.java:2024)
> >     >>             at
> >     >>
> >     >>
> >     org.apache.catalina.connector.RequestFacade.getSession(
> RequestFacade.java:831)
> >     >>
> >     >>             at
> >     >>     ........
> >     >
> >
> >------------------------------------------------------------------------
> >
> >     >
> >     >package fr.gouv.finances.dgme.presto;
> >     >
> >     >import java.io.File;
> >     >import java.io.FileInputStream;
> >     >import javax.activation.DataHandler;
> >     >import javax.activation.FileDataSource;
> >     >import javax.xml.stream.XMLInputFactory;
> >     >import javax.xml.stream.XMLStreamReader;
> >     >import org.apache.axiom.om.OMAbstractFactory;
> >     >import org.apache.axiom.om.OMElement;
> >     >import org.apache.axiom.om.OMFactory ;
> >     >import org.apache.axiom.om.OMNamespace;
> >     >import org.apache.axiom.om.OMText;
> >     >import org.apache.axiom.om.impl.builder.StAXOMBuilder;
> >     >import org.apache.axiom.soap.SOAP12Constants;
> >     >import org.apache.axis2.Constants ;
> >     >import org.apache.axis2.addressing.EndpointReference;
> >     >import org.apache.axis2.client.Options;
> >     >import org.apache.axis2.client.ServiceClient;
> >     >import org.apache.axis2.client.async.AsyncResult;
> >     >import org.apache.axis2.client.async.Callback;
> >     >import org.apache.axis2.context.ConfigurationContext;
> >     >import org.apache.axis2.context.ConfigurationContextFactory;
> >     >import org.apache.axis2.context.MessageContextConstants ;
> >     >import org.apache.sandesha2.client.SandeshaClientConstants;
> >     >
> >     >
> >     >public class PrestoWSRM_MTOMtest extends junit.framework.TestCase{
> >     >
> >     >       static String fileXMLName="test_data_in.xml";
> >     >       static String fileNameAttach="fichier.txt";
> >     >       private static EndpointReference targetEPR = new
> >     EndpointReference("http://localhost:8080/axis2/services/PrestoSvc");
> >     >       private static String targetEPRTcpmon ="
> >     http://localhost:8070/axis2/services/PrestoSvc";
> >     >       static String namespace="http://dgme.finances.gouv.fr/presto
> ";
> >     >       private static String CLIENT_REPO_PATH = "RepoClient";
> >     >       private static String axis2_xml = CLIENT_REPO_PATH +
> >     File.separator +"conf" + File.separator + "axis2.xml";
> >     >
> >     >       /**
> >     >        * Call submitRequestReponse with attachment
> >     >        *
> >     >        */
> >     >       public  void testSubmitRequestResponseWSRMAddressable()
> >     throws Exception{
> >     >
> >     >               String nameMethod="submit";
> >     >               ConfigurationContext configContext =
> >     ConfigurationContextFactory.createConfigurationContextFromFileSystem
> (CLIENT_REPO_PATH,axis2_xml);
> >     >               ServiceClient serviceClient = new ServiceClient
> >     (configContext,null);
> >     >
> >     >               Options options=initOptions("submit",true);
> >     >               serviceClient.setOptions(options);
> >     >               String acksTo =
> >     serviceClient.getMyEPR(Constants.TRANSPORT_HTTP).getAddress();
> >     >
> >     options.setProperty(SandeshaClientConstants.AcksTo,acksTo);
> >     >
> >     >               System.out.println("Envoi");
> >     >               Callback callback1 = new TestCallback ("Callback
> 1");
> >     >               serviceClient.sendReceiveNonBlocking
> >     (getOMBlock("message1","sequence1",nameMethod),callback1);
> >     >
> >     >               while (!callback1.isComplete()) {
> >     >                       System.out.println("boucle1");
> >     >                       Thread.sleep(1000);
> >     >               }
> >     >
> >     >               Callback callback2 = new TestCallback ("Callback
> 2");
> >     >
> >     serviceClient.sendReceiveNonBlocking
> (getOMBlock("message2","sequence1",nameMethod),callback2);
> >     >
> >     >               while (!callback2.isComplete()) {
> >     >                       System.out.println("boucle2");
> >     >                       Thread.sleep(1000);
> >     >               }
> >     >
> >     >
> >     options.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
> >     >               Callback callback3 = new TestCallback ("Callback
> 3");
> >     >
> >     serviceClient.sendReceiveNonBlocking
> (getOMBlock("message3","sequence1",nameMethod),callback3);
> >     >
> >     >               while (!callback3.isComplete()) {
> >     >                       System.out.println("boucle3");
> >     >                       Thread.sleep(1000);
> >     >               }
> >     >               System.out.println("Fin du programme");
> >     >               Thread.sleep(10000);
> >     >               serviceClient.finalizeInvoke();
> >     >
> >     >       }
> >     >
> >     >
> >     >       /**
> >     >        * Call submitOneWay with attachment
> >     >        *
> >     >        */
> >     >       public  void testSubmitOneWayWSRMEmetteurAnonyme() throws
> >     Exception {
> >     >
> >     >               String nameMethod="submitOneWay";
> >     >               ConfigurationContext configContext =
> >     ConfigurationContextFactory.createConfigurationContextFromFileSystem
> (CLIENT_REPO_PATH,axis2_xml);
> >     >               ServiceClient sender = new ServiceClient
> >     (configContext,null);
> >     >
> >     >               Options options=initOptions("submitOneWay", false);
> >     >               sender.setOptions(options);
> >     >
> >     >               System.out.println("Envoi");
> >     >
> >     >
> >     sender.fireAndForget(getOMBlock("","ping1",nameMethod));
> >     >
> >     sender.fireAndForget(getOMBlock("","ping2",nameMethod));
> >     >
> >     >
> >     options.setProperty(SandeshaClientConstants.LAST_MESSAGE, "true");
> >     >
> >     sender.fireAndForget(getOMBlock("","ping3",nameMethod));
> >     >
> >     >               Thread.sleep(10000);
> >     >               System.out.println("\nResult :");
> >     >               System.out.println("NO RETURN FOR WEBSERVICE");
> >     >               sender.finalizeInvoke();
> >     >
> >     >       }
> >     >
> >     >       private OMElement getOMBlock(String text, String
> >     sequenceKey, String nameMethod) throws Exception{
> >     >
> >     >               OMFactory fac = OMAbstractFactory.getOMFactory();
> >     >               OMNamespace omNs =
> >     fac.createOMNamespace(namespace, "m");
> >     >               OMElement payload = getPayload(nameMethod);
> >     >
> >     >               // Attach text file
> >     >                       OMElement
> filetxt=createAttachment(fac,omNs);
> >     >                       payload.addChild(filetxt);
> >     >
> >     >               // Add sequence number
> >     >//             OMElement sequenceElem =
> >     fac.createOMElement("Sequence",omNs);
> >     >//             if (nameMethod.equalsIgnoreCase("submit"))
> >     sequenceElem.setText(sequenceKey + "-" + text);
> >     >//             else sequenceElem.setText(sequenceKey);
> >     >//             payload.addChild(sequenceElem);
> >     >
> >     >               System.out.println("Document sent : "+payload);
> >     >
> >     >               return payload;
> >     >
> >     >       }
> >     >
> >     >
> >     >       static class TestCallback extends Callback {
> >     >
> >     >               String name = null;
> >     >               public TestCallback (String name) {
> >     >                       this.name <http://this.name> = name;
> >     >               }
> >     >
> >     >               public void onComplete(AsyncResult result) {
> >     >//                     Traitement du résultat et affichage
> >     >                       System.out.println("\nResult :");
> >     >                       System.out.println("Callback '" + name
> >     +  "' got result:" + result.getResponseEnvelope());
> >     >               }
> >     >
> >     >               public void onError (Exception e) {
> >     >                       System.out.println("Error reported for
> >     test call back");
> >     >                       e.printStackTrace();
> >     >               }
> >     >       }
> >     >
> >     >       /**
> >     >        * Define options
> >     >        *
> >     >        */
> >     >       private static Options initOptions(String
> >     nameMethod,boolean SeparateListener){
> >     >
> >     >               Options options = new Options ();
> >     >               options.setTo(targetEPR);
> >     >               options.setAction(nameMethod);
> >     >
> >     options.setSoapVersionURI(
> SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);
> >     >
> >     options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
> >     >               options.setUseSeparateListener(SeparateListener);
> >     >
> >     options.setProperty(MessageContextConstants.TRANSPORT_URL
> ,targetEPRTcpmon);
> >     >
> >     options.setProperty(Constants.Configuration.ENABLE_MTOM,
> >     Constants.VALUE_TRUE);
> >     >
> >     >               return options;
> >     >       }
> >     >
> >     >       /**
> >     >        * Get file
> >     >        *
> >     >        */
> >     >       private OMElement getPayload(String operation) throws
> >     Exception {
> >     >               OMFactory fac = OMAbstractFactory.getOMFactory();
> >     >               // Declaration du namespace
> >     >               OMNamespace omNs =
> >     fac.createOMNamespace("http://dgme.finances.gouv.fr/presto", "m");
> >     >               // Creation du sommet de l'arborescence
> >     >               OMElement payload = fac.createOMElement(operation,
> >     omNs);
> >     >
> >     >               // Lecture du fichier a recuperer
> >     >               XMLStreamReader parser =
> >     XMLInputFactory.newInstance().createXMLStreamReader(new
> >     FileInputStream("test_data_in.xml"));
> >     >               // Construction de l'element
> >     >               StAXOMBuilder builder = new StAXOMBuilder(fac,
> >     parser);
> >     >               // Intergration dans l arborescence
> >     >               payload.addChild(builder.getDocumentElement());
> >     >
> >     >               return payload;
> >     >       }
> >     >
> >     >       /**
> >     >        * Method which create attachment
> >     >        *
> >     >        */
> >     >       private static OMElement createAttachment(OMFactory fac,
> >     OMNamespace omNs) throws Exception{
> >     >
> >     >               OMElement attach = null;
> >     >
> >     >               // Creation du noeud
> >     >               attach = fac.createOMElement("attachment", omNs);
> >     >               // Lecteure de ce fichier
> >     >               File fileTxt = new File(fileNameAttach);
> >     >               FileDataSource dataSource = new
> >     FileDataSource(fileTxt);
> >     >               // Transformation en données binaires
> >     >               DataHandler expectedDH = new
> DataHandler(dataSource);
> >     >               OMText textData = fac.createOMText(expectedDH,
> true);
> >     >               // Ajout au message soap
> >     >               attach.addChild(textData);
> >     >
> >     >               return attach;
> >     >       }
> >     >
> >     >}
> >     >
> >     >
> >     >
> >
> >------------------------------------------------------------------------
> >     >
> >
> >---------------------------------------------------------------------
> >     >To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> >     <mailto:axis-user-unsubscribe@ws.apache.org>
> >     >For additional commands, e-mail: axis-user-help@ws.apache.org
> >     <mailto:axis-user-help@ws.apache.org>
> >     >
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
> >     <mailto:sandesha-dev-unsubscribe@ws.apache.org>
> >     For additional commands, e-mail: sandesha-dev-help@ws.apache.org
> >     <mailto:sandesha-dev-help@ws.apache.org>
> >
> >
>
>

Mime
View raw message