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 Airline Pedestal <ai...@yahoo.com> on 2005/04/21 08:03:07 UTC

Re: Custom Serializer is invoked twice for a single web service call


>From reading the development list, I see
that the debug logging needs to be turned off
to prevent the serializer from executing twice.
But, how do I turn it off?????  I ended up
putting this in my log4j.properties to stop it.

log4j.logger.org.apache.axis.client=info, stdout



Thanks,

A



--- Davanum Srinivas <da...@gmail.com> wrote:

> Open a JIRA issue and then you can upload the zip as
> attachment
> (http://issues.apache.org/jira).
> 
> -- dims
> 
> 
> On Thu, 11 Nov 2004 09:55:20 +0000, tom ONeill
> <be...@hotmail.com> wrote:
> > sorry the example is missing because I cannot seem
> to send a mail with an
> > attachment to the mailing list. The zip file is
> only 45kb but each time I
> > send it I get a delivery failure. I did not read
> anywhere that mails with
> > attachments cannot be sent to the mailing list!
> > 
> > >From: "tom ONeill"
> <be...@hotmail.com>
> > >Reply-To: axis-user@ws.apache.org
> > >To: axis-user@ws.apache.org
> > >Subject: Re: Custom Serializer is invoked twice
> for a single web service
> > >call
> > >Date: Thu, 11 Nov 2004 09:17:18 +0000
> > 
> > 
> > >
> > >Hi all,
> > >
> > >As requested by Davanum I created a simple
> example to test this scenario.
> > >It turns out that the simple example works
> correctly - the custom
> > >serializer is only invoked once. The second
> invocation is due to some
> > >special processing I am doing within my
> application. I had a a question on
> > >this list some weeks ago on how to deserialize
> XML into Java classes (as I
> > >receive an XML message which I have to use to
> create Java classes to invoke
> > >our partner web service) and I received some very
> useful code from Michael
> > >Binz which illustrated how to do this. I have
> updated Michaels code
> > >somewhat so that it suits our needs. Within this
> deserialization code an
> > >AxisClient object is created (it is used in the
> creation of a
> > >MessageContext object which is required to do the
> serialization) and this
> > >AxisClient object is still reachable when the web
> service is invoked.
> > >Somehow or other the pressence of the AxisClient
> object leads Axis to
> > >invoke the custom serializer twice. There is
> probably some valid reason for
> > >this but I dont currently understand enough of
> the Axis internals to
> > >explain it.
> > >
> > >I have attached a zip file which contains the
> code to execute a test of
> > >this scenario (if anyone wants to). As John
> requested, this example should
> > >be a help to you in showing how to create and
> register your own custom
> > >serializers and deserializers.
> > >
> > >To run the test first update the
> WSTEST_ServiceLocator source file so that
> > >you set your own IP address and then recompile
> this class into the classes
> > >directory. To execute a simple test which only
> results in a single
> > >invocation of the custom serializers edit (and
> recompile) the
> > >TestCustomSerializer source file so that the
> argument to the web service
> > >invocation is created explicitly in the code. To
> execute the test so that
> > >the Custom serializer is invoked twice update the
> TestCustomSerializer
> > >source so that it creates the argument to the web
> service by using our
> > >AxisMapping class to deserialize an XML string
> into the relevent Java
> > >classes.
> > >
> > >Start the test server by executing the
> runTestServer batch file. This must
> > >be executed in the base directory so that the
> server can load the
> > >server-config.wsdd file. This will start a
> SimpleAxisServer on port 8200.
> > >
> > >Then execute the TestCustomSerializer client
> (after updating your classpath
> > >to include the Axis jars and the classes
> directory).
> > >
> > >These tests were executed using Axis1_2beta
> > >
> > >Cheers,
> > >Tom
> > >
> > >p.s. sorry about the really bad naming
> conventions :)
> > >
> > >
> > >>From: Davanum Srinivas <da...@gmail.com>
> > >>Reply-To: dims@apache.org
> > >>To: axis-user@ws.apache.org
> > >>Subject: Re: Custom Serializer is invoked twice
> for a single web service
> > >>call
> > >>Date: Wed, 10 Nov 2004 07:19:32 -0500
> > >>
> > >>that is weird!! Can you please create a bug
> report with a small test?
> > >>are u using latest nightly?
> > >>
> > >>thanks,
> > >>dims
> > >>
> > >>
> > >>On Wed, 10 Nov 2004 12:14:20 +0000, tom ONeill
> > >><be...@hotmail.com> wrote:
> > >> > Hi all,
> > >> >
> > >> > I have written a custom serializer and
> deserializer for one of my
> > >>complex
> > >> > types and I have configured my client to use
> these custom serializers
> > >>using
> > >> > a client-config.wsdd file.
> > >> >
> > >> > I have added some debug output to the
> serialize method of my custom
> > >> > Serializer and I have noticed that this
> method seems to be invoked
> > >>twice for
> > >> > a single invocation of a web service method
> (I expect that the
> > >>serializtion
> > >> > of my datatype to XML needs only to be done
> once to invoke the web
> > >>service).
> > >> >
> > >> > I added a stack dump to the serialize method
> of my custom serializer
> > >>and the
> > >> > result is that I got the following two stack
> dumps upon a single web
> > >>service
> > >> > invocation
> > >> >
> > >> > java.lang.Exception: Stack trace
> > >> >         at
> java.lang.Thread.dumpStack(Thread.java:1071)
> > >> >         at
> com.mycompany.www.type.MyDataSer.serialize(Unknown
> Source)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.encoding.SerializationContextImpl.serializeActual(Serialization
> > >> > ContextImpl.java:1229)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContex
> > >> > tImpl.java:750)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.encoding.SerializationContextImpl.outputMultiRefs(Serialization
> > >> > ContextImpl.java:821)
> > >> >         at
> >
>
>>org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:144)
> > >> >         at
> > >> >
>
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:470)
> > >> >         at
> > >> >
>
org.apache.axis.message.MessageElement.output(MessageElement.java:1111)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:2661)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:2357)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:2280)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:1741)
> > >> >         at
> com.mycompany.www.MyStub.testService(Unknown Source)
> > >> >         at
>
com.mycompany.www.Test.run(AbstractMessageHandler.java
> > >> >         at
> java.lang.Thread.run(Thread.java:536)
> > >> >
> > >> > java.lang.Exception: Stack trace
> > >> >         at
> java.lang.Thread.dumpStack(Thread.java:1071)
> > >> >         at
> com.mycompany.www.type.MyDataSer.serialize(Unknown
> Source)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.encoding.SerializationContextImpl.serializeActual(Serialization
> > >> > ContextImpl.java:1229)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.encoding.SerializationContextImpl.serialize(SerializationContex
> > >> > tImpl.java:750)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.encoding.SerializationContextImpl.outputMultiRefs(Serialization
> > >> > ContextImpl.java:821)
> > >> >         at
> >
>
>>org.apache.axis.message.SOAPBody.outputImpl(SOAPBody.java:144)
> > >> >         at
> > >> >
>
org.apache.axis.message.SOAPEnvelope.outputImpl(SOAPEnvelope.java:470)
> > >> >         at
> > >> >
>
org.apache.axis.message.MessageElement.output(MessageElement.java:1111)
> > >> >         at
> org.apache.axis.SOAPPart.writeTo(SOAPPart.java:268)
> > >> >         at
>
org.apache.axis.SOAPPart.getAsString(SOAPPart.java:499)
> > >> >         at
>
org.apache.axis.SOAPPart.getAsBytes(SOAPPart.java:386)
> > >> >         at
>
org.apache.axis.Message.getContentType(Message.java:465)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.transport.http.HTTPSender.writeToSocket(HTTPSender.java:307)
> > >> >         at
> > >> >
>
org.apache.axis.transport.http.HTTPSender.invoke(HTTPSender.java:87)
> > >> >         at
> > >> >
> >
>
>>org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
> > >> >
> > >> >         at
>
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
> > >> >         at
>
org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
> > >> >         at
> >
>
>>org.apache.axis.client.AxisClient.invoke(AxisClient.java:144)
> > >> >         at
>
org.apache.axis.client.Call.invokeEngine(Call.java:2688)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:2671)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:2357)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:2280)
> > >> >         at
> org.apache.axis.client.Call.invoke(Call.java:1741)
> > >> >         at
> com.mycompany.www.MyStub.testService(Unknown Source)
> > >> >         at
>
com.mycompany.www.Test.run(AbstractMessageHandler.java
> > >> > :89)
> > >> >         at
> java.lang.Thread.run(Thread.java:536)
> > >> >
> > >> > Does anyone have any idea why this happens.
> Is there somthing in the
> > >> > internals of Axis that leads to this
> behavious. My web service
> > >>invocation is
> > >> > successful so its not causing any problems
> for me but I am just curious
> > >>as
> > >> > to why this might occur.
> > >> >
> > >> > Cheers,
> > >> > Tom
> > >> >
> > >> >
>
_________________________________________________________________
> > >> > On the road to retirement? Check out MSN Life
> Events for advice on how
> > >>to
> > >> > get there!
>
http://lifeevents.msn.com/category.aspx?cid=Retirement
> > >> >
> > >> >
> > >>
> > >>
> > >>--
> > >>Davanum Srinivas -
> http://webservices.apache.org/~dims/
> > >
> >
>
>_________________________________________________________________
> > >Express yourself instantly with MSN Messenger!
> Download today it's FREE!
> > >http://messenger.msn.com/
> > >
> > 
> >
>
_________________________________________________________________
> > Express yourself instantly with MSN Messenger!
> Download today it's FREE!
> > http://messenger.msn.com/
> > 
> > 
> 
> 
> -- 
> Davanum Srinivas -
> http://webservices.apache.org/~dims/
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com