I am trying to use message style web service to send a plain xml document. The element tag in the document has no namespace in front of it. And I got the following error when invoking the service:
AxisFault faultCode: {http://xml.apache.org/axis/}Call.invoke faultSubcode: faultString: Cannot invoke Call with null namespace URI for method null faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace: AxisFault faultCode: {http://xml.apache.org/axis/}Call.invoke faultSubcode: faultString: Cannot invoke Call with null namespace URI for method null faultActor: faultNode: faultDetail: Does it mean I have to add namespace for every element tag in order for it to become a qualified SOAPBodyElement to be sent across the wire, or is there any work around? This xml document I was trying to send is created by JAXB binding, and thus has no namespace in front of each element tag. Thanks. -----Original Message----- From: Carbone Cedric [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 11:42 AM To: [EMAIL PROTECTED] Subject: RE: JAX-RPC with attachments question This an example i use for my message style Web service. The webService wait a DOM and response with another DOM and a binary attachment. I have added several comments in the code following. Hope this helps, Cédric Carbone Neopost France cca<at>brainsoft.fr Server side (the Web service) : ------------------------------- public Document SendMessage(Document demand) throws RemoteException, SOAPException { //make your stuff with the org.xml.w3c.Document demand //build your DOM answer org.xml.w3c.Document response = ...; //Bind the attachments (here 2 javax.activation.Datahandler) DataHandler dh1 = new DataHandler(new FileDataSource("c:/web.jpg")); DataHandler dh2 = new DataHandler(new FileDataSource("c:/TaskManager.txt")); MessageContext messageContext = MessageContext.getCurrentContext(); org.apache.axis.Message responseMessage = messageContext.getResponseMessage(); responseMessage.addAttachmentPart(new AttachmentPart(dh1)); responseMessage.addAttachmentPart(new AttachmentPart(dh2)); //return the DOM answer return response; } Client Side : ------------- Element payload = /*the DOM to send to the web service*/ ; Service service = new Service(); Call call = (Call) service.createCall(); call.setTimeout(this.timeout); call.setTargetEndpointAddress(this.endPoint); SOAPBodyElement[] input = new SOAPBodyElement[1]; input[0] = new SOAPBodyElement(payload); Vector elems = null; //Send Vector elems = (Vector) call.invoke(input); // Response treatement //Extract Attachment(s) org.apache.axis.MessageContext messageContext = call.getMessageContext(); org.apache.axis.Message returnedMessage = messageContext.getResponseMessage(); System.out.println("Number of attachments is -> " + returnedMessage.countAttachments()); Iterator iteAtta = returnedMessage.getAttachments(); DataHandler[] dhTab = new DataHandler[returnedMessage.countAttachments()]; for (int i=0;iteAtta.hasNext();i++) { AttachmentPart ap = (AttachmentPart) iteAtta.next(); dhTab[i] = ap.getDataHandler(); System.out.println("Filename=" + dhTab[i].getName()); } //Extract XML Payload SOAPBodyElement SOAPelem = null; SOAPelem = (SOAPBodyElement) elems.get(0); Element elemResp = SOAPelem.getAsDOM(); The DOM response is Element elemResp. The attachments received from the server are DataHandler[] dhTab[]. -----Message d'origine----- De : Steve Pruitt [mailto:[EMAIL PROTECTED] Envoyé : lundi 9 février 2004 17:00 À : [EMAIL PROTECTED] Objet : JAX-RPC with attachments question I have a service that needs to return xml and an attachment, the xml contains some meta-information about the attachment. I am using the jax-rpc api. My question is how to return both an xml document and an attachment. I can see how to return one or the other, but not both. Can someone point me to a good example, I can't find one. Thanks, -Steve Pruitt