|
From: Yerubandi R. <Yer...@su...> - 2004-03-19 23:39:42
|
i am trying to write a servlet that receives all messages ( irrespective =
of cpaid, conversationid, service , action ).
i am trying something like this-----------
public class Pong extends HttpServlet implements MessageListener {
String toMshUrl =3D "http://192.168.18.72:8080/msh"; < peer MSH =
address>
String localMsh =3D "http://localhost:8080/msh/"; < localMSH address>
Request req =3D null;
=09
public void init(ServletConfig config) throws ServletException {
super.init(config); =09
try
{
ApplicationContext ac =3D new ApplicationContext( "*", "*", "*","*"); =
< wild card'ing > =09
req =3D new Request(ac,new URL( ),this,"HTTP"); /* from the doc's , =
looks like i need to do something like this */ =09
}
catch ( Exception ex)
{
ex.printStackTrace();
} =20
}
so my question is in the request object , what do i need to pass in for =
URL . if someone can explain in a detailed manner , i would really =
appreciate it.
i tried passing in the URL of http://localhost:8080/msh <my local MSH =
url > , then the servlet just hangs. i tried debugging it using JBossIDE =
and i see that it hangs in expectMapResponse() method of Request class.
-Venkat
---------------------------------------------------
Complete Code
---------------------------------------------------
import hk.hku.cecid.phoenix.message.handler.ApplicationContext;
import hk.hku.cecid.phoenix.message.handler.MessageListener;
import hk.hku.cecid.phoenix.message.handler.Request;
import hk.hku.cecid.phoenix.message.handler.Utility;
import hk.hku.cecid.phoenix.message.packaging.EbxmlMessage;
import hk.hku.cecid.phoenix.message.packaging.MessageHeader;
import java.io.IOException;
import java.net.URL;
import java.util.Date;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Pong extends HttpServlet implements MessageListener {
String toMshUrl =3D "http://192.168.18.72:8080/msh";
String localMsh =3D "http://localhost:8080/msh/";=09
Request req =3D null;
=09
public void init(ServletConfig config) throws ServletException {
super.init(config); =09
try
{
ApplicationContext ac =3D new ApplicationContext( "*", "*", "*","*"); =
=09
req =3D new Request(ac,new URL(localMsh),this,"HTTP"); =09
}
catch ( Exception ex)
{
ex.printStackTrace();
} =20
}
=20
public void doGet(HttpServletRequest request,HttpServletResponse =
response)
throws ServletException, IOException {
doPost(request,response);
}
=20
public void doPost(HttpServletRequest request,HttpServletResponse =
response)
throws ServletException, IOException { =09
}
=20
public URL getClientUrl() {
return null;
}
public void onMessage(EbxmlMessage ebxmlMessage)=20
{ =20
System.out.println(" SSI Incoming Message Handler "); =20
if ( ebxmlMessage.getErrorList() =3D=3D null)
{ =09
stdOut(ebxmlMessage);
} =09
}
=20
void stdOut(EbxmlMessage ebxmlMessage )
{
try
{
ebxmlMessage.writeTo(System.out);=20
System.out.flush();
}
catch( Exception ex)
{
ex.printStackTrace();
}
}
}
|