Hi Bhuvan,

I know that code, is mine.
Yes, the code is intended for th purpose I want but it doesn't work, as I "debating" with Carmine, the constructor SOAPBodyElement(byte[]) Modifies the xml document by adding to scond level elements xkmlns:ns1="", and so it causes a SAXParserException due to the presence ob blank namespaces and the actual problem: ir modifies the xml document.

If I found a "good" solution i'll send it to the mail list.

Regards,

Vicente Guardiola


Bhuvan Gupta wrote:

Looks like your mailserver filtered out the attachment.
Anyhow, here's the content of the mail which I had attached.
============ START =================================
----- Original Message ----- From: "Vicente D. Guardiola Buitrago" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, October 18, 2005 2:39 PM
Subject: Re: Message Style Service


Client Code is:

   public byte[] request(byte[] request){
       try{
           Service  service = new Service();
           Call     call    = (Call) service.createCall();
           call.setTargetEndpointAddress( new
URL("http://localhost:8080/axis/services/MyService";) );
           SOAPBodyElement[] input = new SOAPBodyElement[1];
           input[0] = new org.apache.axis.message.SOAPBodyElement(new
ByteArrayInputStream(request));
           System.out.println(call.invoke(input));
       }catch(Exception e){
           e.printStackTrace();
       }
       return null;
   }


and Server Code is:

   public void service(javax.xml.soap.SOAPEnvelope req,
javax.xml.soap.SOAPEnvelope resp) throws Exception {
       if(myService == null){
           myService = new MyService();
       }

       // Request to byte[]
       SOAPBody soapBody = req.getBody();
       Node docBody = soapBody.getFirstChild();

       ByteArrayOutputStream inBytes = new ByteArrayOutputStream();
       TransformerFactory tf = TransformerFactory.newInstance();
       Transformer trans = tf.newTransformer();
trans.transform(new DOMSource(docBody), new StreamResult(inBytes));

       //Call the  real underlyingService
       byte[] response = myService.service(inBytes.toByteArray());


       ByteArrayInputStream outBytes = new
ByteArrayInputStream(response);
DocumentBuilderFactory docf = DocumentBuilderFactory.newInstance();
       DocumentBuilder docb = docf.newDocumentBuilder();
       Document doc = docb.parse(outBytes);

       ((org.apache.axis.message.SOAPEnvelope)resp).addBodyElement(new
org.apache.axis.message.SOAPBodyElement(doc.getDocumentElement()));
   }


The WSDD descriptor for the service is:

<deployment name="xkms" xmlns="http://xml.apache.org/axis/wsdd/";
           xmlns:java="http://xml.apache.org/axis/wsdd/providers/java";
           xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance";>
 <service name="MyService" style="message">
   <parameter name="className" value="org.um.xkms.ws.MyService" />
   <parameter name="allowedMethods" value="service" />
 </service>
</deployment>


I havn't WSDL (because I don't know how to write it for this kind of
service)

Thanks a lot!

Vicente Guardiola

Carmine Gargiulo wrote:

show us all client/server code that you've wrote

In data Tue, 18 Oct 2005 10:55:12 +0200, Vicente D. Guardiola Buitrago <[EMAIL PROTECTED]> ha scritto:

Hello,

I want to do a Message style service because I want to send a XML document already created to the service and it returns another XML to me. I've seen in the Axis User's Guide that this type of service is the perfect ne to do this, because using this service the XML keeps unmodified, but it isn't in that way, that is, my XML is modified, when I create a SOAPBodyElement with a byte[] (which contains the XML file created) the XML-Document is modified by adding sevreal namespaces to all the elements!!!!

Code:

             byte[] request; //An XML FIle
             ...
            Service  service = new Service();
            Call     call    = (Call) service.createCall();
call.setTargetEndpointAddress( new URL("http://localhost:8080/axis/services/Service";) ); SOAPBodyElement[] input = new SOAPBodyElement[1]; input[0] = new org.apache.axis.message.SOAPBodyElement(new ByteArrayInputStream(request)); call.invoke(input);


How can I keep my XML file unmodified???

Thanks

Vicente Guardiola


============ END ===============================


----- Original Message ----- From: "Carmine Gargiulo" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Wednesday, October 19, 2005 8:20 PM
Subject: Re: Send XML just under <soap:body>


-Bhuvan...where is the attached file???

In data Wed, 19 Oct 2005 10:56:24 +0200, Bhuvan Gupta <[EMAIL PROTECTED]>
ha scritto:

-Bhuvan






                
______________________________________________ Renovamos el Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es

Reply via email to