Trouble with namespaces in a SOAP message generated with Axis2
Emmanuel GUITON <[email protected]>
| Newsgroups | gmane.text.xml.axis.user |
|---|---|
| Message-ID | <CFF063C1FC7DA94E9EB19BB597F62EFBE92238CD@ISC-SRV-EXC01.intrinsec.neurones.sa> |
Hello,
I am generating SOAP messages using Axis2 and a WSDL which you can find hereafter.
I logged the messages that are sent and I noticed a behavior that I cannot decide if it is legitimate or not (due to my lack of experience on SOAP I presume).
The first element in the content of the SOAP body is prefixed with a namespace which is defined in the WSDL while the definition of the element is described in a separate XSD file (that I import into the WSDL). I.e., in the sample SOAP message hereafter, I expected to see ns2 instead of ns3 as a prefix for element msg1.
Moreover, if I change the element prefix with ns2, I can validate the content of the message with eclipse while I cannot with the message as sent by Axis2.
Can someone explain this behavior ? What could be the problem if there is any ?
Thanks,
- Emmanuel
The SOAP message :
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<ns3:msg1 xmlns:ns3="wsdl-namespace" xmlns="xsd2-namespace" xmlns:ns2="xsd1-namespace<http://libra.intrinsec.com/bel_protocol/1.0/>">
<ns2:metadata>
<ns2:id>322221</ns2:id>
</ns2:metadata>
</ns3:msg1>
</soapenv:Body>
</soapenv:Envelope>
The (relevant part of the) WSDL :
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<wsdl:definitions
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="wsdl-namespace"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsd1="xsd1-namespace"
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
name="name"
targetNamespace="wsdl-namespace" >
<!-- types, provide data type definitions used to describe the messages exchanged -->
<wsdl:types>
<xsd:schema targetNamespace="wsdl-namespace" xmlns:xsd1="xsd1-namespace" xmlns:jxb=http://java.sun.com/xml/ns/jaxb jxb:version="1.0" >
<xsd:import namespace="xsd1-namespace" schemaLocation="xsd1.xsd" />
</xsd:schema>
</wsdl:types>
<!-- message, represents an abstract definition of the data being transmitted. A message consists of logical parts, each of which is associated with a definition within some type system. -->
<!-- Requests -->
<wsdl:message name="msg1Request">
<wsdl:part element="xsd1:msg1" name="content" />
</wsdl:message>
…
The relevant part of the XSD where messages are defined :
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns=http://www.w3.org/2001/XMLSchema
xmlns:tns="xsd1-namespace"
xmlns:xsd2="xsd2-namespace"
xmlns:jxb=http://java.sun.com/xml/ns/jaxb
targetNamespace="xsd1-namespace"
elementFormDefault="qualified" jxb:version="1.0">
<import namespace="xsd2-namespace" schemaLocation="xsd2.xsd" />
<element name="msg1">
<complexType>
<sequence>
<element name="metadata" type="tns:MetaDataType" />
</sequence>
</complexType>
</element>
…
Emmanuel GUITON
Ingénieur Développement
Fixe : +33 1 70 92 84 16 • Standard : +33 1 41 91 77 77
215, Avenue Georges Clemenceau • 92024 Nanterre
[cid:[email protected]]<http://www.intrinsec.com/>
[cid:[email protected]]<http://www.intrinsec.com/>
Cliquez ici pour obtenir la dernière étude Markess sur le Cloud<http://www.markess.fr/demandedocument.php?refdoc=798>
[email protected]
(image/gif, 3.7 KB) - not displayed
[email protected]
(image/jpeg, 5.8 KB) - not displayed