Hi every one,

I apologise if this question is not related to this group.

I have been trying to access an Axis attachment service using weblogic
JAX-RPC soap client. While sending DataHandler as one of its parameter,
weblogic soap client considers this as an attachment and sends it outside
the SOAP body. While the destination soap service is also deployed in
weblogic soap, the execution goes very smooth. But when I host the
destination attachment soap service in Axis, it doesn't work.

Can you please throw some light on this?

Here is the XML request message
------------------------------------------------
POST /FNR_axis/services/EchoAttachmentService HTTP/1.1 Content-Type:
multipart/related;boundary="----=_Part_0_32663045.1077001326421";start=null
SOAPAction: "" User-Agent: Java/1.4.1_03 Host: localhost Accept: text/html,
image/gif, image/jpeg, *; q=.2, */*; q=.2 Connection: keep-alive
Content-Length: 706  
------=_Part_0_32663045.1077001326421 Content-Type: text/xml;
charset='utf-8' Content-Transfer-Encoding: 8bit  <env:Envelope
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";><env:Header/><env:Body
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";><m:echo
xmlns:m="http://www.w3.org/2001/XMLSchema";><in0
xsi:type="xsd:int">1</in0><in1/></m:echo></env:Body></env:Envelope>
------=_Part_0_32663045.1077001326421 Content-Type: text/plain Content-Id:
in1  Hello this is for testing... ------=_Part_0_32663045.1077001326421-- 


Here is the response
--------------------------------
HTTP/1.1 500 Internal Server Error Date: Tue, 17 Feb 2004 07:02:07 GMT
Server: WebLogic XMLX Module 8.1 SP1 Fri Jun 20 23:06:40 PDT 2003 271009
with Content-Length: 1875 Content-Type: text/html Connection: Close
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 500--Internal Server Error</TITLE>
<META NAME="GENERATOR" CONTENT="WebLogic Server">
</HEAD>
<BODY bgcolor="white">
<FONT FACE=Helvetica><BR CLEAR=all>
<TABLE border=0 cellspacing=5><TR><TD><BR CLEAR=all>
<FONT FACE="Helvetica" COLOR="black" SIZE="3"><H2>Error 500--Internal Server
Error</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=0 width=100% cellpadding=10><TR><TD VALIGN=top WIDTH=100%
BGCOLOR=white><FONT FACE="Courier New"><pre>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:810)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)         at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:
339)    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at
weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
tStubImpl.java:1053)    at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:387)   at
weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
:305)   at
weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
ebAppServletContext.java:6310)  at
weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
t.java:317)     at
weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at
weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
ntext.java:3622)        at
weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
:2569)  at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)
</pre></FONT></TD></TR>
</TABLE>

</BODY>
</HTML>

Here is my soap client in webogic soap
--------------------------------------------------------

import java.util.*;
import javax.xml.namespace.QName;
import javax.xml.rpc.Call;
import javax.xml.rpc.JAXRPCException;
import javax.xml.rpc.ParameterMode;
import javax.xml.rpc.Service;
import javax.xml.rpc.ServiceException;
import javax.xml.rpc.ServiceFactory;
import javax.xml.rpc.encoding.TypeMapping;
import javax.xml.rpc.encoding.TypeMappingRegistry;
import javax.xml.soap.SOAPConstants;

import javax.activation.*;
import java.io.*;

/**
 * @author Ayyappan Gandhirajan
 * @version 1.0
 */
public class Sample{
        private static String xmlSchema =
"http://www.w3.org/2001/XMLSchema";;
    private static ServiceFactory factory = null;

    static{
           System.setProperty(ServiceFactory.SERVICEFACTORY_PROPERTY,
"weblogic.webservice.core.rpc.ServiceFactoryImpl");
           try{
                   factory = ServiceFactory.newInstance();
           }catch(Exception ex){
                   ex.printStackTrace();
           }
        }

        public static void main(String[] args) throws Exception{
                Service service = factory.createService(new QName(""));
                Call call = service.createCall();
                System.out.println("call created");


                /**
                 * 1. setting input parameters
                 */
                call.addParameter("in0", new QName(xmlSchema, "int"),
ParameterMode.IN);
                call.addParameter("in1", new QName(xmlSchema, "anyType"),
DataHandler.class, ParameterMode.IN);

                /**
                 * 2. setting method name
                 */
                call.setOperationName(new QName(xmlSchema, "echo"));

                /**
                 * 3. setting output parameter
                 */
                call.setReturnType(new QName(xmlSchema, "anyType"),
DataHandler.class);

                /**
                 * 4. setting action point URL
                 */
        
call.setTargetEndpointAddress("http://localhost:7001/axis/services/EchoAttac
hmentService");

                File f = new File("c:/test.txt");
                System.out.println("Sending attachment..."+f.toURL());
                DataHandler dh = new DataHandler(f.toURL());

                System.out.println("Invoking service...");
                Object[] argArray = new Object[]{new Long(1), dh};
                Object obj = call.invoke(argArray);

                if(obj instanceof DataHandler){
                        dh = (DataHandler)obj;
                        System.out.println("name - "+dh.getName());
                        System.out.println("value - "+dh.getContent());
                }else{
                        System.out.println("misc result. class type -
"+obj.getClass());
                        System.out.println("misc result - "+obj);
                }
        }
}




Here is my service in Axis
-------------------------------------

Thanks & regards,
Ayyappan Gandhirajan

Reply via email to