You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by amit_9b <am...@yahoo.com> on 2009/07/29 16:25:50 UTC

Namespace problem in webservice response

Hi,

I am hosting a webservice using apache-cxf v2.1.1.
The issue i am facing is that the 'first element of response' is
namespace-qualified, but other child elements are not. (SOAP
Request/Response as seen in CXF logs is attached to this email).

So here is the output I get:
==================== RESPONSE ====================
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ns2:models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
      <model active="true" provider="gili" name="nn" id="1">
        <display-name>Near Neighbors</display-name>
        <description>Find near neighbors in cpd collection</description>
        <model-output-types>
          <model-output-type data-type="integer" name="near neighborId"
id="1">
            <description>LSN of gili near neighbors</description>
          </model-output-type>
          <model-output-type data-type="smiles" name="near neighbor
structure" id="2">
            <description>Structure of near neighbors</description>
          </model-output-type>
        </model-output-types>
      </model>
      <model active="true" provider="gili2" name="nn2" id="2">
        <display-name>gili Near Neighbors 2</display-name>
        <description>Find near neighbors in gili cpd
collection</description>
        <model-output-types>
          <model-output-type data-type="integer" name="near neighbor Id"
id="1">
            <description>LSN of gili near neighbors</description>
          </model-output-type>
          <model-output-type data-type="smiles" name="near neighbor
structure" id="2">
            <description>Structure of gili near neighbors</description>
          </model-output-type>
        </model-output-types>
      </model>
    </ns2:models>
  </soap:Body>
</soap:Envelope>
==================== RESPONSE ENDS ====================

So - making the issue more explicit if you take a look at the following soap
response: 
    <ns2:models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
      <model active="true" provider="gili" name="nn" id="1">
        <display-name>Near Neighbors</display-name>

The models element is qualified with `ns2` while any other element is not!
I want to get rid of this `ns2` qualifier.

So the soap response I desire is :
==================== DESIRED RESPONSE ==================== 
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
      <model active="true" provider="gili" name="nn" id="1">
        <display-name>Near Neighbors</display-name>
        <description>Find near neighbors in cpd collection</description>
        <model-output-types>
          <model-output-type data-type="integer" name="near neighborId"
id="1">
            <description>LSN of gili near neighbors</description>
          </model-output-type>
          <model-output-type data-type="smiles" name="near neighbor
structure" id="2">
            <description>Structure of near neighbors</description>
          </model-output-type>
        </model-output-types>
      </model>
      <model active="true" provider="gili2" name="nn2" id="2">
        <display-name>gili Near Neighbors 2</display-name>
        <description>Find near neighbors in gili cpd
collection</description>
        <model-output-types>
          <model-output-type data-type="integer" name="near neighbor Id"
id="1">
            <description>LSN of gili near neighbors</description>
          </model-output-type>
          <model-output-type data-type="smiles" name="near neighbor
structure" id="2">
            <description>Structure of gili near neighbors</description>
          </model-output-type>
        </model-output-types>
      </model>
    </models>
  </soap:Body>
</soap:Envelope>
==================== DESIRED RESPONSE ENDS==================== 

Thanks in advance.
http://www.nabble.com/file/p24719842/cxf-request-response.txt
cxf-request-response.txt 
-- 
View this message in context: http://www.nabble.com/Namespace-problem-in-webservice-response-tp24719842p24719842.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Namespace problem in webservice response

Posted by amit_9b <am...@yahoo.com>.
I am using a wsdl first approach.

The schema definition uses `elementFormDefault="qualified"` property. It
still doesn't work.
I am posting the schema part for you too see:
=========== SCHEMA ELEMENT ===========
        <xsd:schema
                elementFormDefault="qualified"
                attributeFormDefault="unqualified"
                targetNamespace="http://prime.simplesoft.org/2009/xsd"
                xmlns:spx="http://prime.simplesoft.org/2009/xsd"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema">
======== SCHEMA ELEMENT ENDS ========

Any other ideas ?
Thanks,
amit_9b

dkulp wrote:
> 
> 
> I assume you mean you want:
> <models xmlns="http://prime.simplesoft.org/2009/xsd">
> ....
> 
> You don't say if this is a wsdl first or not type situation. 
> 
> If it IS, then you need to check the schema in the wsdl.  You would need
> to 
> add elementFormDefault="qualified" to the schema.  By default, it would be 
> unqualified which results in the message format you see.
> 
> On Wed July 29 2009 10:25:50 am amit_9b wrote:
>> Hi,
>>
>> I am hosting a webservice using apache-cxf v2.1.1.
> 
> I'd also suggest upgrading to something newer.  :-)
> 
> Dan
> 
> 
> 
>> The issue i am facing is that the 'first element of response' is
>> namespace-qualified, but other child elements are not. (SOAP
>> Request/Response as seen in CXF logs is attached to this email).
>>
>> So here is the output I get:
>> ==================== RESPONSE ====================
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>   <soap:Body>
>>     <ns2:models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>>       <model active="true" provider="gili" name="nn" id="1">
>>         <display-name>Near Neighbors</display-name>
>>         <description>Find near neighbors in cpd collection</description>
>>         <model-output-types>
>>           <model-output-type data-type="integer" name="near neighborId"
>> id="1">
>>             <description>LSN of gili near neighbors</description>
>>           </model-output-type>
>>           <model-output-type data-type="smiles" name="near neighbor
>> structure" id="2">
>>             <description>Structure of near neighbors</description>
>>           </model-output-type>
>>         </model-output-types>
>>       </model>
>>       <model active="true" provider="gili2" name="nn2" id="2">
>>         <display-name>gili Near Neighbors 2</display-name>
>>         <description>Find near neighbors in gili cpd
>> collection</description>
>>         <model-output-types>
>>           <model-output-type data-type="integer" name="near neighbor Id"
>> id="1">
>>             <description>LSN of gili near neighbors</description>
>>           </model-output-type>
>>           <model-output-type data-type="smiles" name="near neighbor
>> structure" id="2">
>>             <description>Structure of gili near neighbors</description>
>>           </model-output-type>
>>         </model-output-types>
>>       </model>
>>     </ns2:models>
>>   </soap:Body>
>> </soap:Envelope>
>> ==================== RESPONSE ENDS ====================
>>
>> So - making the issue more explicit if you take a look at the following
>> soap response:
>>     <ns2:models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>>       <model active="true" provider="gili" name="nn" id="1">
>>         <display-name>Near Neighbors</display-name>
>>
>> The models element is qualified with `ns2` while any other element is
>> not!
>> I want to get rid of this `ns2` qualifier.
>>
>> So the soap response I desire is :
>> ==================== DESIRED RESPONSE ====================
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>   <soap:Body>
>>     <models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>>       <model active="true" provider="gili" name="nn" id="1">
>>         <display-name>Near Neighbors</display-name>
>>         <description>Find near neighbors in cpd collection</description>
>>         <model-output-types>
>>           <model-output-type data-type="integer" name="near neighborId"
>> id="1">
>>             <description>LSN of gili near neighbors</description>
>>           </model-output-type>
>>           <model-output-type data-type="smiles" name="near neighbor
>> structure" id="2">
>>             <description>Structure of near neighbors</description>
>>           </model-output-type>
>>         </model-output-types>
>>       </model>
>>       <model active="true" provider="gili2" name="nn2" id="2">
>>         <display-name>gili Near Neighbors 2</display-name>
>>         <description>Find near neighbors in gili cpd
>> collection</description>
>>         <model-output-types>
>>           <model-output-type data-type="integer" name="near neighbor Id"
>> id="1">
>>             <description>LSN of gili near neighbors</description>
>>           </model-output-type>
>>           <model-output-type data-type="smiles" name="near neighbor
>> structure" id="2">
>>             <description>Structure of gili near neighbors</description>
>>           </model-output-type>
>>         </model-output-types>
>>       </model>
>>     </models>
>>   </soap:Body>
>> </soap:Envelope>
>> ==================== DESIRED RESPONSE ENDS====================
>>
>> Thanks in advance.
>> http://www.nabble.com/file/p24719842/cxf-request-response.txt
>> cxf-request-response.txt
> 
> -- 
> Daniel Kulp
> dkulp@apache.org
> http://www.dankulp.com/blog
> 
> 

-- 
View this message in context: http://www.nabble.com/Namespace-problem-in-webservice-response-tp24719842p24733054.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Namespace problem in webservice response

Posted by Daniel Kulp <dk...@apache.org>.
I assume you mean you want:
<models xmlns="http://prime.simplesoft.org/2009/xsd">
....

You don't say if this is a wsdl first or not type situation. 

If it IS, then you need to check the schema in the wsdl.  You would need to 
add elementFormDefault="qualified" to the schema.  By default, it would be 
unqualified which results in the message format you see.

On Wed July 29 2009 10:25:50 am amit_9b wrote:
> Hi,
>
> I am hosting a webservice using apache-cxf v2.1.1.

I'd also suggest upgrading to something newer.  :-)

Dan



> The issue i am facing is that the 'first element of response' is
> namespace-qualified, but other child elements are not. (SOAP
> Request/Response as seen in CXF logs is attached to this email).
>
> So here is the output I get:
> ==================== RESPONSE ====================
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>     <ns2:models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>       <model active="true" provider="gili" name="nn" id="1">
>         <display-name>Near Neighbors</display-name>
>         <description>Find near neighbors in cpd collection</description>
>         <model-output-types>
>           <model-output-type data-type="integer" name="near neighborId"
> id="1">
>             <description>LSN of gili near neighbors</description>
>           </model-output-type>
>           <model-output-type data-type="smiles" name="near neighbor
> structure" id="2">
>             <description>Structure of near neighbors</description>
>           </model-output-type>
>         </model-output-types>
>       </model>
>       <model active="true" provider="gili2" name="nn2" id="2">
>         <display-name>gili Near Neighbors 2</display-name>
>         <description>Find near neighbors in gili cpd
> collection</description>
>         <model-output-types>
>           <model-output-type data-type="integer" name="near neighbor Id"
> id="1">
>             <description>LSN of gili near neighbors</description>
>           </model-output-type>
>           <model-output-type data-type="smiles" name="near neighbor
> structure" id="2">
>             <description>Structure of gili near neighbors</description>
>           </model-output-type>
>         </model-output-types>
>       </model>
>     </ns2:models>
>   </soap:Body>
> </soap:Envelope>
> ==================== RESPONSE ENDS ====================
>
> So - making the issue more explicit if you take a look at the following
> soap response:
>     <ns2:models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>       <model active="true" provider="gili" name="nn" id="1">
>         <display-name>Near Neighbors</display-name>
>
> The models element is qualified with `ns2` while any other element is not!
> I want to get rid of this `ns2` qualifier.
>
> So the soap response I desire is :
> ==================== DESIRED RESPONSE ====================
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>   <soap:Body>
>     <models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>       <model active="true" provider="gili" name="nn" id="1">
>         <display-name>Near Neighbors</display-name>
>         <description>Find near neighbors in cpd collection</description>
>         <model-output-types>
>           <model-output-type data-type="integer" name="near neighborId"
> id="1">
>             <description>LSN of gili near neighbors</description>
>           </model-output-type>
>           <model-output-type data-type="smiles" name="near neighbor
> structure" id="2">
>             <description>Structure of near neighbors</description>
>           </model-output-type>
>         </model-output-types>
>       </model>
>       <model active="true" provider="gili2" name="nn2" id="2">
>         <display-name>gili Near Neighbors 2</display-name>
>         <description>Find near neighbors in gili cpd
> collection</description>
>         <model-output-types>
>           <model-output-type data-type="integer" name="near neighbor Id"
> id="1">
>             <description>LSN of gili near neighbors</description>
>           </model-output-type>
>           <model-output-type data-type="smiles" name="near neighbor
> structure" id="2">
>             <description>Structure of gili near neighbors</description>
>           </model-output-type>
>         </model-output-types>
>       </model>
>     </models>
>   </soap:Body>
> </soap:Envelope>
> ==================== DESIRED RESPONSE ENDS====================
>
> Thanks in advance.
> http://www.nabble.com/file/p24719842/cxf-request-response.txt
> cxf-request-response.txt

-- 
Daniel Kulp
dkulp@apache.org
http://www.dankulp.com/blog

Re: Namespace problem in webservice response

Posted by amit_9b <am...@yahoo.com>.
Hi Andrew,

That was a typo.
The desired response is : 

=====8<==== RESPONSE START =====8<====
 <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <models xmlns="http://prime.simplesoft.org/2009/xsd">
      <model active="true" provider="gili" name="nn" id="1">
        <display-name>Near Neighbors</display-name>
        <description>Find near neighbors in cpd collection</description>
        <model-output-types>
          <model-output-type data-type="integer" name="near neighborId"
id="1">
            <description>LSN of gili near neighbors</description>
          </model-output-type>
          <model-output-type data-type="smiles" name="near neighbor
structure" id="2">
            <description>Structure of near neighbors</description>
          </model-output-type>
        </model-output-types>
      </model>
      <model active="true" provider="gili2" name="nn2" id="2">
        <display-name>gili Near Neighbors 2</display-name>
        <description>Find near neighbors in gili cpd
collection</description>
        <model-output-types>
          <model-output-type data-type="integer" name="near neighbor Id"
id="1">
            <description>LSN of gili near neighbors</description>
          </model-output-type>
          <model-output-type data-type="smiles" name="near neighbor
structure" id="2">
            <description>Structure of gili near neighbors</description>
          </model-output-type>
        </model-output-types>
      </model>
    </models>
  </soap:Body>
 </soap:Envelope> 
======8<==== RESPONSE END =====8<=====

Any ideas ?

Thanks,
amit_9b





Andrew Clegg-2 wrote:
> 
> 2009/7/29 amit_9b <am...@yahoo.com>:
> 
>> So the soap response I desire is :
>> ==================== DESIRED RESPONSE ====================
>> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>>  <soap:Body>
>>    <models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>>      <model active="true" provider="gili" name="nn" id="1">
>>        <display-name>Near Neighbors</display-name>
>>        <description>Find near neighbors in cpd collection</description>
>>        <model-output-types>
>>          <model-output-type data-type="integer" name="near neighborId"
>> id="1">
>>            <description>LSN of gili near neighbors</description>
>>          </model-output-type>
>>          <model-output-type data-type="smiles" name="near neighbor
>> structure" id="2">
>>            <description>Structure of near neighbors</description>
>>          </model-output-type>
>>        </model-output-types>
>>      </model>
>>      <model active="true" provider="gili2" name="nn2" id="2">
>>        <display-name>gili Near Neighbors 2</display-name>
>>        <description>Find near neighbors in gili cpd
>> collection</description>
>>        <model-output-types>
>>          <model-output-type data-type="integer" name="near neighbor Id"
>> id="1">
>>            <description>LSN of gili near neighbors</description>
>>          </model-output-type>
>>          <model-output-type data-type="smiles" name="near neighbor
>> structure" id="2">
>>            <description>Structure of gili near neighbors</description>
>>          </model-output-type>
>>        </model-output-types>
>>      </model>
>>    </models>
>>  </soap:Body>
>> </soap:Envelope>
>> ==================== DESIRED RESPONSE ENDS====================
> 
> This doesn't make sense. You're declaring a namespace prefix 'ns2' and
> then never referring to it. Why would you want to do that?
> 
> Andrew.
> 
> -- 
> :: http://biotext.org.uk/ ::
> 
> 

-- 
View this message in context: http://www.nabble.com/Namespace-problem-in-webservice-response-tp24719842p24733101.html
Sent from the cxf-user mailing list archive at Nabble.com.


Re: Namespace problem in webservice response

Posted by Andrew Clegg <an...@nervechannel.com>.
2009/7/29 amit_9b <am...@yahoo.com>:

> So the soap response I desire is :
> ==================== DESIRED RESPONSE ====================
> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
>  <soap:Body>
>    <models xmlns:ns2="http://prime.simplesoft.org/2009/xsd">
>      <model active="true" provider="gili" name="nn" id="1">
>        <display-name>Near Neighbors</display-name>
>        <description>Find near neighbors in cpd collection</description>
>        <model-output-types>
>          <model-output-type data-type="integer" name="near neighborId"
> id="1">
>            <description>LSN of gili near neighbors</description>
>          </model-output-type>
>          <model-output-type data-type="smiles" name="near neighbor
> structure" id="2">
>            <description>Structure of near neighbors</description>
>          </model-output-type>
>        </model-output-types>
>      </model>
>      <model active="true" provider="gili2" name="nn2" id="2">
>        <display-name>gili Near Neighbors 2</display-name>
>        <description>Find near neighbors in gili cpd
> collection</description>
>        <model-output-types>
>          <model-output-type data-type="integer" name="near neighbor Id"
> id="1">
>            <description>LSN of gili near neighbors</description>
>          </model-output-type>
>          <model-output-type data-type="smiles" name="near neighbor
> structure" id="2">
>            <description>Structure of gili near neighbors</description>
>          </model-output-type>
>        </model-output-types>
>      </model>
>    </models>
>  </soap:Body>
> </soap:Envelope>
> ==================== DESIRED RESPONSE ENDS====================

This doesn't make sense. You're declaring a namespace prefix 'ns2' and
then never referring to it. Why would you want to do that?

Andrew.

-- 
:: http://biotext.org.uk/ ::