Re: First row under header return null

"Paul Hsu" <[email protected]> Fri, 24 Sep 2004 16:19:22 -0700
Newsgroups gmane.text.xml.soap.devel
Message-ID <00f501c4a28c$f5e36c60$c000a8c0@hsuasus>
First row under header return nulltry this, it should work. You problem is tempElement is the right level of layer already. Element is extends Node.

Vector headerEntries = env.getHeader().getHeaderEntries(); 
Element headerElement = (Element) headerEntries.firstElement(); 
NodeList tempNodeList = headerElement.getElementsByTagName("TransactionID");  //I want the TransactionID. 
Element tempElem = (Element)tempNodeList.item(0);    
System.out.println((String)tempElem.getNodeValue().trim()); 

  ----- Original Message ----- 
  From: Paul Hsu 
  To: [email protected] 
  Sent: Friday, September 24, 2004 4:04 PM
  Subject: Re: First row under header return null


  I think you should change the code to
  NodeList tempNodeList = headerElement.getElementsByTagName("TransactionID");  //I want the TransactionID.
    ----- Original Message ----- 
    From: FIORAMORE, François 
    To: '[email protected]' 
    Sent: Friday, September 24, 2004 2:27 PM
    Subject: First row under header return null


    Hi, 

    I'm creating and sending the following xml to Apache SOAP: 

    ******************************************************************* 
    POST /soap/servlet/messagerouter HTTP/1.1 
    ... 
    ... 
    <?xml version='1.0' encoding='UTF-8'?> 
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
    <mm7:TransactionID s:mustUnderstand="1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mm7="http://www.3gpp.org/MMS/Rel5/MM7">vas00001-sub</mm7:TransactionID>

    </s:Header> 
    <s:Body> 
    <SubmitReq xmlns="urn:Something"> 
             <MM7Version>5.3.0</MM7Version> 
    </SubmitReq> 
    </s:Body> 
    </s:Envelope> 
    ******************************************************************* 

    When I try to get the TransactionID value under the header, it doesn't work. 
    Here the code: 

    ******************************************************************* 
    env is a type Envelope. 
    Vector headerEntries = env.getHeader().getHeaderEntries(); 
    Element headerElement = (Element) headerEntries.firstElement(); 
    NodeList tempNodeList = headerElement.getElementsByTagName("*");  //I want the TransactionID. 
    Element tempElem = (Element)tempNodeList.item(0);    
    Node tempNode = tempElem.getFirstChild();    
    System.out.println((String)tempNode.getNodeValue().trim()); 
    ******************************************************************* 

    But when I use the following xml, it work: 

    ******************************************************************* 
    POST /soap/servlet/messagerouter HTTP/1.1 
    ... 
    ... 
    <?xml version='1.0' encoding='UTF-8'?> 
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"> 
    <s:Header> 
    <temp> 
    <mm7:TransactionID s:mustUnderstand="1" xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:mm7="http://www.3gpp.org/MMS/Rel5/MM7">vas00001-sub</mm7:TransactionID>

    </temp> 
    </s:Header> 
    <s:Body> 
    <SubmitReq xmlns="urn:Something"> 
             <MM7Version>5.3.0</MM7Version> 
    </SubmitReq> 
    </s:Body> 
    </s:Envelope> 
    ******************************************************************* 

    The only different thing, is the <temp> and </temp> tag. 
    Is seem for some reason that the first line under the header tag can never been read, but if you add a level between TransactionID and Header, everything under the temp tag is reachable.

    So how can I get the TransactionID without having to put the <temp> tag? 

    This could also be a misunderstanding from my part.  Let me know. 

    Software involve: 
    Xerces-J-bin.2.2.0.zip 
    jakarta-tomcat-4.0.3.zip 
    j2sdk-1_4_1_07-solaris-sparc.sh 
    soap-bin-2.3.1.zip 

    Thank. 

    Ciao, 
    François. 

    François Fioramore 
    Project Manager 
    airwide solutions (formerly Schlumberger Messaging) 
    T:  +1 (450) 646-7700 x210 
    M: +1 (514) 262-8540 
    F:  +1 (450) 646-7004 
    1111 St-Charles St. West, 8th Floor, East Tower 
    Longueuil, Québec, J4K 5G4, Canada 


    ________________________________________________________________________
    airwide solutions is changing its email address format to [email protected].
    Any slb.com email addresses will be valid until 30th September 2004.
    ________________________________________________________________________