From: Aimee U. <aim...@ce...> - 2002-10-30 20:02:06
|
Hello all. Here's the story: 1) client sends XML doc to our servlet 2) server sends 200 response 3) servlet validates doc and sends an acknowledgement to the client URL specified in the XML So, I need Anteater to post the request to our servlet, verify the 200 OK, and then listen for the acknowledgement. I've been at this all day and have tried various things. There's no problem with getting the servers started or sending the xml doc to our servlet, but I'm having problems getting the listener set up correctly. Here's the anteater code (yes, I hear you all shuddering): <?xml version="1.0"?> <project name="Anteater-test" default="main" basedir="."> <description> Demonstrates how to do an HTTP post </description> <taskdef resource="META-INF/Anteater.tasks"/> <typedef resource="META-INF/Anteater.types"/> <target name="init"> <servletContainer port="8500"/> </target> <target name="startJRun"> <exec executable="jrun.exe"> <arg line="-start default"/> </exec> </target> <target name="stopJRun"> <exec executable="jrun.exe"> <arg line="-stop default"/> </exec> </target> <target name="testInvalidCreditApp"> <parallel> <antcall target="startJRun"/> <sequential> <sleep seconds="30"/> <antcall target="init"/> <sleep seconds="10"/> <parallel> <antcall target="http"/> <antcall target="startErrorAckListener"/> </parallel> </sequential> </parallel> </target> <target name="http" description="Demonstrates httpRequest"> <property name="url" value="http://localhost:8100/csb/CSBServlet"/> <echo>An HTTP request will now be sent off to ${url} to post an invalid XML doc.</echo> <httpRequest href="${url}" method="POST" useTidy="true" debug="10" description="Post a simple string request"> <parameter name="xmldoc" value="invalidCSBCreditApp.xml" type="POST"/> <match> <responseCode value="200" assign="rc"/> </match> </httpRequest> <echo>Got ${cl} bytes back from server; HTTP response code ${rc}</echo> </target> <target name="startErrorAckListener"> <echo>startErrorAckListener</echo> <listener port="8500" path="/client" timeout="360"> <match> <method value="POST"/> <xpath select="csbAcknowledgement/SubmittalKey/EcommerceSubmittalID" value="EWF1"/> <xpath select="csbAcknowledgement/SubmittalStatus" value="Error"/> <xpath select="csbAcknowledgement/SubmittalErrors"/> </match> </listener> </target> </project> The errors I get when I run it are: Reading response [exec] 10/30 13:56:39 user CSBServlet: init [listener] Cannot run HTTP request: java.lang.Exception: Null incoming request. Usually this means you have defined two listeners for the same request path. [listener] java.lang.Exception: Null incoming request. Usually this means you h ave defined two listeners for the same request path. [listener] at org.apache.anteater.test.Listener.createMatchObject(Listener. java:215) [listener] at org.apache.anteater.test.ActionTask.execute(ActionTask.java:2 46) [listener] at org.apache.anteater.test.Listener.execute(Listener.java:223) [listener] at org.apache.tools.ant.Task.perform(Task.java:319) [listener] at org.apache.tools.ant.Target.execute(Target.java:309) [listener] at org.apache.tools.ant.Target.performTasks(Target.java:336) [listener] at org.apache.tools.ant.Project.executeTarget(Project.java:1306) [listener] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:371) [listener] at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.j ava:143) [listener] at org.apache.tools.ant.Task.perform(Task.java:319) [listener] at org.apache.tools.ant.taskdefs.Parallel$TaskThread.run(Paralle l.java:177) [exec] CSBApp.static block [exec] file = jrunx.resource.ResourceByteArrayInputStream@bb6086 [exec] Error log name: CreditScoreBroker%g.log [listener] ?[1;31m Error: Cannot run HTTP request [listener] java.lang.Exception: Null incoming request. Usually this means you h ave defined two listeners for the same request path. [listener] at org.apache.anteater.test.Listener.createMatchObject(Listener. java:215) [listener] at org.apache.anteater.test.ActionTask.execute(ActionTask.java:2 46) [listener] at org.apache.anteater.test.Listener.execute(Listener.java:223) [listener] at org.apache.tools.ant.Task.perform(Task.java:319) [listener] at org.apache.tools.ant.Target.execute(Target.java:309) [listener] at org.apache.tools.ant.Target.performTasks(Target.java:336) [listener] at org.apache.tools.ant.Project.executeTarget(Project.java:1306) [listener] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:371) [listener] at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.j ava:143) [listener] at org.apache.tools.ant.Task.perform(Task.java:319) [listener] at org.apache.tools.ant.taskdefs.Parallel$TaskThread.run(Paralle l.java:177) [listener] ?[m [listener] file:C:/pvcs/workspace/servicelayer/HFSCreditScoreBroker/build/http. xml:66: Finished Listener:8500/client (441ms). Can anyone help me set up a listener correctly? Thanks in advance! -- Aimee Ukasick Software Developer Centare Group, Ltd. Brookfield, WI USA |