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 Eduard Sirota <Ed...@noosh.com> on 2004/08/03 21:39:08 UTC
Generating WSDL from a Java class not using AxisServlet
Hi All,
I would like my servlet to generate a WSDL file for my WebService when I
get an http request with "?wsdl" at the end of the url.
1. I am using Axis 1.1.
2. I am not using the AxisServlet.
3. My WebServices are registered with an instance of AxisServer
object. Whenever my servlet gets a request, I process it with the
following code:
Message resMsg = null;
AxisServer soapEngine = SOAPEngine.getServerInstance();
//initializes the AxisServer
String response;
try
{
Message reqMsg = new Message(request);
MessageContext msgContext = new MessageContext(soapEngine);
msgContext.setRequestMessage(reqMsg);
soapEngine.invoke(msgContext);
resMsg = msgContext.getResponseMessage();
response = resMsg.getSOAPPartAsString();
}
4. My WebServices are just simple java classes that do not extend
any of the axis framework classes.
5. I figured that I should be able to generate a WSDL file by using
the following code, but nothing gets generated.
AxisServer soapEngine = SOAPEngine.getServerInstance();
MessageContext msgContext = new MessageContext(engine);
messageContext.setService(new WorkgroupService()); //just one of
my services
soapEngine.generateWSDL(messageContext);
Document doc = (Document) messageContext.getProperty("WSDL");
I realize that either my MessageContext object is not setup properly or
my WebService class doesn't extend/implement a proper axis framework
class. I even tried ripping off the MessageContext setup code from the
AxisServlet when it gets a request with "?wsdl". But I still can't get
it to work.
Thank you for you time,
Eddie