logo       

Re: First row under header return null: msg#00010

Subject: Re: First row under header return null
I don't know which package you use to parse the soap. I use Jakata AXIS web service which adopt Jakata SOAP. I wrote a test code which it print the right information.
 

import javax.xml.soap.*;

import java.util.Iterator;

import org.apache.axis.message.SOAPEnvelope;

import javax.xml.soap.SOAPHeader;

import java.io.*;

import org.xml.sax.*;

 

public class TestSoap {

    public TestSoap() {

    }

    public static void main (String arg[])

 {

 

    String soap= "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\">" +

       "<s:Header>" +

          "<TransactionID s:mustUnderstand=\"1\" xmlns:mm7=\"http://www.3gpp.org/MMS/Rel5/MM7\">vas00001-sub</TransactionID>" +

       "</s:Header>" +

       "<s:Body>" +

          "<SubmitReq xmlns=\"urn:T-MobileAM\" orderDate=\"2004-09-01\">" +

             "<MM7Version>5.3.0</MM7Version>" +

          "</SubmitReq>" +

       "</s:Body>" +

    "</s:Envelope>";

try {

    SOAPEnvelope env = new SOAPEnvelope (new StringBufferInputStream (soap));

 

    SOAPHeader soaph = env.getHeader ();

    Iterator soape = soaph.getChildElements ();

    while(soape.hasNext())

    {

        SOAPElement e = (SOAPElement) soape.next();

        Name name = e.getElementName();

        System.out.println(name.getLocalName() + ":" + e.getValue());

    }

}

catch (SOAPException ex) {

}

catch (SAXException ex) {

}

 }

}

----- Original Message -----
Sent: Monday, September 27, 2004 11:21 AM
Subject: RE: First row under header return null

Hi Paul,
 
Thank for the support.  But is didn't work.
I try what you wrote but it keep returning me null as the value.
I just want to get the value information (TransactionID) in the following xml envelope.
 
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
   <s:Header>
      <TransactionID s:mustUnderstand="1" xmlns:mm7="http://www.3gpp.org/MMS/Rel5/MM7">vas00001-sub</TransactionID>
   </s:Header>
   <s:Body>
      <SubmitReq xmlns="urn:T-MobileAM" orderDate="2004-09-01">
         <MM7Version>5.3.0</MM7Version>
      </SubmitReq>
   </s:Body>
</s:Envelope>
 
Sound simple enough.  :)
 
Here the beginning of the code:
 
   Envelope env
   ...
   Vector headerEntries = env.getHeader().getHeaderEntries();
   Element headerElement = (Element) headerEntries.firstElement();
   ...
   ...what next???  :)
   System.out.println(???.getNodeName()); //Will print out TransactionID
   System.out.println(???.getNodeValue()); //Will print out vas00001-sub
   // I wrote getNodeName and getNodeValue, but it could be anything...as long as it work.  :)
 
Thank.
 
Ciao,
François.
 
-----Original Message-----
From: Paul Hsu [mailto:hsu.paul@xxxxxxxxxxx]
Sent: Friday, September 24, 2004 7:19 PM
To: soap-dev@xxxxxxxxxxxxx
Subject: Re: First row under header return null

try 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
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 -----
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 firstname.lastname@xxxxxxxxxxxxxxxxxxxxx
Any slb.com email addresses will be valid until 30th September 2004.
________________________________________________________________________

________________________________________________________________________
airwide solutions is changing its email address format to firstname.lastname@xxxxxxxxxxxxxxxxxxxxx
Any slb.com email addresses will be valid until 30th September 2004.
________________________________________________________________________
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
science.linguis...    culture.sf.lite...    video.mplayer.c...    yellowdog.gener...    ietf.rfc822/199...    emacs.help/2002...    redhat.release....    kernel.speakup/...    java.openejb.de...    debian.devel.gt...    xfree86.newbie/...    bug-tracking.ma...    pam/2003-05/msg...    games.devel.ope...    user-groups.lin...    music.pancham/2...    network.mq.deve...    web.html.genera...    arklinux.bugs/2...    linux.ecasound/...    qnx.openqnx.dev...    org.user-groups...    file-systems.sf...    trustix.contrib...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe