Hello All,
I am facing some problems while deploying my service in Axis (in
weblogic8.1).
My implementation is some thing like I should deploy a webservice(message -
JAXM) which should consume attachements.
I have some doubts. Does Axis support JAXM .. ?
I couldn't find javax.xml.messaging.JAXMServlet &
javax.xml.messaging.ReqRespListener in axis jars.
As this both classes are not there I am using weblogic jars for that.
So when I try to invoke the service ( I could see my service is deployed tho
axis admin page & I could able to see wsdl of that also )its giving some
exception like
- InvocationTargetException:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
Method)
at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstruct
orAccessorImpl.java:39)
at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingC
onstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
at org.apache.axis.Message.setup(Message.java:317)
at org.apache.axis.Message.<init>(Message.java:235)
at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:81
0)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1053)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:387)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:305)
at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationActio
n.run(WebAppServletContext.java:6310)
at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:317)
at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
118)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppSe
rvletContext.java:3622)
at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm
pl.java:2569)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
Caused by: Error reading data stream: Root part containing SOAP envelope
not fo
und. contentId = null
at
org.apache.axis.attachments.MultiPartRelatedInputStream.<init>(MultiP
artRelatedInputStream.java:371)
at
org.apache.axis.attachments.AttachmentsImpl.<init>(AttachmentsImpl.ja
va:145)
... 20 more
<Nov 13, 2003 9:48:56 AM GMT+05:30> <Error> <HTTP> <BEA-101020>
<[ServletContext
(id=5267983,name=axis,context-path=/axis)] Servlet failed with Exception
java.lang.RuntimeException
at org.apache.axis.Message.setup(Message.java:326)
at org.apache.axis.Message.<init>(Message.java:235)
at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:81
0)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBas
e.java:339)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run
(ServletStubImpl.java:1053)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
pl.java:387)
at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
my class is
import java.io.*;
import java.util.Iterator;
import java.util.HashMap;
import java.net.URL;
import javax.activation.DataHandler;
import javax.xml.soap.*;
import javax.xml.messaging.*;
import javax.xml.transform.*;
import javax.xml.transform.stream.*;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.NodeList;
import javax.xml.soap.MessageFactory;
// Added for JAX-RPC
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.Service;
import javax.xml.rpc.Call;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.JAXRPCException;
import javax.xml.namespace.QName;
public class ReverseProxyDEM extends javax.xml.messaging.JAXMServlet
implements javax.xml.messaging.ReqRespListener
{
static javax.xml.soap.MessageFactory fac = null;
static {
try{
fac = javax.xml.soap.MessageFactory.newInstance();
}
catch(Exception ex){
ex.printStackTrace();
}
}
public void init(javax.servlet.ServletConfig servletConfig) throws
javax.servlet.ServletException {
super.init(servletConfig);
System.setProperty("javax.xml.soap.MessageFactory",
"com.sun.xml.messaging.saaj.soap.MessageFactoryImpl" );
}
public javax.xml.soap.SOAPMessage onMessage(javax.xml.soap.SOAPMessage
message)
{
System.out.println("Inside the onMessage method");
try{
String xURL =
"http://host:port/webdir/SimpleJAXMReceive";
// String xml = null;
//
URL endPoint = new URL(xURL);
SOAPConnectionFactory scf = SOAPConnectionFactory.newInstance();
SOAPConnection connection = scf.createConnection();
int count = message.countAttachments();
System.out.println("There are : "+count +" message parts);
Iterator itr = message.getAttachments();
AttachmentPart ap = null;
// Add the attachment part to the message.
while (itr.hasNext())
{
ap = (AttachmentPart)itr.next();
System.out.println(ap.getContentLocation());
String obj = (String)ap.getContent();
System.out.println("----------attachment obj ---"+obj);
System.out.println(ap.getContentType());
}
SOAPMessage reply = connection.call(message, endPoint);
// Print the reply message to the standard output
System.out.println("\n\nContent of the reply message: \n");
reply.writeTo(System.out);
return reply;
}
catch(Exception e){
System.out.println("Error in the SOAP message processing");
e.printStackTrace();
}
return null;
}
}
I don't know I might be going wrong some where.
Any pointers / code sample will be really appreciated :)
Advance thanks
Thanks
Nachi