Hello,

> I cannot use the ns attribute inside <mapping>, because I would like to add
2 namespaces (plus the default one), whereas it allows only one.

That's not what the ns-attribute is for. With the ns-attribute, you define, 
which namespace this tag belongs to. In this case, it is the namespace with the 
prefix soap, because in the resulting XML your tag looks like: <soap:Envelope 
...>
All namespace definitions directly below the binding-tag will become a part of 
each mapping defined in this binding.

For example:

<binding>
  <namespace uri="foo.bar.01" prefix="a"/>
  <namespace uri="foo.bar.02" prefix="b"/>
  <namespace uri="foo.bar.03" prefix="c"/>

  <mapping ns="foo.bar.01" name="Foo" ...>...</mapping>
</binding>

Will result in the following XML:

<a:Foo xmlns:a="foo.bar.01" xmlns:b="foo.bar.02" xmlns:c="foo:bar:03" 
...>...</a:Foo>

The result will be the same for this mapping, if the namespaces are defined on 
<mapping>-level.

It is strange, that those namespaces are missing in your XML, because your 
binding is correct. I would guess, that some part of your APIs is removing them 
after marshalling is done by JiBX. 

Regards,

Marko Voß

-----Original Message-----
From: vitomeuli [mailto:vitome...@libero.it] 
Sent: Wednesday, July 27, 2011 3:29 PM
To: jibx-users@lists.sourceforge.net
Subject: Re: [jibx-users] Declaring xsi and xsd namespaces in both SOAP 
Envelope and Body content


Hi Marko,
thanks for your fast answer.

The SOAP envelope is dealth with from Spring-WS, and I successfully added
the xsi and xsd namespaces using Axiom inside an Interceptor.

The XML payload is mashalled from JiBX and then put inside the SOAP body. (I
guess)
JiBX does know nothing about soap elements.

If I set the binding like so:
<binding xmlns:ns1="http://www.opentravel.org/OTA/2003/05"; name="org"
package="org.ota.synxis.hotel" trim-whitespace="true">
  <namespace uri="http://www.opentravel.org/OTA/2003/05";
default="elements"/>
  <namespace prefix="xsi" uri="http://www.w3.org/2001/XMLSchema-instance"; />
  <namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema"; />
  <mapping class="org.ota.synxis.hotel.HotelResNotifRS"
name="OTA_HotelResNotifRS">
...
 </mapping>
</binding>

I get the desired SOAP envelope (shown in my former post), but the payload
has missing namespaces
      <OTA_HotelResNotifRS xmlns="http://www.opentravel.org/OTA/2003/05";>
         <Errors>
            <Error Type="1">Found 1 valid reservations with CRS Confirmation
Number=52690IC0000172, there should be none.</Error>
         </Errors>
      </OTA_HotelResNotifRS>

I cannot use the ns attribute inside <mapping>, because I would like to add
2 namespaces (plus the default one), whereas it allows only one.
-----------------------
If I put all the 3 namespaces inside my <mapping>:
        <mapping class="org.ota.synxis.hotel.HotelResNotifRS"
name="OTA_HotelResNotifRS" ns="http://www.opentravel.org/OTA/2003/05";>
                <namespace uri="http://www.opentravel.org/OTA/2003/05";
default="elements"/>
                <namespace prefix="xsi" 
uri="http://www.w3.org/2001/XMLSchema-instance"; />
                <namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema"; 
/>
...

and leave them as before in <binding>, nothing changes.
 -------------------------
If I remove the default="elements", 
        <mapping class="org.ota.synxis.hotel.HotelResNotifRS"
name="OTA_HotelResNotifRS" 
        ns="http://www.opentravel.org/OTA/2003/05";>
                <namespace prefix=""    
uri="http://www.opentravel.org/OTA/2003/05"; />
                <namespace prefix="xsi" 
uri="http://www.w3.org/2001/XMLSchema-instance"; />
                <namespace prefix="xsd" uri="http://www.w3.org/2001/XMLSchema"; 
/>

nothing changes again.
-------------------------
I really don't have a clue about it.

Cheers,
Vito
-- 
View this message in context: 
http://old.nabble.com/Declaring-xsi-and-xsd-namespaces-in-both-SOAP-Envelope-and-Body-content-tp32146703p32147992.html
Sent from the jibx-users mailing list archive at Nabble.com.


------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users


-------------------------------------------------------

Fachinformationszentrum Karlsruhe, Gesellschaft für wissenschaftlich-technische 
Information mbH. 
Sitz der Gesellschaft: Eggenstein-Leopoldshafen, Amtsgericht Mannheim HRB 
101892. 
Geschäftsführerin: Sabine Brünger-Weilandt. 
Vorsitzender des Aufsichtsrats: MinDirig Dr. Thomas Greiner.



------------------------------------------------------------------------------
Got Input?   Slashdot Needs You.
Take our quick survey online.  Come on, we don't ask for help often.
Plus, you'll get a chance to win $100 to spend on ThinkGeek.
http://p.sf.net/sfu/slashdot-survey
_______________________________________________
jibx-users mailing list
jibx-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-users

Reply via email to