• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Why cannot my own Handler work?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have extends BasicHandler in my own web Service ,
here the Handler is MyLogHandler,and i have configured
this Handler in server-config.wsdd,
but when i invoke the web service,my client cannot
get the web service information,
though the Handler worked.
I want to know whether the handler cannot effect on
the web service others handler and response handler?
if so,why my client cannot get the response?

the hanlder code is followed( i have copied this from others)

Handler handler = parm1.getService();
String filename = (String)getOption("filename");
if ((filename == null) || (filename.equals("")))
throw new AxisFault("Server.NoLogFile",
"No log file configured for
the LogHandler!",
null, null);
FileOutputStream fos = new FileOutputStream(filename, true);
PrintWriter writer = new PrintWriter(fos);
Integer counter = (Integer)handler.getOption("accesses");
if (counter == null)
counter = new Integer(0);

counter = new Integer(counter.intValue() + 1);
Date date = new Date();
parm1.getMessage().writeTo(System.out);

String result = "在"+date + ": Web 服务 " +
parm1.getTargetService() +
" 被调用,现在已经共调用了 " + counter + " 次.";
handler.setOption("accesses", counter);
writer.println(result);
writer.close();

So Thanks!
 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can u post ur server-config.wsdd ?
-prashant
 
yefeng Gu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have tried the LogHandler is ok,but here something wrong:
i use my own RequestHandler to check the request soap message,if
isn't legal,i responsed with AxisFault,but i find my client can receive
the correct response; and i use repsonseHandler to check the response message,if something wrong,i change the returned soap message,here i also
use AxisFault :
fault= new AxisFault(new QName("env:Receiver"),new QName[]{new QName("303")},"不存在",null, null,null);
parm1.setCurrentMessage(new Message(fault));
but this cannot return axis fault message to client also.
 
yefeng Gu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
besides this,here also other question:
1) i cannot find subcode of axisFault,server i use axis1.3,client i use soapTest1.4.2
2) the characters "不存在" cannot be recogined


the follow is my server-config.wsdd:

..... <globalConfiguration>
.... <requestFlow>
<handler type="java rg.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="session"/>
</handler>
<handler type="java rg.apache.axis.handlers.JWSHandler">
<parameter name="scope" value="request"/>
<parameter name="extension" value=".jwr"/>
</handler>
<handler name="logging" type="java rg.egs.das.services.LMDtRequestHandler">
</handler>
</requestFlow>
<responseFlow>
<handler name="respHandler" type="java rg.egs.das.services.LMDtResponseHandler"/>
</responseFlow>
</globalConfiguration>
.......
<service name="DataAccess" provider="java:RPC">
<parameter name="allowedMethods" value="*"/>
..... <typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" qname="ns1:XFieldReference" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java rg.egs.das.datatype.XFieldReference" xmlns:ns1="http://www.org.egs.cn/services/DataAccess"/>
.... <requestFlow>
<handler type="java rg.egs.das.services.LMDtRequestHandler"/>
</requestFlow>
<responseFlow>
<handler type="java rg.egs.das.services.LMDtResponseHandler"/>
</responseFlow>
</service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
<handler type="java rg.apache.axis.handlers.http.HTTPAuthHandler"/>
</requestFlow>
</transport>
<transport name="local">
<responseFlow>
<handler type="LocalResponder"/>
</responseFlow>
</transport>
</deployment>
 
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

but this cannot return axis fault message to client also


Why not? What happens if you do?

the characters "不存在" cannot be recogined


What exactly does this mean? Are they properly escaped, or encapsulated in a CDATA section when they get sent over the wire? Because otherwise they are not valid XML.

i cannot find subcode of axisFault


subcode is not so new; even Axis 1.2 had that. Are you sure you are using the correct Axis libraries? Or are you saying that you can't find a list of possible subcodes? There is none - you can define and use whatever you like.
 
yefeng Gu
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. client received correct response like without use ResponseHandler,though
Response Handler takes effect for i find the log it makes in my pc.

2. the character i use is chinese , but the faultString isn't chinese but
other ascii character without meaning.
The response xml is <?xml version="1.0" encoding="UTF-8"?>
i made nothing except throw AxisFault,so i think the xml is valid.

3. I use is Axis1.3, so i don't know whether the subcode is escaped by
SOAPTest tool or by default,my server return.

I will do test on 2 and 3,but for the 1)question i haven't good methods to
try.

So thx for your recommendtions.
 
Ulf Dittmer
Rancher
Posts: 43081
77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To debug problems of this kind it is very helpful to view the actual SOAP/XML that's being sent over the wire. Axis ships with two tools, TCPMon and SOAPMonitor, that let you do this. Documentation for these is here and here.

By the way, since you seem to have submitted the earlier post twice, could you delete one of the copies? You can do this by clicking on the edit button (the one with the pencil and the sheet of paper), and then on the edit page checking the "Delete Post" checkbox.
[ January 06, 2006: Message edited by: Ulf Dittmer ]
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic