You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Jongjin Choi (JIRA)" <ax...@ws.apache.org> on 2005/11/22 10:52:42 UTC

[jira] Commented: (AXIS-2312) SAAJ SOAPElement has phantom prefix in it's children.

    [ http://issues.apache.org/jira/browse/AXIS-2312?page=comments#action_12358220 ] 

Jongjin Choi commented on AXIS-2312:
------------------------------------

Can you upload a reproducable test case?

> SAAJ SOAPElement has phantom prefix in it's children.
> -----------------------------------------------------
>
>          Key: AXIS-2312
>          URL: http://issues.apache.org/jira/browse/AXIS-2312
>      Project: Apache Axis
>         Type: Bug
>   Components: SAAJ
>     Versions: 1.3
>  Environment: Manbdrake 10.0 Tomcat 5.5.9
>     Reporter: Roman Levandovsky

>
> Here is the XML
> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
>  <soapenv:Header>
>   <HTNGHeader schemaLocation="http://htng.org/1.1/Header/ http://webservices.micros.com/htng/HTNGHeader.xsd" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns="http://htng.org/1.1/Header/">
>    <From>
>     <systemid>SOAPClient</systemid>
>     <address>http://localhost</address>
>     <Credential>
>      <username>user</username>
>      <password>pass</password>
>     </Credential>
>    </From>
>    <To>
>     <systemid>PMSMonitorService</systemid>
>     <address>http://localhost:8080/axis/services/PMSMonitor</address>
>    </To>
>    <timeStamp>2005-10-25T09:06:50.000</timeStamp>
>    <echoToken>randomstring</echoToken>
>    <action>getPMSStatus</action>
>   </HTNGHeader>
>  </soapenv:Header>
>  <soapenv:Body>
>   <GetHello xmlns="">
>    <hello xmlns="">Hello Earthling</hello>
>   </GetHello>
>  </soapenv:Body>
> </soapenv:Envelope>
> The Java code tries to extract the child element from the rootHeaderElement which in this example is HTNGHeader. The child element has the name From.
> What happens is this, after calling rootHeaderElem.getChildElements(fromName); the iter variable contains nothing. When I look in the debugger, children of rootHeaderElem all have ns1 as the prefix even though no prefixes were present in the original xml. When I look at the xml of rootHeaderElem non of it has any prefixes and looks like this 
> <HTNGHeader schemaLocation="http://htng.org/1.1/Header/ http://webservices.micros.com/htng/HTNGHeader.xsd" soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next" soapenv:mustUnderstand="0" xmlns="http://htng.org/1.1/Header/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"><From><systemid>SOAPClient</systemid><address>http://localhost</address><Credential><username>user</username><password>pass</password></Credential></From><To><systemid>PMSMonitorService</systemid><address>http://localhost:8080/axis/services/PMSMonitor</address></To><timeStamp>2005-10-25T09:06:50.000</timeStamp><echoToken>randomstring</echoToken><action>getPMSStatus</action></HTNGHeader>
> The child XML looks like this
> <ns1:From xmlns:ns1="http://htng.org/1.1/Header/"><ns1:systemid>SOAPClient</ns1:systemid><ns1:address>http://localhost</ns1:address><ns1:Credential><ns1:username>user</ns1:username><ns1:password>pass</ns1:password></ns1:Credential></ns1:From>
> Naturally the getChildElements(fromName); method can't find any children because the From child has a ns1 prefix associated with it.
>                 SOAPHeader header = pmsPostReqEnvelope.getHeader();
>                 Name fromName = envelope.createName("From");
>                 // get the header element
>                 Iterator iter = header.getChildElements();
>                 SOAPElement rootHeaderElem = (SOAPElement) iter.next();
>                 
>                 // get the From element
>                 iter = rootHeaderElem.getChildElements(fromName);

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira