4 Replies Latest reply on Apr 18, 2008 4:31 PM by 666705

    xmlns namespace

    666705
      I need to change a xml namespace value. How can this be done? It's the "ns" namespace value. The example below is an rresponse message.

      <?xml version="1.0" encoding="utf-8" ?>
      - <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      - <SOAP-ENV:Body>
      - <ns:getAggregationResponse xmlns:ns="http://gcrm.jpmorgan.com/namespace/cit/aggsvc">
      - <ns:getAggregationResult>
      <ns:CobDate>2007-09-14T00:00:00-04:00</ns:CobDate>
      - <ns:Results>
      - <ns:anyType xsi:type="ns:LmcObject">
      <ns:Client>1559565</ns:Client>
      <ns:UltParent>1559565</ns:UltParent>
      <ns:PrimaryCapital>1969758</ns:PrimaryCapital>
      <ns:GrossPrimaryExposure>685213433</ns:GrossPrimaryExposure>
      <ns:NetPrimaryExposure>245850714</ns:NetPrimaryExposure>
      <ns:PrimaryNAICCode>524126</ns:PrimaryNAICCode>
      <ns:PrimaryNAICDescription>DIRECT PROPERTY AND CASUALTY INSURANCE CARRIERS</ns:PrimaryNAICDescription>
      <ns:PrimaryIndustryClass>Insurance, NonLife</ns:PrimaryIndustryClass>
      <ns:PrimaryIndustryDivision>Insurance</ns:PrimaryIndustryDivision>
      <ns:PrimaryIndustryGroup>Financial Institutions</ns:PrimaryIndustryGroup>
      <ns:SecondaryNAICCode>-1</ns:SecondaryNAICCode>
      <ns:SecondaryNAICDescription>REFERENCE DATA NOT FOUND</ns:SecondaryNAICDescription>
      <ns:SecondaryIndustryClass>REFERENCE DATA NOT FOUND</ns:SecondaryIndustryClass>
      <ns:SecondaryIndustryDivision>REFERENCE DATA NOT FOUND</ns:SecondaryIndustryDivision>
      <ns:SecondaryIndustryGroup>REFERENCE DATA NOT FOUND</ns:SecondaryIndustryGroup>
      </ns:anyType>
      </ns:Results>
      </ns:getAggregationResult>
      </ns:getAggregationResponse>
      </SOAP-ENV:Body>
      </SOAP-ENV:Envelope>
        • 1. Re: xmlns namespace
          666705
          Ok, I found the answer to my own question. Use SOAP Message Handlers to update the outgoing soap response message.

          It seemed a lot of people had this same question on this forum and there was no answers or at least none i could find.
          • 2. Re: xmlns namespace
            666705
            I wish I would have posted this earlier:

            http://dev2dev.bea.com/blog/cindymc/archive/2007/07/using_soap_head.html

            SOAP headers were a bear with JAX-WS, too.
            • 3. Re: xmlns namespace
              666705
              Can someone from BEA please confirm that you can't set the prefix? I get an error saying UNIMPLEMENTED. Perhaps I am not doing setPrefix on the right node or element.

              Is there another workaround?

              Code
              ====
                   SOAPBody body = soap.getSOAPBody();
                   Iterator iter = body.getChildElements();
                   while (iter.hasNext()) {
                        SOAPElement element = (SOAPElement)iter.next();
                        System.out.println(element.getPrefix());
                        element.setPrefix(null);
                   }

              Exception
              ========
              Exception in thread "Main Thread" java.rmi.RemoteException: SOAPFaultException - FaultCode [{http://schemas.xmlsoap.org/soap/envelope/}Server] FaultString [UNIMPLEMENTED] FaultActor [null] Detail [<detail><bea_fault:stacktrace xmlns:bea_fault="http://www.bea.com/servers/wls70/webservice/fault/1.0.0">java.lang.AssertionError: UNIMPLEMENTED
                   at weblogic.xml.domimpl.NodeImpl.setPrefix(NodeImpl.java:171)
                   at handler.testHandler.handleResponse(testHandler.java:34)
                   at weblogic.wsee.handler.JaxrpcHandlerChain.handleResponse(JaxrpcHandlerChain.java:111)
              • 4. Re: xmlns namespace
                666705
                It looks like you are trying to play with a SOAP message envelope, we had a similar issue when we were trying to do the same. In the handler init method we had to add the following properties.

                          System.setProperty("javax.xml.soap.SOAPConnectionFactory", "weblogic.wsee.saaj.SOAPConnectionFactoryImpl");
                          System.setProperty("javax.xml.soap.MessageFactory", "weblogic.xml.saaj.MessageFactoryImpl");
                          System.setProperty("javax.xml.soap.SOAPFactory", "weblogic.xml.saaj.SOAPFactoryImpl");

                After this we could play around with the soap envelope, removing elements and so forth.

                Regards,
                Adi.