[ 
https://issues.apache.org/jira/browse/AXIS2-4342?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andreas Veithen updated AXIS2-4342:
-----------------------------------

    Issue Type: Bug  (was: Test)

> javax.xml.soap.SOAPException: org.apache.axis2.AxisFault: Mapping qname not 
> fond for the package: org.apache.axis2.saaj
> -----------------------------------------------------------------------------------------------------------------------
>
>                 Key: AXIS2-4342
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4342
>             Project: Axis 2.0 (Axis2)
>          Issue Type: Bug
>          Components: saaj
>    Affects Versions: 1.4.1
>         Environment: Ubuntu 8.10 (Linux Kernel: 2.6.27-11-generic), 
> jdk1.6.0_10, axis2-1.4.1, apache-tomcat-6.0.16
>            Reporter: dinoo
>
> Hi!
> I do not know if here is the good place to post this message. Please, I need 
> help
> I'm making a JAX-WS Web Service. The service must return a .ZIP file. I thus 
> use the SAAJ API.
> I deployed the service using Eclipse Plugin Axis2 Code Service Archiver, and 
> stored it in axis2's repository in 
> /CATALINA_HOME/webapps/axis2/WEB-INF/services
> HERE IS THE SERVICE'S CODE:
> /**
>  * 
>  */
> package dialogue;
> import java.io.InputStream;
> import java.net.MalformedURLException;
> import java.net.URL;
> import java.util.ArrayList;
> import java.util.Collection;
> import java.util.Iterator;
> import javax.activation.DataHandler;
> import javax.jws.WebMethod;
> import javax.jws.WebParam;
> import javax.jws.WebService;
> import javax.swing.JOptionPane;
> import javax.xml.namespace.QName;
> import javax.xml.soap.AttachmentPart;
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPBody;
> import javax.xml.soap.SOAPBodyElement;
> import javax.xml.soap.SOAPConstants;
> import javax.xml.soap.SOAPElement;
> import javax.xml.soap.SOAPEnvelope;
> import javax.xml.soap.SOAPException;
> import javax.xml.soap.SOAPHeader;
> import javax.xml.soap.SOAPMessage;
> import javax.xml.soap.SOAPPart;
> /** 
>  * @author root
>  * @since Mercredi 06 Mai 2009 11:27
>  * @version 1.0 
>  */
> @WebService
> public class FileService {
>       private String fileName = null;
>       private MessageFactory messageFactory = null;
>       private SOAPMessage message = null;
>       private SOAPPart part = null;
>       private SOAPEnvelope envelope = null;
>       private SOAPHeader header = null;
>       private SOAPBody body = null;
>       private QName name = null;
>       private SOAPBodyElement soapBodyElement = null;
>       private QName nameContenu = null;
>       private SOAPElement soapElement = null;
>       private AttachmentPart attachmentPart = null;
>       private Collection<String> collection = null;
>       
>       public FileService() {
>       }
>       /**
>        * @param filesToGet
>        * @return
>        */
>       @WebMethod
>       public SOAPMessage recupererFile(@WebParam(name="filesToGet") String 
> fileToGet){
>               
>               dialFiles = new DialFiles();
>               dialFiles.setFileToGet(fileToGet);
>               try {
>                       fileName = dialFiles.returnRequestedFileName();
>               } catch (Exception e1) {
>                       e1.printStackTrace();
>                       //send SOAPFault
>               }
>               try {
>                       messageFactory = 
> MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL);
>                       
>                       message = messageFactory.createMessage();
>                       part = message.getSOAPPart();
>                       envelope = part.getEnvelope();
>                       header = envelope.getHeader();
>                       header.detachNode();
>                       body = envelope.getBody();
>                       name = new QName("http://dialogue","Thanx";, "rm");
>                       soapBodyElement = body.addBodyElement(name);
>                       nameContenu = new QName("speech");
>                       soapElement = 
> soapBodyElement.addChildElement(nameContenu);                     
>                       soapElement.addTextNode("Thank u!");
>                       
>                       URL url = new URL("file:////temp/"+fileName);
>                       DataHandler dataHandler = new DataHandler(url);
>                       attachmentPart = 
> message.createAttachmentPart(dataHandler);
>                       attachmentPart.setContentId("attached_file");
>                       message.addAttachmentPart(attachmentPart);
>               } catch (SOAPException e) {
>                       e.printStackTrace();
>                       //send SOAPFault
>               }catch (MalformedURLException e) {
>                       e.printStackTrace();
>                       //send SOAPFault
>               }
>               
>               return message;
>       }
> }
>  HERE IS THE CLIENT'S CODE:
> package client;
> import java.io.FileNotFoundException;
> import java.io.FileOutputStream;
> import java.io.IOException;
> import java.io.InputStream;
> import java.net.MalformedURLException;
> import java.net.URL;
> import java.util.Iterator;
> import javax.xml.namespace.QName;
> import javax.xml.soap.AttachmentPart;
> import javax.xml.soap.MessageFactory;
> import javax.xml.soap.SOAPBody;
> import javax.xml.soap.SOAPBodyElement;
> import javax.xml.soap.SOAPConnection;
> import javax.xml.soap.SOAPConnectionFactory;
> import javax.xml.soap.SOAPElement;
> import javax.xml.soap.SOAPException;
> import javax.xml.soap.SOAPFault;
> import javax.xml.soap.SOAPHeader;
> import javax.xml.soap.SOAPMessage;
> /** 
>  * @author root
>  * @since Vendredi 08 Mai 2009 23:08
>  * @version 1.0 
>  */
> public class ClasseCliente {
>       private SOAPConnectionFactory soapConnectionFactory = null;
>       private SOAPConnection soapConnection = null;
>       private MessageFactory messageFactory = null;
>       private SOAPMessage soapMessage = null;
>       private SOAPHeader soapHeader = null;
>       private SOAPBody soapBody = null;
>       private QName bodyName = null;
>       private SOAPBodyElement soapBodyElement = null;
>       private QName name = null;
>       private SOAPElement soapElement = null;
>       private URL endpointUrl = null;
>       private SOAPMessage reponse = null;
>       private AttachmentPart attachmentPartReponse = null;
>       private SOAPBody soapBodyreponse = null;
>       private Iterator<SOAPBodyElement> iterator = null;
>       private SOAPBodyElement soapBodyElementReponse = null;
>       private String contenuReponse = null;
>       private Iterator<AttachmentPart> iterator2 = null;
>       
>       public void recupererFile(){
>               try {
>                       soapConnectionFactory = 
> SOAPConnectionFactory.newInstance();
>                       soapConnection = 
> soapConnectionFactory.createConnection();
>                       messageFactory = MessageFactory.newInstance();
>                       soapMessage = messageFactory.createMessage();
>                       soapHeader = soapMessage.getSOAPHeader();
>                       soapHeader.detachNode();
>                       soapBody = soapMessage.getSOAPBody();
>                       
>                       bodyName = new QName("http://dialogue";, 
> "recupererFile", "rm");
>                       soapBodyElement = soapBody.addBodyElement(bodyName);
>                       
>                       name = new QName("FileName");
>                       soapElement = soapBodyElement.addChildElement(name);
>                       soapElement.addTextNode("MyFile-1.1");
>                       
>                       try {
>                               endpointUrl = new 
> URL("http://localhost:8080/axis2/services/ServiceEntrepotService";);
>                       } catch (MalformedURLException e) {
>                               e.printStackTrace();
>                       }
>                       
>                       soapMessage = soapConnection.call(soapMessage, 
> endpointUrl);
>                       soapConnection.close();
>                       
>                       soapBody = soapMessage.getSOAPBody();
>                       if(soapBody.hasFault()){
>                               System.out.println("There's a fault!");
>                               SOAPFault faute = soapBody.getFault();
>                               QName code = faute.getFaultCodeAsQName();
>                               String stringFaute = faute.getFaultString();
>                               String actor = faute.getFaultActor();
>                               System.out.println("Fault content:");
>                               System.out.println("Code: "+code.toString());
>                               System.out.println("Local name: 
> "+code.getLocalPart());
>                               System.out.println("Namespace Prefix= 
> "+code.getPrefix()+", bound to "+code.getNamespaceURI());
>                               System.out.println("Fault String: 
> "+stringFaute);
>                               if(actor!=null){
>                                       System.out.println("Actor: "+actor);
>                               }
>                       }
>                       iterator = soapBody.getChildElements();
>                       while(iterator.hasNext()){
>                               System.out.println("Message:");                 
>         
>                               soapBodyElement = iterator.next();
>                               
> System.out.println(soapBodyElement.getNodeName());
>                               contenuReponse = soapBodyElement.getValue();
>                               System.out.println("The message is: 
> "+contenuReponse);
>                       }
>                       
>                       iterator2 = soapMessage.getAttachments();
>                       while(iterator2.hasNext()){
>                               attachmentPartReponse = iterator2.next();
>                               String id = 
> attachmentPartReponse.getContentId();
>                               System.out.println("Attachment's Content ID: 
> "+id);
>                               String type = 
> attachmentPartReponse.getContentType();
>                               System.out.println("Attachment's Content Type: 
> "+type);
>                               InputStream theFileRequested = 
> (InputStream)attachmentPartReponse.getContent();
>                               Integer nb =null;
>                               try {
>                                       nb = theFileRequested.available();
>                               } catch (IOException e1) {
>                                       e1.printStackTrace();
>                               }
>                               byte[] b = null ;
>                               try {
>                                       FileOutputStream fileOutputStream = new 
> FileOutputStream("/root");
>                                       
> fileOutputStream.write(theFileRequested.read(b, 0, nb));
>                               } catch (FileNotFoundException e) {
>                                       e.printStackTrace();
>                               } catch (IOException e) {
>                                       e.printStackTrace();
>                               }
>                       }
>               } catch (UnsupportedOperationException e) {
>                       e.printStackTrace();
>               } catch (SOAPException e) {
>                       e.printStackTrace();
>               }
>       }
>       
>       
>       public static void main(String[] args) {
>               ClasseCliente classeCliente = new ClasseCliente();
>               classeCliente.recupererFile();
>       }
> }
> I GET THIS EXCEPTION when I execute The client:
> javax.xml.soap.SOAPException: org.apache.axis2.AxisFault: Mapping qname not 
> fond for the package: org.apache.axis2.saaj
>       at 
> org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(SOAPConnectionImpl.java:194)
>       at 
> org.apache.axis2.saaj.SOAPConnectionImpl.call(SOAPConnectionImpl.java:130)
>       at client.ClasseCliente.recupererFile(ClasseCliente.java:77)
>       at client.ClasseCliente.main(ClasseCliente.java:145)
> Caused by: org.apache.axis2.AxisFault: org.apache.axis2.AxisFault: Mapping 
> qname not fond for the package: org.apache.axis2.saaj
>       at 
> org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
>       at 
> org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
>       at 
> org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
>       at 
> org.apache.axis2.saaj.SOAPConnectionImpl.handleSOAPMessage(SOAPConnectionImpl.java:188)
>       ... 3 more
> Whitch qname is missing? where to find it?

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to