Xpath Namespace problem

Hi,
I'm facing a problem while reading an xpath element which has namespace attached.
The xml document is as follows
<ns0:_root  xmlns:ns0="http://www.oracle.bt.bp.osm/GPRLN">
<ns0:Port_and_Routing_Details_g>
<ns0:Action_Code>
<ns0:Code1>Add</ns0:Code1>
<ns0:Code2>Delete</ns0:Code2>
<ns0:Code3>Update</ns0:Code3>
</ns0:Action_Code>
</ns0:Port_and_Routing_Details_g>
<ns0:Extended_Quantity>1</ns0:Extended_Quantity>
<ns0:Status>Pending</ns0:Status>
<ns0:Description/>
</ns0:_root> In the above xml document i want to capture the text node of <ns0:Code3>Update</ns0:Code3> i.e. I want to get Update as a result.
I'm using the following java program to to get the value by using xpath but not succeeded.
public class XMLParsing {
     public static void main(String[] args)
         try {
                   DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
         domFactory.setNamespaceAware(true);
         DocumentBuilder builder = domFactory.newDocumentBuilder();
         Document doc = builder.parse("E:\\sample.xml");
         XPathFactory factory = XPathFactory.newInstance();
         XPath xpath = factory.newXPath();
          XPathExpression fax = xpath.compile("//ns0:Port_and_Routing_Details_g/ns0:Action_Code/ns0:Code3/text()");
                    Object result = fax.evaluate(doc, XPathConstants.NODESET);
          NodeList nodes = (NodeList) result;
          int len = nodes.getLength();
          System.out.println(len);
          for (int i=0; i<len;i++){
               System.out.println(nodes.item(i).getNodeValue());
         catch (ParserConfigurationException e) {
          e.printStackTrace();
          catch(SAXException e){
               e.printStackTrace();
          catch(IOException e) {
               e.printStackTrace();
          catch(XPathExpressionException e){
               e.printStackTrace();
  }Anybody please help me on this issue
Thanks

Hi,
put bolded code in your program.
It will resolve your problem
public class XMLParsing {
     public static void main(String[] args)
     try {
DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
     domFactory.setNamespaceAware(true);
     DocumentBuilder builder = domFactory.newDocumentBuilder();
     Document doc = builder.parse("E:\\sample.xml");
*NamespaceContext ctx = new NamespaceContext() {*
*public String getNamespaceURI(String prefix) {*
String uri;
if (prefix.equals("ns0"))
uri = "http://www.oracle.bt.bp.osm/GPRLN";
else if (prefix.equals("ns2"))
uri = "http://www.davber.com/sales-format";
else
uri = null;
return uri;
*public Iterator getPrefixes(String val) {*
*     return null;*
*// Dummy implemenation - not used!*
*public String getPrefix(String uri) {*
return null;
     XPathFactory factory = XPathFactory.newInstance();
     XPath xpath = factory.newXPath();
xpath.setNamespaceContext(ctx);
     XPathExpression fax = xpath.compile("//ns0:Port_and_Routing_Details_g/ns0:Action_Code/ns0:Code3/text()");
Object result = fax.evaluate(doc, XPathConstants.NODESET);
          NodeList nodes = (NodeList) result;
          int len = nodes.getLength();
          System.out.println(len);
          for (int i=0; i<len;i++){
               System.out.println(nodes.item(i).getNodeValue());
     catch (ParserConfigurationException e) {
          e.printStackTrace();
          catch(SAXException e){
               e.printStackTrace();
          catch(IOException e) {
               e.printStackTrace();
          catch(XPathExpressionException e){
               e.printStackTrace();
}

Similar Messages

  • [svn] 1313: Fix for the use namespace problems we've been having with ASC ( I hope).

    Revision: 1313
    Author: [email protected]
    Date: 2008-04-20 09:41:41 -0700 (Sun, 20 Apr 2008)
    Log Message:
    Fix for the use namespace problems we've been having with ASC (I hope). The problem was that the use directive was being defined after we had called finish package. The UseDirectiveNode has a pkgdef ptr, and does different things depending if that ptr is null or not. It should not be null when the UseDirective is inside the package - but since we were generating the UseDirectiveNode after we had called finishPackage the UseDirectiveNode didn't have it's pkgdef ptr set, and so things went awry as the package didn't get set up with all the correct open namespaces. I haven't tested this in authoring/flex but I am pretty sure that this will fix all the problems we're seeing.
    Modified Paths:
    flex/sdk/trunk/modules/asc/src/java/macromedia/asc/parser/Parser.java

    Many thanks.
    With those symptoms, I'd try the following document:
    Apple software on Windows: May see performance issues and blank iTunes Store
    (If there's a SpeedBit LSP showing up in Autoruns, it's usually best to just uninstall your SpeedBit Video Accelerator.)

  • Please help with namespace problem

    Hello,
    I am trying to display a gif image an I have a namespace problem.
    Here is my xml document:
    <?xml version='1.0'?>
    <?xml-stylesheet type="text/xsl" href="authors.xsl"?>
    <authors>
    <author>
    <name>Mike Galos</name>
    <nationality>French</nationality>
    </author>
    <author>
    <name>Cynthia Randall</name>
    <nationality>Canadian</nationality>
    </author>
    </authors>
    Here is my xsl stylesheet:
    <?xml version='1.0'?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:template match="//author">
    <image     xmlns:xlink="http://www.w3.org/1999/xlink"
                   xlink:type="simple"
                   xlink:href="logo.gif"
                   xlink:show="embed"/>
    </xsl:template>
    </xsl:stylesheet>
    I want the browser to diplay the gif image but it is only showing the image icon and not the actual gif image.
    Can anyone please help??
    Thanks in advance,
    Balteo.

    do you use a special browser?
    if not, do you really expect a standard browser to understand this kind of non-HTML image tag?
    <image xmlns:xlink="http://www.w3.org/1999/xlink" xlink:show="embed" xlink:href="logo.gif" xlink:type="simple">check HTML 4.0 (http://www.devguru.com/Technologies/html/quickref/html_img.html)
    or XHTML(http://www.devguru.com/Technologies/xhtml/quickref/xhtml_img.html)
    for the correct tag syntax.

  • Namespace problem The result is empty for the XPath expression

    I have a problem with BPEL namespaces. The webservice that my BPEL process is using has changed namespaces (i.e. the java code package names changed and therefore the namespaces associated with the packages.)
    Before there was only one namespace associated with this web services; now there are multiple namespaces.
    I have changed the namespaces in my .bpel file; however I get the result is empty for XPath expression:
    /nsxml0:getMailResponse/nsxml0:getMailReturn/nsxml1:mailOut
    Any help appreciated...:(

    hey b-o-s-t-o-n,
    have your verified that the namespace import is correct, and with the right prefix
    you xpath contains 2 namespace prefixes
    /nsxml0:getMailResponse/nsxml0:getMailReturn/nsxml1:mailOut
    so check the bpel file and maybe the wsdl that has been generated (that inclused the plnk extensions for your external service)
    this is the most common issue ..
    hth clemens

  • XPath Namespace resolver problem

    I've trying to run a simple XPath query
    //z:rowin Java against against the following XML.
    <?xml version="1.0" encoding="utf-8"?>
    <test xmlns:rs="urn:schemas-microsoft-com:rowset"
         xmlns:z="#RowsetSchema">
    <rs:data>
      <z:row>XX</z:row>
    </rs:data>
    </test>I've written my own namespace prefix resolver, and also used the NamespaceContext object at the end of this example [http://www.ibm.com/developerworks/xml/library/x-nmspccontext/index.html?ca=drs-|http://www.ibm.com/developerworks/xml/library/x-nmspccontext/index.html?ca=drs-]
    The problem is that I also get the following error:
    javax.xml.transform.TransformerException:A location step was expected following the '/' or '//' token.
    The problem is the *#* sign in the xmlns:z="#RowsetSchema". If I rename the namespace to be just xmlns:z="RowsetSchema" then it works fine.
    Help, this is driving me mad.
    TIA
    Ian

    Hi,
    Sorry for the delay in responding to the request for a sample. I've put one together now, running a failing test and a working test...
    import com.sun.org.apache.xerces.internal.parsers.DOMParser;
    import java.io.StringReader;
    import java.util.Iterator;
    import javax.xml.XMLConstants;
    import javax.xml.namespace.NamespaceContext;
    import javax.xml.transform.TransformerException;
    import javax.xml.xpath.XPath;
    import javax.xml.xpath.XPathConstants;
    import javax.xml.xpath.XPathExpressionException;
    import javax.xml.xpath.XPathFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    public class TestXPath {
        public static void main(String[] args) {
            try {
                System.out.println("Running Test 1");
                String test1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                        "<test xmlns:rs=\"urn:schemas-microsoft-com:rowset\" xmlns:z=\"#RowsetSchema\">" +
                            "<rs:data>" +
                                "<z:row>XX</z:row>" +
                            "</rs:data>" +
                        "</test>";
                DOMParser parser = new DOMParser();
                parser.parse(new InputSource(new StringReader(test1)));
                runXpathQueryTest( parser.getDocument(), "//z:row");
            } catch (Exception e) {
                e.printStackTrace(System.out);
            try {
                System.out.println("Running Test 2 - Only difference is we have changed '#RowsetSchema' to 'RowsetSchema'");
                String test1 = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
                        "<test xmlns:rs=\"urn:schemas-microsoft-com:rowset\" xmlns:z=\"RowsetSchema\">" +
                            "<rs:data>" +
                                "<z:row>XX</z:row>" +
                            "</rs:data>" +
                        "</test>";
                DOMParser parser = new DOMParser();
                parser.parse(new InputSource(new StringReader(test1)));
                runXpathQueryTest( parser.getDocument(), "//z:row");
            } catch (Exception e) {
                e.printStackTrace(System.out);
        private static void runXpathQueryTest(Document document, String xPathExpression)
                throws XPathExpressionException, TransformerException {
            XPath xPath = XPathFactory.newInstance().newXPath();
            xPath.setNamespaceContext(new UniversalNamespaceResolver(document));
            NodeList result1 = (NodeList) xPath.evaluate( xPathExpression, document, XPathConstants.NODESET);
            System.out.println(xPathExpression + " returned " + result1.getLength() + " matching node(s)");
        static class UniversalNamespaceResolver implements NamespaceContext {
            private Document sourceDocument;
            public UniversalNamespaceResolver(Document document) {
                sourceDocument = document;
            public String getNamespaceURI(String prefix) {
                if (prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)) {
                    return sourceDocument.lookupNamespaceURI(null);
                } else {
                    return sourceDocument.lookupNamespaceURI(prefix);
            public String getPrefix(String namespaceURI) {
                return sourceDocument.lookupPrefix(namespaceURI);
            public Iterator getPrefixes(String namespaceURI) {
                // not implemented yet
                return null;
    }Full output when it is run is:
    Running Test 1
    javax.xml.transform.TransformerException: A location step was expected following the '/' or '//' token.
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.error(XPathParser.java:608)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.Step(XPathParser.java:1737)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.RelativeLocationPath(XPathParser.java:1624)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.LocationPath(XPathParser.java:1595)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.PathExpr(XPathParser.java:1315)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.UnionExpr(XPathParser.java:1234)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.UnaryExpr(XPathParser.java:1140)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.MultiplicativeExpr(XPathParser.java:1061)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.AdditiveExpr(XPathParser.java:1003)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.RelationalExpr(XPathParser.java:928)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.EqualityExpr(XPathParser.java:868)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.AndExpr(XPathParser.java:832)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.OrExpr(XPathParser.java:805)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.Expr(XPathParser.java:788)
            at com.sun.org.apache.xpath.internal.compiler.XPathParser.initXPath(XPathParser.java:127)
            at com.sun.org.apache.xpath.internal.XPath.<init>(XPath.java:176)
            at com.sun.org.apache.xpath.internal.XPath.<init>(XPath.java:264)
            at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.eval(XPathImpl.java:193)
            at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:275)
            at com.categoric.pindar.TestXPath.runXpathQueryTest(TestXPath.java:59)
            at com.categoric.pindar.TestXPath.main(TestXPath.java:30)
    --------------- linked to ------------------
    javax.xml.xpath.XPathExpressionException
            at com.sun.org.apache.xpath.internal.jaxp.XPathImpl.evaluate(XPathImpl.java:289)
            at com.categoric.pindar.TestXPath.runXpathQueryTest(TestXPath.java:59)
            at com.categoric.pindar.TestXPath.main(TestXPath.java:30)
    ...cut...
    Running Test 2 - Only difference is we have changed '#RowsetSchema' to 'RowsetSchema'
    //z:row returned 1 matching node(s)

  • Xpath and Namespaces problems

    Hello there! I'm using XPath to parse a document, and so far It was working great! I'm having issues with namespaces though. When the DocumentBuilder is not namespace aware. It works ok. But, when it is namespaceaware. I need to prefix my xpath expressions. for instance "//foo:message". Altough I'm using a namespacecontext and passing it to the Xpath:
    public class FooNamespaceContext implements NamespaceContext {
         public String getNamespaceURI(String prefix) {
              if (prefix == null) throw new NullPointerException("Null prefix");
              else if ("foo".equals(prefix)) return "http://acme.com/foo/schemas";
              else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
              return null;
         public String getPrefix(String arg0) {
              return "foo";
         public Iterator getPrefixes(String arg0) {
              throw new UnsupportedOperationException("Opera��o desnecess�ria para XPath");
    }How can I just use "//message" with no xmlns prefix? Also, if the user changes de prefix on its xml It does not work.
    Could someone point me to a good tutorial or something (the ones I found at Xerces page are not working)
    Regards

    Thanks for your help
    "/ns1:NotificationConfig/ns1:Transport[ns1:TransportName='" + transportName + "'][1]/ns1:TransportClass/text()" Works fine if I add the prefix to the XML document I'm parsing. However I'll need to look into the the namespace binding you suggested for when I cannot guarantee that the prefix will be present.

  • Pipeline validation xpath resolution problem

    I have a problem with something that seems like it should be a relatively straightforward requirement. I have a set of third-party schemas from a standards organization (CDISC). I need to build a solution that accepts documents conforming to these schemas,
    validates them and distributes them to subscribers. Specifically, I am trying to process messages conforming to the newly-released ODM 1.3.2. I previously built a solution that receives and validates ODM 1.3.1 messages, but CDISC added unique constraints to
    ODM 1.3.2 and re-referenced the targeted namespace with a prefix at the document level. To test the new schemas, I built a simple solution with the ODM schemas and a receive pipeline with an xml disassembler set to validate. The solution compiles and deploys
    without problems, but when I try to process a valid ODM 1.3.2 sample file, I get the following fault message:
    There was a failure executing the receive pipeline: "ODMTest.ReceivePipeline1, ODMTest132, Version=1.0.0.0, Culture=neutral, PublicKeyToken=c5aa898d2acb2194" Source: "XML disassembler" Receive Port: "rcvFile" URI: "D:\Temp\in\*.xml"
    Reason: The prefix 'odm' in XPath cannot be resolved. 
    The problem looks like the issue discussed in the Adventures Inside the Message Box blog article entitled: "Adding a unique constraint to your BizTalk schemas to prevent duplicate values in elements/attributes (Part 2)" (Sorry, MSDN is not letting
    me link the article). The problem is that I cannot resolve the issue in the way the author suggests, since I am not the owner of the schema- CDISC is. I have zipped the sample project and will make it available to anyone who contacts me (apparently, I can't
    yet link content in this forum). Does anyone know a way around this problem?

    Yshmael,
    On BizTalk Administration Console, copy and paste following
    ODMTest132.ODM1_3_2_foundation+ODM|ODMTest132.ODM1_3_2_foundation+Address|ODMTest132.ODM1_3_2_foundation+AdminData|ODMTest132.ODM1_3_2_foundation+Alias|ODMTest132.ODM1_3_2_foundation+Annotation|ODMTest132.ODM1_3_2_foundation+Annotations|ODMTest132.ODM1_3_2_foundation+ArchiveLayout|ODMTest132.ODM1_3_2_foundation+ArchiveLayoutRef|ODMTest132.ODM1_3_2_foundation+Association|ODMTest132.ODM1_3_2_foundation+AuditRecord|ODMTest132.ODM1_3_2_foundation+AuditRecords|ODMTest132.ODM1_3_2_foundation+BasicDefinitions|ODMTest132.ODM1_3_2_foundation+Certificate|ODMTest132.ODM1_3_2_foundation+CheckValue|ODMTest132.ODM1_3_2_foundation+City|ODMTest132.ODM1_3_2_foundation+ClinicalData|ODMTest132.ODM1_3_2_foundation+CodeList|ODMTest132.ODM1_3_2_foundation+CodeListItem|ODMTest132.ODM1_3_2_foundation+CodeListRef|ODMTest132.ODM1_3_2_foundation+Comment|ODMTest132.ODM1_3_2_foundation+ConditionDef|ODMTest132.ODM1_3_2_foundation+Country|ODMTest132.ODM1_3_2_foundation+CryptoBindingManifest|ODMTest132.ODM1_3_2_foundation+DateTimeStamp|ODMTest132.ODM1_3_2_foundation+Decode|ODMTest132.ODM1_3_2_foundation+Description|ODMTest132.ODM1_3_2_foundation+DisplayName|ODMTest132.ODM1_3_2_foundation+Email|ODMTest132.ODM1_3_2_foundation+EnumeratedItem|ODMTest132.ODM1_3_2_foundation+ErrorMessage|ODMTest132.ODM1_3_2_foundation+ExternalCodeList|ODMTest132.ODM1_3_2_foundation+ExternalQuestion|ODMTest132.ODM1_3_2_foundation+Fax|ODMTest132.ODM1_3_2_foundation+FirstName|ODMTest132.ODM1_3_2_foundation+Flag|ODMTest132.ODM1_3_2_foundation+FlagType|ODMTest132.ODM1_3_2_foundation+FlagValue|ODMTest132.ODM1_3_2_foundation+FormalExpression|ODMTest132.ODM1_3_2_foundation+FormData|ODMTest132.ODM1_3_2_foundation+FormDef|ODMTest132.ODM1_3_2_foundation+FormRef|ODMTest132.ODM1_3_2_foundation+FullName|ODMTest132.ODM1_3_2_foundation+GlobalVariables|ODMTest132.ODM1_3_2_foundation+ImputationMethod|ODMTest132.ODM1_3_2_foundation+Include|ODMTest132.ODM1_3_2_foundation+InvestigatorRef|ODMTest132.ODM1_3_2_foundation+ItemData|ODMTest132.ODM1_3_2_foundation+ItemDataAny|ODMTest132.ODM1_3_2_foundation+ItemDataBase64Binary|ODMTest132.ODM1_3_2_foundation+ItemDataBase64Float|ODMTest132.ODM1_3_2_foundation+ItemDataBoolean|ODMTest132.ODM1_3_2_foundation+ItemDataDate|ODMTest132.ODM1_3_2_foundation+ItemDataDatetime|ODMTest132.ODM1_3_2_foundation+ItemDataDouble|ODMTest132.ODM1_3_2_foundation+ItemDataDurationDatetime|ODMTest132.ODM1_3_2_foundation+ItemDataFloat|ODMTest132.ODM1_3_2_foundation+ItemDataHexBinary|ODMTest132.ODM1_3_2_foundation+ItemDataHexFloat|ODMTest132.ODM1_3_2_foundation+ItemDataIncompleteDate|ODMTest132.ODM1_3_2_foundation+ItemDataIncompleteDatetime|ODMTest132.ODM1_3_2_foundation+ItemDataIncompleteTime|ODMTest132.ODM1_3_2_foundation+ItemDataInteger|ODMTest132.ODM1_3_2_foundation+ItemDataIntervalDatetime|ODMTest132.ODM1_3_2_foundation+ItemDataPartialDate|ODMTest132.ODM1_3_2_foundation+ItemDataPartialDatetime|ODMTest132.ODM1_3_2_foundation+ItemDataPartialTime|ODMTest132.ODM1_3_2_foundation+ItemDataString|ODMTest132.ODM1_3_2_foundation+ItemDataTime|ODMTest132.ODM1_3_2_foundation+ItemDataURI|ODMTest132.ODM1_3_2_foundation+ItemDef|ODMTest132.ODM1_3_2_foundation+ItemGroupData|ODMTest132.ODM1_3_2_foundation+ItemGroupDef|ODMTest132.ODM1_3_2_foundation+ItemGroupRef|ODMTest132.ODM1_3_2_foundation+ItemRef|ODMTest132.ODM1_3_2_foundation+KeySet|ODMTest132.ODM1_3_2_foundation+LastName|ODMTest132.ODM1_3_2_foundation+LegalReason|ODMTest132.ODM1_3_2_foundation+Location|ODMTest132.ODM1_3_2_foundation+LocationRef|ODMTest132.ODM1_3_2_foundation+LoginName|ODMTest132.ODM1_3_2_foundation+Meaning|ODMTest132.ODM1_3_2_foundation+MeasurementUnit|ODMTest132.ODM1_3_2_foundation+MeasurementUnitRef|ODMTest132.ODM1_3_2_foundation+MetaDataVersion|ODMTest132.ODM1_3_2_foundation+MetaDataVersionRef|ODMTest132.ODM1_3_2_foundation+MethodDef|ODMTest132.ODM1_3_2_foundation+Organization|ODMTest132.ODM1_3_2_foundation+OtherText|ODMTest132.ODM1_3_2_foundation+Pager|ODMTest132.ODM1_3_2_foundation+Phone|ODMTest132.ODM1_3_2_foundation+Picture|ODMTest132.ODM1_3_2_foundation+PostalCode|ODMTest132.ODM1_3_2_foundation+Presentation|ODMTest132.ODM1_3_2_foundation+Protocol|ODMTest132.ODM1_3_2_foundation+ProtocolName|ODMTest132.ODM1_3_2_foundation+Question|ODMTest132.ODM1_3_2_foundation+RangeCheck|ODMTest132.ODM1_3_2_foundation+ReasonForChange|ODMTest132.ODM1_3_2_foundation+ReferenceData|ODMTest132.ODM1_3_2_foundation+Role|ODMTest132.ODM1_3_2_foundation+Signature|ODMTest132.ODM1_3_2_foundation+SignatureDef|ODMTest132.ODM1_3_2_foundation+SignatureRef|ODMTest132.ODM1_3_2_foundation+Signatures|ODMTest132.ODM1_3_2_foundation+SiteRef|ODMTest132.ODM1_3_2_foundation+SourceID|ODMTest132.ODM1_3_2_foundation+StateProv|ODMTest132.ODM1_3_2_foundation+StreetName|ODMTest132.ODM1_3_2_foundation+Study|ODMTest132.ODM1_3_2_foundation+StudyDescription|ODMTest132.ODM1_3_2_foundation+StudyEventData|ODMTest132.ODM1_3_2_foundation+StudyEventDef|ODMTest132.ODM1_3_2_foundation+StudyEventRef|ODMTest132.ODM1_3_2_foundation+StudyName|ODMTest132.ODM1_3_2_foundation+SubjectData|ODMTest132.ODM1_3_2_foundation+Symbol|ODMTest132.ODM1_3_2_foundation+TranslatedText|ODMTest132.ODM1_3_2_foundation+User|ODMTest132.ODM1_3_2_foundation+UserRef
    to the text box shown in the image. Delete any previous text in the text box
    If this answers your question please mark it accordingly. If this post is helpful, please vote as helpful.

  • XQuery Namespace Problem !

    Hello everyone...
    I'm trying to generate a Xdiff document using XQuery. First, i have tried to generate a static XDiff document using Xquery. I'm getting a problem with namespace. The XQuery I have written is
    select xmlroot(XMLQuery('
    declare namespace xsi="xsi"; (: :)
    declare namespace xd="xd"; (: :)
    let $chk1:=( <xd:delete-node xd:node-type="element" xd:xpath="/RootElement[1]/Invalid[1]" />)
    return <xd:xdiff xsi:schemaLocation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>{$chk1}</xd:xdiff>
    returning content), VERSION '1.0')
    from dual;
    The above query gives me the output
    <?xml version="1.0"?>
    <xd:xdiff xmlns:xd="http://xmlns.oracle.com/xdb/xdiff.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLo
    cation="http://xmlns.oracle.com/xdb/xdiff.xsd http://xmlns.oracle.com/xdb/xdiff.xsd">
    <?oracle-xmldiff operations-in-docorder="false" output-model="current" diff-algorithm="global"?>
    <xd:delete-node xmlns:xd="xd" xd:node-type="element" xd:xpath="/RootElement[1]/Invalid[1]"/>
    </xd:xdiff>
    I don't want that xmlns="xd" attribute. How to eliminate that?
    Please help me.
    Thanks in advance,
    R Kaja Mohideen

    I found that giving the full URL in declare namespace resolves my issue. Oracle's XMLPatch accepts XDiff document generated by this XQuery.

  • Stylesheet namespace problem

    Hi all
    I am having a very strange problem. I am using the following XSL in TRANSFORM activity.
    <xsl:stylesheet version="1.0"
    xmlns:xref="http://www.oracle.com/XSL/Transform/java/oracle.tip.xref.xpath.XRefXPathFunctions"
    xmlns:xp20="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.Xpath20"
    xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:ora="http://schemas.oracle.com/xpath/extension"
    xmlns:ehdr="http://www.oracle.com/XSL/Transform/java/oracle.tip.esb.server.headers.ESBHeaderFunctions"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/db/drfsdf"
    xmlns:orcl="http://www.oracle.com/XSL/Transform/java/oracle.tip.pc.services.functions.ExtFunc"
    xmlns:ids="http://xmlns.oracle.com/bpel/services/IdentityService/xpath"
    xmlns:ns0="http://www.niku.com/xog/Object"
    xmlns:hwf="http://xmlns.oracle.com/bpel/workflow/xpath"
    exclude-result-prefixes="xsl xsd ns1 ns0 xref xp20 bpws ora ehdr orcl ids hwf" >
    <xsl:template match="/">
    <ns0:NikuDataBus>
    <xsl:for-each select="/ns1:drfsdfOutputCollection/ns1:drfsdfOutput">
    <ns0:NikuDataBusReadType>
    <ns0:EmployeeINFO>
    <xsl:attribute name="EMP_ID">
    <xsl:value-of select="ns1:EMPLID"/>
    </xsl:attribute>
    <xsl:attribute name="EMP_NAME">
    <xsl:value-of select="ns1:NAME"/>
    </xsl:attribute>
    </ns0:EmployeeINFO>
    <ns0:others>
    <xsl:attribute name="SUPERVISOR_ID">
    <xsl:value-of select="ns1:SUPERVISOR_ID"/>
    </xsl:attribute>
    <xsl:attribute name="SUPERVISOR_NAME">
    <xsl:value-of select="ns1:SUPERVISOR_NAME"/>
    </xsl:attribute>
    </ns0:others>
    </ns0:NikuDataBusReadType>
    </xsl:for-each>
    </ns0:NikuDataBus>
    </xsl:template>
    </xsl:stylesheet>
    Now the problem is, after transformation I am getting the result like this
    <ns0:NikuDataBus >
    <ns0:NikuDataBusReadType>
    </ns0:NikuDataBusReadType>
    </ns0:NikuDataBus>
    I don't want elements prefixed with anything. If I make this namespace default in xsl file and remove all "ns0:" from elements then result is correct but I wont be able to see this XSL file into designer. Gets the error "Error: XML map generation failed Please use the source editor to correct the problem and return to the design editor".
    What should I do now?
    Thanks.

    Hi,
    Your approach of making the namespace default is right. You wont see mappings in the design view. However, this works perfectly on the server.
    In fact, if you give any element name in the xsl, which is not even in the target schema, the generated xml will contain that element.
    Deepak

  • Namespace Problem

    We are having an issue with our bpel processes when it calls an external web services through a partner link,
    There seems to be an issue with the namespaces, our webservice has a complex type request and response name structure,
    The request structure is as follows in the wsdl file the message name is as follows
    <wsdl:message name="HttpRequest">
    <wsdl:part name="request" type="request:HttpRequest"></wsdl:part>
    </wsdl:message>
    <wsdl:message name="HttpResponse">
    <wsdl:part name="http_response" type="request:HttpResponse"/>
    </wsdl:message>
    The issue comes up when we get a response to the webservice which is a complex type return, the return structure adds ns?:code where ? implies a incrememtal number i.e 1, 2 , 3 etc for the whole data of the complex structure.
    The complex Request structure is
    <xsd:complexType name="HttpRequest">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="1" name="url" type="xsd:string"/>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="data" type="request:Data"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="type" type="request:HttpType"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="auth" type="request:Auth"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="proxy" type="request:Proxy"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="http_version" type="request:HttpVersion"/>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="headers" type="request:Data"/>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="cookies" type="request:Data"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:simpleType name="HttpType">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="Get"/>
    <xsd:enumeration value="Post"/>
    </xsd:restriction>
    </xsd:simpleType>
    <xsd:complexType name="Auth">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="0" name="username" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="password" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Proxy">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="1" name="host" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="port" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="username" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="password" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:simpleType name="HttpVersion">
    <xsd:restriction base="xsd:string">
    <xsd:enumeration value="1.0"/>
    <xsd:enumeration value="1.1"/>
    </xsd:restriction>
    </xsd:simpleType>
    The complex Response structure is
    <xsd:complexType name="HttpResponse">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="0" name="code" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="body" type="xsd:string"/>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="headers" type="request:Data"/>
    <xsd:element maxOccurs="unbounded" minOccurs="0" name="cookies" type="request:HttpCookie"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="Data">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="1" name="name" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="1" name="value" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    <xsd:complexType name="HttpCookie">
    <xsd:sequence>
    <xsd:element maxOccurs="1" minOccurs="0" name="expires" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="domain" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="path" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="secure" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="name" type="xsd:string"/>
    <xsd:element maxOccurs="1" minOccurs="0" name="value" type="xsd:string"/>
    </xsd:sequence>
    </xsd:complexType>
    We have tried to set up TCP Tunneling but it doesnt work for somereason, also i have set validateXML to false,
    the return structure is as follow
    Assign_2 (faulted)
    [2005/09/19 10:57:58] Error in evaluate <from> expression at line "52". The result is empty for the XPath expression : "/http_response/body". less
    <http_response>
    <ns2:code xmlns:ns2="http://request.example.domain.com/1.0/Request.xsd">200</ns2:code>
    <ns3:body xmlns:ns3="http://request.example.domain.com/1.0/Request.xsd">OK</ns3:body>
    <ns4:headers xmlns:ns4="http://request.example.domain.com/1.0/Request.xsd">
    <ns4:name>Date</ns4:name>
    <ns4:value>Mon, 19 Sep 2005 00:14:09 GMT</ns4:value>
    </ns4:headers>
    <ns5:headers xmlns:ns5="http://request.example.domain.com/1.0/Request.xsd">
    <ns5:name>date</ns5:name>
    <ns5:value>Mon, 19 Sep 2005 00:14:09 GMT</ns5:value>
    </ns5:headers>
    <ns6:headers xmlns:ns6="http://request.example.domain.com/1.0/Request.xsd">
    <ns6:name>Server</ns6:name>
    <ns6:value>WebLogic WebLogic Server 7.0 SP2 Sun Jan 26 23:09:32 PST 2003 234192</ns6:value>
    </ns6:headers>
    <ns7:headers xmlns:ns7="http://request.example.domain.com/1.0/Request.xsd">
    <ns7:name>server</ns7:name>
    <ns7:value>WebLogic WebLogic Server 7.0 SP2 Sun Jan 26 23:09:32 PST 2003 234192</ns7:value>
    </ns7:headers>
    <ns8:headers xmlns:ns8="http://request.example.domain.com/1.0/Request.xsd">
    <ns8:name>Content-Length</ns8:name>
    <ns8:value>127</ns8:value>
    </ns8:headers>
    <ns9:headers xmlns:ns9="http://request.example.domain.com/1.0/Request.xsd">
    <ns9:name>content-length</ns9:name>
    <ns9:value>127</ns9:value>
    </ns9:headers>
    <ns10:headers xmlns:ns10="http://request.example.domain.com/1.0/Request.xsd">
    <ns10:name>Content-Type</ns10:name>
    <ns10:value>text/html</ns10:value>
    </ns10:headers>
    <ns11:headers xmlns:ns11="http://request.example.domain.com/1.0/Request.xsd">
    <ns11:name>content-type</ns11:name>
    <ns11:value>text/html</ns11:value>
    </ns11:headers>
    <ns12:headers xmlns:ns12="http://request.example.domain.com/1.0/Request.xsd">
    <ns12:name>Expires</ns12:name>
    <ns12:value>Thu, 01 Jan 1970 00:00:00 GMT</ns12:value>
    </ns12:headers>
    <ns13:headers xmlns:ns13="http://request.example.domain.com/1.0/Request.xsd">
    <ns13:name>expires</ns13:name>
    <ns13:value>Thu, 01 Jan 1970 00:00:00 GMT</ns13:value>
    </ns13:headers>
    <ns14:headers xmlns:ns14="http://request.example.domain.com/1.0/Request.xsd">
    <ns14:name>Connection</ns14:name>
    <ns14:value>Close</ns14:value>
    </ns14:headers>
    <ns15:headers xmlns:ns15="http://request.example.domain.com/1.0/Request.xsd">
    <ns15:name>connection</ns15:name>
    <ns15:value>Close</ns15:value>
    </ns15:headers>
    <ns16:cookies xmlns:ns16="http://request.example.domain.com/1.0/Request.xsd">
    <ns16:name>Date</ns16:name>
    <ns16:value>Mon, 19 Sep 2005 00:14:09 GMT</ns16:value>
    </ns16:cookies>
    <ns17:cookies xmlns:ns17="http://request.example.domain.com/1.0/Request.xsd">
    <ns17:name>date</ns17:name>
    <ns17:value>Mon, 19 Sep 2005 00:14:09 GMT</ns17:value>
    </ns17:cookies>
    <ns18:cookies xmlns:ns18="http://request.example.domain.com/1.0/Request.xsd">
    <ns18:name>Server</ns18:name>
    <ns18:value>WebLogic WebLogic Server 7.0 SP2 Sun Jan 26 23:09:32 PST 2003 234192</ns18:value>
    </ns18:cookies>
    <ns19:cookies xmlns:ns19="http://request.example.domain.com/1.0/Request.xsd">
    <ns19:name>server</ns19:name>
    <ns19:value>WebLogic WebLogic Server 7.0 SP2 Sun Jan 26 23:09:32 PST 2003 234192</ns19:value>
    </ns19:cookies>
    <ns20:cookies xmlns:ns20="http://request.example.domain.com/1.0/Request.xsd">
    <ns20:name>Content-Length</ns20:name>
    <ns20:value>127</ns20:value>
    </ns20:cookies>
    <ns21:cookies xmlns:ns21="http://request.example.domain.com/1.0/Request.xsd">
    <ns21:name>content-length</ns21:name>
    <ns21:value>127</ns21:value>
    </ns21:cookies>
    <ns22:cookies xmlns:ns22="http://request.example.domain.com/1.0/Request.xsd">
    <ns22:name>Content-Type</ns22:name>
    <ns22:value>text/html</ns22:value>
    </ns22:cookies>
    <ns23:cookies xmlns:ns23="http://request.example.domain.com/1.0/Request.xsd">
    <ns23:name>content-type</ns23:name>
    <ns23:value>text/html</ns23:value>
    </ns23:cookies>
    <ns24:cookies xmlns:ns24="http://request.example.domain.com/1.0/Request.xsd">
    <ns24:name>Expires</ns24:name>
    <ns24:value>Thu, 01 Jan 1970 00:00:00 GMT</ns24:value>
    </ns24:cookies>
    <ns25:cookies xmlns:ns25="http://request.example.domain.com/1.0/Request.xsd">
    <ns25:name>expires</ns25:name>
    <ns25:value>Thu, 01 Jan 1970 00:00:00 GMT</ns25:value>
    </ns25:cookies>
    <ns26:cookies xmlns:ns26="http://request.example.domain.com/1.0/Request.xsd">
    <ns26:name>Connection</ns26:name>
    <ns26:value>Close</ns26:value>
    </ns26:cookies>
    <ns27:cookies xmlns:ns27="http://request.example.domain.com/1.0/Request.xsd">
    <ns27:name>connection</ns27:name>
    <ns27:value>Close</ns27:value>
    </ns27:cookies>
    </http_response>
    [2005/09/19 10:57:58] "{http://schemas.xmlsoap.org/ws/2003/03/business-process/}selectionFailure" has been thrown. less
    <selectionFailure xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <part name="summary">
    <summary>empty variable/expression result. xpath variable/expression expression "/http_response/body" is empty at line 52, when attempting reading/copying it. Please make sure the variable/expression result "/http_response/body" is not empty.</summary>
    </part>
    </selectionFailure>
    Regards
    Sandeep

    Well, I had this problem also, and it took me two days to find out what caused it, as the incoming message was obviously NOT empty. In our case the error occurred, because we used an assign at Part level, instead of element level.
    Suppose you have an XML like:
    <element name="a">
    <complexType>
    <sequence>
    <element name="b" type="xsd:string">
    <element name="c" type="xsd:string">
    </sequence>
    </complexType>
    </element>
    and you want to move it to another variable that has the same structure. We used the bpws:GetVariable('a') function to assign it to the receiving variable. When we replaced it with a Transform (using XSL), the problem disappeared.
    The problem also occurs when the definition of fields differ, for instance if the messages looks the same but one element on the sending side is defined 'int' and on the receiving end as 'decimal'. Hope this might point you in the right direction.

  • Namespace problem while updating a desktop app

    Hello,
    I've searched on a lot of forums but didn't find anything accurate on my problem.
    I have an old AIR 2.0 desktop app that updated itself.
    I want to update it to the last 3.4 framework. So I followed instructions for the intermediate application to update (between 2.0 and 2.5).
    I manage to update from 2.0 to a Air 2.5 intermediate application, while still having the 2.0 namespace in the app descriptor file.
    But it is impossible for me to update this 2.5 application (with 2.0 namespace) to a 2.5 namespace !!
    Here si my update descriptor file :
    <?xml version="1.0" encoding="UTF-8"?>
    <update xmlns="http://ns.adobe.com/air/framework/update/description/2.5">
               <versionNumber>0.3.2</versionNumber>
               <versionLabel>Version for 0.3.2</versionLabel>
         <url>http://www.mywebsite/app.air</url>
         <description><![CDATA[
    Final test
               ]]></description>
    </update>
    But I'm having the error 16831 : "Application namespace and update.xml namespace are not compatible".
    It seems that my application only wants to update to another one with the exact same namespace.
    How this can be ?
    Thanks !
    I must say that I publish to AIR 2.5 with Flash CS5 and flashpro extension for air (in beta version) as Flash CS6 always overwrite the app descriptor while publishing (so it is impossible to change the namespace to 2.0 for example)

    Ok, after having searched a lot, I managed to understand what was going on....
    To those interested, the update descriptor must stay in a 1.0 namespace until the end of the process.
    When all is updated (app namespace to 2.5), you can use the 2.5 update descriptor namespace....

  • XPATH + namespaces in 8i not possible?

    Hi,
    im trying to use the XPATH helper package to search a XML document that uses namespaces but it cant match anything:
    <bt1:root xmlns:bt1="http://127.0.0.1">
    <bt1:Error>
    <test>test value</test>
    for example i want 'test' yet when i try to get it using the pl/sql xpath package (in Steve Muench's oracle xml applications book) i get a NULL back.
    result := xpath.valueOf (xmldoc, '//bt1:Error/test');
    result is always null.
    if i remove the NS prefix it works fine.
    is it possible to modify this package to work with a NS? or is there another way of doing this?
    (the xml i recieve is from an external source and cant be modified btw)
    im using Oracle 8.1.7.2 (with the 9i xml xdk)
    Thanks

    I am finding myself asking the same question. I'm trying to use a count() function to find out how many nodes match the XPath pattern I specify. I'm using the PL/SQL API, but since that wraps the Java API, I'm sure that if it doesn't work in Java, it surely won't work in PL/SQL.
    It's been over six weeks since you posted your question, and no one from Oracle has troubled to reply. Is all Oracle support as lame as this?

  • XSLT Transformer xmlns namespace problem

    Hi,
    I have the following xml document
    <PIPEDocument Version="2.0" DocumentReferenceNumber="2001" CreationDate="2002070401251212245"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns="http://www.oeb.gov.on.ca/">
         <MarketParticipantDirectory>
    </MarketParticipantDirectory>
    </PIPEDocument>
    and the following xsl stylesheet
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
              xmlns ="http://www.oeb.gov.on.ca/"
              version = "1.0">
    <xsl:output method = "xml" indent = "yes" />
    <xsl:template match = "/" >
    <PIPEFunctionalAcknowledgement>
              <xsl:apply-templates select="//MarketParticipantDirectory"/>
    </PIPEFunctionalAcknowledgement>
    </xsl:template>
    <xsl:template match = "MarketParticipantDirectory" >
    </xsl:template>
    </xsl:stylesheet>           
    My problem is, using JAXP1.2.0-EA2 (from JWSDP1-0-ea2), javax.xml.transform.Transformer will not find a match on the element name within the template unless I put a prefix on the target namespace i.e.
    if my xml is changed to include a prefix (:xyz in example below)
    <PIPEDocument Version="2.0" DocumentReferenceNumber="2001" CreationDate="2002070401251212245"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xmlns:xyz="http://www.oeb.gov.on.ca/">
         <MarketParticipantDirectory>
    </MarketParticipantDirectory>
    </PIPEDocument>
    and my stylesheet is changed also to include the prefix
    <xsl:stylesheet xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
              xmlns:xyz ="http://www.oeb.gov.on.ca/"
              version = "1.0">
    </xsl:stylesheet>
    then the transfomer works correctly and find a match on the element name "MarketParticipantDirectory" within the template (even though the element doesn't have the prefix xyz:MarketParticipantDirectory).
    Could anyone tell me why this is the case?
    I would have expected XSLT to match the elements from the namespace xmlns ="http://www.oeb.gov.on.ca/" without the prefix.
    Any comments would be much appreciated.
    Thanks
    Sinead Casey

    Matching an element on a Default Namespace requires Explicit Prefix.
    http://www.w3.org/TR/xslt20req

  • Namespace problem with bpelx:rename typeCastTo

    Hi!
    I have j2ee web service which accepts types derived from one base type. Therefore i need to pass argument like request xsi:type="derivedType", where request is super type.
    After long searching i found out this can be done via bpelx:rename typeCastTo ... my problem is that if i use this action:
    <bpelx:rename typeCastTo="ns3:UserOutgoingCallingPlanOriginatingModifyRequest">
    <bpelx:target variable="Invoke_1_transaction_InputVariable" part="parameters" query="/ns2:transactionElement/ns2:_req"/>
    </bpelx:rename>
    in audit console after running he process i see
    <_req xmlns="http://bwproxy.unient.com/types/" xsi:type="ns3:UserOutgoingCallingPlanOriginatingModifyRequest" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    but namespace prefix ns3 is nowhere defined in the message. It is defined only in source ov bpel process, but it is not propagated to the soap message, therefore web service throws a exception:
    Caught exception while handling request: unexpected element type: expected=, actual=UserOutgoingCallingPlanOriginatingModifyRequest
    Is this bug, or am i doing something wrong?
    thanks
    Tomas

    Hi,
    You could try to use HttpClient to consume wcf in windows phone 8.
    Here is an exsample you could refer:
    http://stackoverflow.com/questions/21536825/windows-phone-8-call-wcf-web-service
    Besides, you could refer to :
    http://www.codeproject.com/Questions/691619/Consuming-WCF-Service-from-Windows-Phone
    Since this issue is more related to Windows Phone, If my reply no help, please move to Windows Phone forum for a better support, It is appropriate and more experts will assist you.
    Best Regards,
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • Namespace problem with added header

    I have a client request handler which needs to add an authentication header of the form:
    <Security>
       <UsernameToken>
          <Username>username</Username>
          <Password>password</Password>
       </UsernameToken>
    </Security>     The key code which does this in the request handler is:
    SOAPHeaderElement she = shd.addHeaderElement(senv.createName(SIGN_HEADER_NAME));
    she.setMustUnderstand(true);
    she.addNamespaceDeclaration("", SIGN_HEADER_URI);
    SOAPElement selToken = she.addChildElement(SIGN_HEADER_TOKEN);
    SOAPElement selUser = selToken.addChildElement(SIGN_HEADER_USERNAME);
    selUser.addTextNode(username);
    selUser = selToken.addChildElement(SIGN_HEADER_PASSWORD);
    selUser.addTextNode(password);But what I end up with is:
    <Security soapenv:mustUnderstand="1" xmlns:soapenv=...
           xmlns="http://demo">
       <UsernameToken  xmlns="">
          <Username>username</Username>
          <Password>password</Password>
       </UsernameToken>
    </Security>     The attributes on the Security element are correct, but the xmlns="" attribute on the UsernameToken element is the problem. The SOAP classes/methods are clearly namespace aware and are essentially saying with xmlns="" that it doesn't know the namespace of UsernameToken and the following elements.
    I tried dropping some wsdl for the security elements in the wsdl directory of the client, but it seems to need some programmatic hookup.
    I have defined the handler in the webservicesclient.xml as:
             <handler id="Handler_1128108948956">
                <description>Adds an authentication header with username & password</description>
                <handler-name>utils.SOAP_Auth_Handler</handler-name>
                <handler-class>utils.SOAP_Auth_Handler</handler-class>
                <soap-header id="SOAPHeader_1128460509232">
                   <namespaceURI>http://demo</namespaceURI>
                   <localpart>Security</localpart>
                </soap-header>
             </handler>How do I keep the soap methods from adding on the xmlns="" to the UsernameToken element?
    I'm running WebSphere App Developer 5.0.2.9.
    Thanks,
    -- Frank

    Can't you use the removeNamespaceDeclaration method?
    public boolean removeNamespaceDeclaration(String prefix)Removes the namespace declaration corresponding to the given prefix.
    Parameters:
    prefix - a String giving the prefix for which to search
    Returns:
    true if the namespace declaration was removed successfully; false if it was not
    Gabsaga

Maybe you are looking for

  • Hey Guys, I need some help here

    Im doing some create view and create procedures for my work. In creating view, its just done perfectly. However with create procedures work, I got some problem with the result. So here is the coding: create or replace PROCEDURE "USP_EDW_CASH_MARGIN"

  • Select List (Parent/Child) LOV

    I have the Easy Oracle HTML-DB book, they give an example of a Parent Child Select List using a query. Does anyone know how to apply the Parent/Child relationship with a List of Value generated from a table. Example Parent Child Car Pontiac Car Buick

  • Idoc not getting transmitted

    Hi, Using a developed program, data is extracted from SAP system and sent as Idoc to another system.( No Middlewares) We get Idocs generated having records ( segments) ranging from 1,000 to 40,000, and reaching the port with status "12- Dispatched to

  • Can't get a multichannel multidevice tdms property to work correctly.

    I have posted this question in my last thread which has been solved and I'm hoping it'll get more attention in it's own thread. Sorry for the duplicates. I am attempting to continuously acquire data from 3 different channels on 3 different daq cards

  • Cannot use "search" on appstore on iphone

    It says "cannot connect to itunes" almost all the time... whether on WIFI or EDGE, no difference... other functions on AppStore all work except the search function.. is this a common problem?