i want help you but your code not work, cause: error in run.
The code that you've showed us...is completed for client e server??
In data Wed, 19 Oct 2005 18:43:24 +0200, Vicente D. Guardiola Buitrago
<[EMAIL PROTECTED]> ha scritto:
No,
it's in a simple java Class, but the problem is un the client, the
constructor SOAPBodyElement modifies de XMLDoxument (byte[]) I pass it
as paraemter.
It adds xmlns:ns1="" in every second level element in the document.
Carmine Gargiulo wrote:
the Server Code is into a servlet?
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
______________________________________________ Renovamos el
Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es
______________________________________________ Renovamos el
Correo Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es
______________________________________________ Renovamos el Correo
Yahoo! Nuevos servicios, más seguridad http://correo.yahoo.es
--
Carmine Gargiulo
Carmine Gargiulo usa il rivoluzionario client e-mail di Opera:
http://www.opera.com/m2/
--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f
Sponsor:
Cerchi lamore? Allora iscriviti gratis a Meetic: troverai migliaia di single
in linea e potrai chattare con loro.
Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=4049&d=20-10