To solve the problem I've purged the XmlObjects, by hand

    static public void purgeNamespace( XmlCursor cursor ){
        HashMap hm_dup = new HashMap();
        TokenType tt = null;
        boolean already_found = false;
        int debugStep = 1;

        while ((tt = cursor.toNextToken()) != TokenType.ENDDOC) {
            already_found = false; //leave the first

            if (debugStep >= 1) {
                System.out.println("TokenType:" + tt.toString() + "(" +
                    tt.intValue() + ")");
            }

            QName name = cursor.getName();

            if (name != null) {
                String localPart = name.getLocalPart();
                String prefix = name.getPrefix();
                String namespaceURI = name.getNamespaceURI();

                if (hm_dup.containsKey(namespaceURI)) {
                    already_found = true;
                } else {
                    hm_dup.put(namespaceURI, "");
                }

                if (debugStep >= 1) {
                    System.out.println("prefix:" + prefix + ", uri:" +
                        namespaceURI + ", localPart:" + localPart);
                }

                if ((tt == TokenType.START) && already_found) {
                    QName new_name = new QName(localPart);
                    cursor.setName(new_name);
                } else {
                }
            }
        }
    }
    
Bye!

Il giorno ven, 11/04/2008 alle 11.48 +0200, Bartolomeo Nicolotti ha
scritto:
> Hi,
> 
> I've used axis2 to build a web services that filters and forward SOAP
> messages that contains xml from OTA xsd to another web service. The xsd
> are here:
> 
> http://www.opentravel.org/Specifications/ReleaseNotes.aspx?spec=2007A
> 
> The web service has been generated from a wsdl with the command:
> 
> wsdl2java.sh -uri DynPkgOTA.wsdl -s -ss -sd -ssi -sp -d xmlbeans -o .. 
> 
> with which the classes to marshall/unmarshall xml from the OTA xsd, as
> the xsd are refenced in the wsdl.
> 
> The forwarded messages are sent in a low-level way:
> 
> 
> ////////////////////////////////////////////////////////////////////
> SOAPConnectionFactory soapConnFactory =
> SOAPConnectionFactory.newInstance();
> SOAPConnection connection = soapConnFactory.createConnection();
> 
> //Next, create the actual message
> MessageFactory messageFactory = MessageFactory.newInstance();
> SOAPMessage message = messageFactory.createMessage();
> SOAPPart soapPart = message.getSOAPPart();
> 
> //Create objects for the message parts            
> SOAPEnvelope envelope = soapPart.getEnvelope();
> 
> SOAPBody body = envelope.getBody();
> 
> body.addDocument((Document) node_to_be_sent);
> 
> //Save the message
> message.saveChanges();
> 
> //Send the message to destination and get the reply
> reply = connection.call(message, uri);
> ////////////////////////////////////////////////////////////////////
> 
> Above node_to_be_sent is obained:
> 
> node_to_be_sent = hotelSearchRQ.getDomNode();
> 
> where hotelSearchRQ is an xmlbeans object parsed from a filtered
> message.
> 
> The problem is that in the SOAP message forwarded the way above the xml
> tags  have a lot of xmls="...", as below. Is there a way to avoid the
> presence of this xmlns?
> 
> SOAP MESSAGE SENT TO http://htl-wsd.infotechsrl.it/proxyxml/services/:
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";>
> <soapenv:Body xmlns:axis2ns41="http://www.opentravel.org/OTA/2003/05";>
> <axis2ns52:OTA_HotelSearchRQ
> xmlns:axis2ns52="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns42="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns40="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns23="http://www.opentravel.org/OTA/2003/05"; Target="Test">
> <axis2ns23:POS xmlns:axis2ns16="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns43="http://www.opentravel.org/OTA/2003/05";>
> <axis2ns16:Source
> xmlns:axis2ns44="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns3="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns10="http://www.opentravel.org/OTA/2003/05"; AgentSine="SP">
> <axis2ns3:RequestorID
> xmlns:axis2ns45="http://www.opentravel.org/OTA/2003/05"; ID="siap"
> MessagePassword="siap" />
> <axis2ns10:BookingChannel
> xmlns:axis2ns6="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns46="http://www.opentravel.org/OTA/2003/05";>
> <axis2ns6:CompanyName
> xmlns:axis2ns47="http://www.opentravel.org/OTA/2003/05"; Code="SIA" />
> </axis2ns10:BookingChannel>
> </axis2ns16:Source>
> </axis2ns23:POS>
> <axis2ns40:Criteria
> xmlns:axis2ns34="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns48="http://www.opentravel.org/OTA/2003/05";>
> <axis2ns34:Criterion
> xmlns:axis2ns26="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns29="http://www.opentravel.org/OTA/2003/05";
> xmlns:axis2ns49="http://www.opentravel.org/OTA/2003/05";><axis2ns26:HotelRef 
> xmlns:axis2ns50="http://www.opentravel.org/OTA/2003/05"; ChainCode="SI" 
> HotelCityCode="city" />
> <axis2ns29:StayDateRange
> xmlns:axis2ns51="http://www.opentravel.org/OTA/2003/05"; End="2008-04-10
> +02:00" Start="2008-04-15+02:00" />
> </axis2ns34:Criterion></axis2ns40:Criteria>
> </axis2ns52:OTA_HotelSearchRQ>
> </soapenv:Body>
> </soapenv:Envelope>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to