Revision 3566 trunk/applications/appCatalogYNomenclatorClient/src/es/gva/cit/catalogClient/schemas/discoverer/SOAPMessageParser.java

View differences:

SOAPMessageParser.java
1
/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
1

  
2
/* gvSIG. Sistema de Informaci??n Geogr??fica de la Generalitat Valenciana
2 3
*
3 4
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
4 5
*
......
20 21
*
21 22
*  Generalitat Valenciana
22 23
*   Conselleria d'Infraestructures i Transport
23
*   Av. Blasco Ib��ez, 50
24
*   Av. Blasco Ib????ez, 50
24 25
*   46010 VALENCIA
25 26
*   SPAIN
26 27
*
......
39 40
*   dac@iver.es
40 41
*/
41 42
package es.gva.cit.catalogClient.schemas.discoverer;
42

  
43 43
import es.gva.cit.catalogClient.metadataXML.XMLNode;
44 44
import es.gva.cit.catalogClient.metadataXML.XMLTree;
45 45

  
46

  
47

  
48 46
/**
49 47
 * This class is used to parse a SOAP message
50 48
 * 
49
 * 
51 50
 * @author Jorge Piera Llodra (piera_jor@gva.es)
52 51
 */
53 52
public class SOAPMessageParser {
54
    /**
55
     * Cut the SOAP Head
56
     * @param node
57
     * Node retreived
58
     * @return
59
     * A new node without the SOAP Head
60
     */
61
    public static XMLNode cutHead(XMLNode node) {
62
        XMLNode[] children = node.getSubnodes();
63 53

  
54
/**
55
 * Cut the SOAP Head
56
 * 
57
 * 
58
 * @return A new node without the SOAP Head
59
 * @param node Node retreived
60
 */
61
    public static XMLNode cutHead(XMLNode node) {        
62
        XMLNode[] children = node.getSubnodes();
64 63
        for (int i = 0; i < node.getNumSubNodes(); i++)
65 64
            if (children[i].getName().equals("SOAP-ENV:Body")) {
66 65
                return children[i];
67 66
            }
68

  
69 67
        return null;
70
    }
68
    } 
71 69

  
72
    /**
73
     * Get the fault code (if it exists)
74
     * @param node
75
     * The node retrieved
76
     * @return
77
     * The Fault message or NULL
78
     */
79
    public static String getFault(XMLNode node) {
70
/**
71
 * Get the fault code (if it exists)
72
 * 
73
 * 
74
 * @return The Fault message or NULL
75
 * @param node The node retrieved
76
 */
77
    public static String getFault(XMLNode node) {        
80 78
        if (node == null) {
81 79
            return null;
82 80
        }
83

  
84 81
        node = cutHead(node);
85

  
86 82
        if (node.getName().equals("SOAP-ENV:Fault")) {
87 83
            return "FAULT-CODE = " +
88 84
            XMLTree.searchNodeValue(node, "faultcode") + "\nREASON = " +
89 85
            "Este error se produce normalmente cuando el " +
90 86
            "servidor no implementa la operacion getCapabilities";
91 87
        }
92

  
93 88
        //XMLTree.searchNodeValue(node,"faultstring");
94 89
        return null;
95
    }
96
}
90
    } 
91
 }

Also available in: Unified diff