Hi AXIOMXPath Experts,

        I use Axis2 1.2 on Topy of Tomcat on top of JDK 1.4.2-n both Windows 
and OpenVMS
        (I know I migth have to upgrade AXIS2/Java, see environment below)

        my routine getUsername(element) runs nicely from an Axis2SOAPClient on 
Window 2000 and OpenVMS

        The exact same code dose however NOT run when used on OpenVMS in our 
SpezplaService (Axis2/Java web service.)
        See correct launch/deployment below

        The statement 
        OMElement user = (OMElement) xPath.selectSingleNode(element);
        always returns NULL to user

        The element in which we seek the xPath (expression) looks identical, at 
least I can not see a difference.
        element.toString shown below

        The thing which botters me a bit is, that when I convert the received 
OMElement to a string within
        AXIS2/Java SpezplaService.login(), I can see an escaping technique used 
for each xmlns uri.

        Migth this be the reason why xPath.selectSingleNode(element); does not 
find what I want and returns no OMElement ??????
        In short loking at the xPath added name spaces they look the same on 
client and server but
        what if this name spaces are not not found due to some escaping 
technices used internal of the OMElement?

        my element up on which I try to seek for USERNAME

        "<b:root xmlns:d=\"WS\" xmlns:b=\"SPS-Payload\" xmlns:c=\"COL\" 
xmlns:e=\"feld\"><c:col><d:wsinp><e:TARGET>FKT_WMBCREATE</e:TARGET><e:SELECT 
/><e:USERNAME>stadelma</e:USERNAME><e:PASSWORD>***********</e:PASSWORD></d:wsinp><d:wsold><e:yuck40>blah40</e:yuck40><e:yuck41>blah41</e:yuck41><e:yuck42>blah42</e:yuck42><e:yuck43>blah43</e:yuck43><e:yuck44>blah44</e:yuck44><e:yuck45>blah45</e:yuck45><e:yuck46>blah46</e:yuck46><e:yuck47>blah47</e:yuck47><e:yuck48>blah48</e:yuck48><e:yuck49>blah49</e:yuck49><e:yuck50>blah50</e:yuck50><e:yuck51>blah51</e:yuck51><e:yuck52>blah52</e:yuck52><e:yuck53>blah53</e:yuck53><e:yuck54>blah54</e:yuck54><e:yuck55>blah55</e:yuck55><e:yuck56>blah56</e:yuck56><e:yuck57>blah57</e:yuck57><e:yuck58>blah58</e:yuck58><e:yuck59>blah59</e:yuck59><e:yuck60>blah60</e:yuck60><e:yuck61>blah61</e:yuck61><e:yuck62>blah62</e:yuck62><e:yuck63>blah63</e:yuck63><e:yuck64>blah64</e:yuck64><e:yuck65>blah65</e:yuck65><e:yuck66>blah66</e:yuck66><e:yuck67>blah67</e:yuck67><e:yuck68>blah68</e:yuck68><e:yuck69>blah69</e:yuck69><e:yuck70>blah70</e:yuck70><e:yuck71>blah71</e:yuck71><e:yuck72>blah72</e:yuck72><e:yuck73>blah73</e:yuck73><e:yuck74>blah74</e:yuck74><e:yuck75>blah75</e:yuck75><e:yuck76>blah76</e:yuck76><e:yuck77>blah77</e:yuck77><e:yuck78>blah78</e:yuck78><e:yuck79>blah79</e:yuck79></d:wsold></c:col></b:root>"

        Any hints and thougths are very welcome.

        Josef


    private static String getUsername(OMElement element){
        try {
            /**
             * -TODO--
             * deliver Username in a encrypted form; i.e. use a hashing 
technique or
             * better use Rampart and a WS-Security Modell / Policy AND 
             * Transport Level Security such as HTTPS
             **/
            String s10 = element.getNamespace().getPrefix();            // it's 
b
            String s11 = element.getNamespace().getNamespaceURI();      // it's 
SPS-Payload
//              AXIOMXPath xPath = new 
AXIOMXPath("//soapenv:Envelope/soapenv:Body/b:root/c:col/d:wsinp/e:USERNAME");
            AXIOMXPath xPath = new 
AXIOMXPath("//b:root/c:col/d:wsinp/e:USERNAME");
//              
xPath.addNamespace("soapenv","http://schemas.xmlsoap.org/soap/envelope/";);
//              
xPath.addNamespace("wsa","http://www.w3.org/2005/08/addressing";);
            xPath.addNamespace("b","SPS-Payload");
            xPath.addNamespace("c","COL");
            xPath.addNamespace("d","WS");
            xPath.addNamespace("e","feld");
            
            OMElement user = (OMElement) xPath.selectSingleNode(element);
            return user.getText();
            
        } catch (JaxenException e) {
            e.printStackTrace();  //To change body of catch statement use File 
| Settings | File Templates.
            System.out.println("Unknown JaxenException at 
SpezplaService.getUsername()");
        } catch (Exception ex) {
            ex.printStackTrace();
            System.out.println("Unknown Java exception at 
SpezplaService.getUsername()");
        }
        return "";


my environment looks like that: on OpenVMS

NOTE: I can not use JDK 1.5.0 due to beeing unable to use JPDA connector to 
debug from 
NetBeans IDE (need to attache to my web service)

Tomcat listens on port 8000 for a NetBeans IDE debugger attache request


$   j_cmd "-version"
0: dsa0:[sys0.syscommon.][java$142.bin]java$java.exe;1
1: -version
java version "1.4.2"
Java(TM) 2 Runtime Environment, Standard Edition
Classic VM (build 1.4.2-5, 03/06/2006-23:29, native threads, jit)
$   j_cmd "-V" "APACHE$SPECIFIC:[000000]TOMCAT_JVM_DBG_ARGS.DAT"   "-V" 
"sys$scratch:apache$jakarta_secparamfile.000045F0" -
                "org.apache.catalina.startup.Bootstrap" -
        "-V" "sys$scratch:apache$jakarta_paramfile.000045F0" "start"
0: dsa0:[sys0.syscommon.][java$142.bin]java$java.exe;1
1: -Xms64m
2: -Xmx512m
3: -Xdynclassgc
4: -Xdebug
5: -Xrunjdwp:transport=dt_socket,server=y,address=8000,suspend=n
6: -Xnoagent
7: -Djava.compiler=NONE
8: -Djava.endorsed.dirs=/dsa5/apache/jakarta/tomcat/common/endorsed
9: -Dcatalina.base=/dsa5/apache/jakarta/tomcat/
10: -Dcatalina.home=/dsa5/apache/jakarta/tomcat/
11: -Dcatalina.tmpdir=/dsa5/apache/jakarta/tomcat/temp
12: org.apache.catalina.startup.Bootstrap
13: JPDA
14: start
Created MBeanServer with ID: 
1bc3411:1190fd5b7f9:-8000:ALPHA1.ch.winterthur.com:1
usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ 
-nonaming ] { start | stop }
- Initializing Coyote HTTP/1.1 on http-8080
- Initialization processed in 55584 ms
- Starting service Catalina
- Starting Servlet Engine: Apache Tomcat/5.5.9
- XML validation disabled
- Deploying web application archive axis2.war
- Deploying module: addressing-1.2
- Deploying module: soapmonitor-1.2
- Deploying module: SpezplaLogging-1.2
[JAM] Warning: You are running under a pre-1.5 JDK.  JSR175-style source 
annotations will not be available
- Deploying Web service: SpezplaService.aar
- Deploying Web service: version.aar
AXP1>


  

Reply via email to