You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by angeloNZ <an...@nz.fujitsu.com> on 2009/06/09 14:47:06 UTC

Question on missing namespace prefix on wsdl-first example response body

Hi,

I observed from running the wsdl-first example that the <GetPersonResponse>
element contains a default namespace declaration and not a prefix.  I'm
comparing this with the request body that gets generated by soapUI where the
<GetPerson> element contains a "wsdl" namespace prefix:

request generated by soapUI:  

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
   <soap:Header/>
   <soap:Body>
      <wsdl:GetPerson>
         <wsdl:personId>?</wsdl:personId>
      </wsdl:GetPerson>
   </soap:Body>
</soap:Envelope>

response generated by soapUI:  GetPersonResponse contains a default
namespace instead of a xmlns:wsdl="" declaration.

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
   <soap:Body>
      <GetPersonResponse
xmlns="http://servicemix.apache.org/samples/wsdl-first">
         <personId
xmlns="http://servicemix.apache.org/samples/wsdl-first/types">?</personId>
         <ssn
xmlns="http://servicemix.apache.org/samples/wsdl-first/types">000-000-0000</ssn>
         <name
xmlns="http://servicemix.apache.org/samples/wsdl-first/types">Guillaume</name>
      </GetPersonResponse>
   </soap:Body>
</soap:Envelope>

I saw that the wsdl is doc/literal and that both GetPerson and
GetPersonResponse is defined in the same schema definition where they share
the same targetNamespace so I'm assuming that the response element will also
contain the "wsdl" prefix.  Is this response standard behavior for doc/lit
web services or is it just ServiceMix?  

I also have another doc/lit web service in ServiceMix that has the same
response format.  Is there a way to get a response where I will get the
namespace prefix?  The default namespace is causing problems for me because
I'm running xpath queries on the soap response and xpath returns null for
default namespace declarations.  

Is there a particular way of editing the wsdl for what I want?  If you could
also point me to what particular ServiceMix class I can extend to achieve my
goal would be appreciated.
-- 
View this message in context: http://www.nabble.com/Question-on-missing-namespace-prefix-on-wsdl-first-example-response-body-tp23942162p23942162.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Question on missing namespace prefix on wsdl-first example response body

Posted by Freeman Fang <fr...@gmail.com>.
angeloNZ wrote:
> Hi,
>
> I was testing the http wsdl-first example that comes with SM 3.3.  To
> clarify my question, why doesn't the <GetPersonResponse> element of the soap
> response contain a namespace prefix and only comes with a default namespace?
>
> here is an except from the response body:
> <GetPersonResponse xmlns="http://servicemix.apache.org/samples/wsdl-first">
>    ....
> </GetPersonResponse>
>
> what I was expecting is: (notice the "wsdl" prefix).
> <wsdl:GetPersonResponse
> xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
>    ....
> </wsdl:GetPersonResponse>
>
> I'm comparing this with the request body that soapUI generated for me based
> on the wsdl where the <GetPerson> element comes prefixed with a namespace:
>
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>  xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
>     <soap:Header/>
>     <soap:Body>
>        <wsdl:GetPerson>
>           <wsdl:personId>?</wsdl:personId>
>        </wsdl:GetPerson>
>     </soap:Body>
> </soap:Envelope>
>
> This brings me to my question why the <GetPersonResponse> is not prefixed
> with the "wsdl" namespace in the response considering both the GetPerson and
> GetPersonResponse element in the wsdl has the same targetNamespace.
>
>   
> excerpt from person.wsdl:
> <xsd:schema
> targetNamespace="http://servicemix.apache.org/samples/wsdl-first/types"
> 		            elementFormDefault="qualified">
> 			<xsd:element name="GetPerson">
> 			  <xsd:complexType>
> 					<xsd:sequence>
> 						<xsd:element name="personId" type="xsd:string"/>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> 			<xsd:element name="GetPersonResponse">
> 			  <xsd:complexType>
> 					<xsd:sequence>
> 					    <xsd:element name="personId" type="xsd:string"/>
> 						<xsd:element name="ssn" type="xsd:string"/>
> 						<xsd:element name="name" type="xsd:string"/>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> 			<xsd:element name="UnknownPersonFault">
> 			  <xsd:complexType>
> 					<xsd:sequence>
> 					    <xsd:element name="personId" type="xsd:string"/>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> 		</xsd:schema>
>
> Is this response behavior standard for webservices with doc/lit wsdl?  I
> hope this clarifies my question.
>   
I believe this has nothing to do with doc/lit webservice, it's just 
caused by the stax api used underlying and I'm not sure we can control 
the namespace format here,
Anyway,
both
<GetPersonResponse xmlns="http://servicemix.apache.org/samples/wsdl-first">
 ....
</GetPersonResponse>

and
<wsdl:GetPersonResponse 
xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first"> ....
</wsdl:GetPersonResponse>
is valid here, so shouldn't it be a xpath problem since it can't handle 
the valid xml?

Freeman
>
>
> Freeman Fang wrote:
>   
>> angeloNZ wrote:
>>     
>>> Hi,
>>>
>>> I observed from running the wsdl-first example that the
>>> <GetPersonResponse>
>>> element contains a default namespace declaration and not a prefix.  I'm
>>> comparing this with the request body that gets generated by soapUI where
>>> the
>>> <GetPerson> element contains a "wsdl" namespace prefix:
>>>
>>> request generated by soapUI:  
>>>
>>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>>> xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
>>>    <soap:Header/>
>>>    <soap:Body>
>>>       <wsdl:GetPerson>
>>>          <wsdl:personId>?</wsdl:personId>
>>>       </wsdl:GetPerson>
>>>    </soap:Body>
>>> </soap:Envelope>
>>>
>>> response generated by soapUI:  GetPersonResponse contains a default
>>> namespace instead of a xmlns:wsdl="" declaration.
>>>
>>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
>>>    <soap:Body>
>>>       <GetPersonResponse
>>> xmlns="http://servicemix.apache.org/samples/wsdl-first">
>>>          <personId
>>> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">?</personId>
>>>          <ssn
>>> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">000-000-0000</ssn>
>>>          <name
>>> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">Guillaume</name>
>>>       </GetPersonResponse>
>>>    </soap:Body>
>>> </soap:Envelope>
>>>
>>> I saw that the wsdl is doc/literal and that both GetPerson and
>>> GetPersonResponse is defined in the same schema definition where they
>>> share
>>> the same targetNamespace so I'm assuming that the response element will
>>> also
>>> contain the "wsdl" prefix.  Is this response standard behavior for
>>> doc/lit
>>> web services or is it just ServiceMix?  
>>>
>>> I also have another doc/lit web service in ServiceMix that has the same
>>> response format.  Is there a way to get a response where I will get the
>>> namespace prefix?  The default namespace is causing problems for me
>>> because
>>> I'm running xpath queries on the soap response and xpath returns null for
>>> default namespace declarations.  
>>>
>>> Is there a particular way of editing the wsdl for what I want?  If you
>>> could
>>> also point me to what particular ServiceMix class I can extend to achieve
>>> my
>>> goal would be appreciated.
>>>   
>>>       
>> You are using wsdl-first or cxf-wsdl-first?
>> Sorry, I'm confused with your question, what kind of response are you 
>> expected?
>>
>> And go back to your question
>>
>> Is there a particular way of editing the wsdl for what I want? 
>>
>> No, I don't think so.  Actually how is the xml message looks like is 
>> controlled by the xml processor api the component used underlying, for 
>> smx-cxf, it's stax implementation  wstx-asl.
>> Freeman
>>
>>
>> -- 
>> Freeman Fang
>> ------------------------
>> Open Source SOA: http://fusesource.com
>>
>>
>>
>>     
>
>   


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com


Re: Question on missing namespace prefix on wsdl-first example response body

Posted by angeloNZ <an...@nz.fujitsu.com>.
Hi,

I was testing the http wsdl-first example that comes with SM 3.3.  To
clarify my question, why doesn't the <GetPersonResponse> element of the soap
response contain a namespace prefix and only comes with a default namespace?

here is an except from the response body:
<GetPersonResponse xmlns="http://servicemix.apache.org/samples/wsdl-first">
   ....
</GetPersonResponse>

what I was expecting is: (notice the "wsdl" prefix).
<wsdl:GetPersonResponse
xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
   ....
</wsdl:GetPersonResponse>

I'm comparing this with the request body that soapUI generated for me based
on the wsdl where the <GetPerson> element comes prefixed with a namespace:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
 xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
    <soap:Header/>
    <soap:Body>
       <wsdl:GetPerson>
          <wsdl:personId>?</wsdl:personId>
       </wsdl:GetPerson>
    </soap:Body>
</soap:Envelope>

This brings me to my question why the <GetPersonResponse> is not prefixed
with the "wsdl" namespace in the response considering both the GetPerson and
GetPersonResponse element in the wsdl has the same targetNamespace.

excerpt from person.wsdl:
<xsd:schema
targetNamespace="http://servicemix.apache.org/samples/wsdl-first/types"
		            elementFormDefault="qualified">
			<xsd:element name="GetPerson">
			  <xsd:complexType>
					<xsd:sequence>
						<xsd:element name="personId" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="GetPersonResponse">
			  <xsd:complexType>
					<xsd:sequence>
					    <xsd:element name="personId" type="xsd:string"/>
						<xsd:element name="ssn" type="xsd:string"/>
						<xsd:element name="name" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
			<xsd:element name="UnknownPersonFault">
			  <xsd:complexType>
					<xsd:sequence>
					    <xsd:element name="personId" type="xsd:string"/>
					</xsd:sequence>
				</xsd:complexType>
			</xsd:element>
		</xsd:schema>

Is this response behavior standard for webservices with doc/lit wsdl?  I
hope this clarifies my question.



Freeman Fang wrote:
> 
> angeloNZ wrote:
>> Hi,
>>
>> I observed from running the wsdl-first example that the
>> <GetPersonResponse>
>> element contains a default namespace declaration and not a prefix.  I'm
>> comparing this with the request body that gets generated by soapUI where
>> the
>> <GetPerson> element contains a "wsdl" namespace prefix:
>>
>> request generated by soapUI:  
>>
>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
>> xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
>>    <soap:Header/>
>>    <soap:Body>
>>       <wsdl:GetPerson>
>>          <wsdl:personId>?</wsdl:personId>
>>       </wsdl:GetPerson>
>>    </soap:Body>
>> </soap:Envelope>
>>
>> response generated by soapUI:  GetPersonResponse contains a default
>> namespace instead of a xmlns:wsdl="" declaration.
>>
>> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
>>    <soap:Body>
>>       <GetPersonResponse
>> xmlns="http://servicemix.apache.org/samples/wsdl-first">
>>          <personId
>> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">?</personId>
>>          <ssn
>> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">000-000-0000</ssn>
>>          <name
>> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">Guillaume</name>
>>       </GetPersonResponse>
>>    </soap:Body>
>> </soap:Envelope>
>>
>> I saw that the wsdl is doc/literal and that both GetPerson and
>> GetPersonResponse is defined in the same schema definition where they
>> share
>> the same targetNamespace so I'm assuming that the response element will
>> also
>> contain the "wsdl" prefix.  Is this response standard behavior for
>> doc/lit
>> web services or is it just ServiceMix?  
>>
>> I also have another doc/lit web service in ServiceMix that has the same
>> response format.  Is there a way to get a response where I will get the
>> namespace prefix?  The default namespace is causing problems for me
>> because
>> I'm running xpath queries on the soap response and xpath returns null for
>> default namespace declarations.  
>>
>> Is there a particular way of editing the wsdl for what I want?  If you
>> could
>> also point me to what particular ServiceMix class I can extend to achieve
>> my
>> goal would be appreciated.
>>   
> You are using wsdl-first or cxf-wsdl-first?
> Sorry, I'm confused with your question, what kind of response are you 
> expected?
> 
> And go back to your question
> 
> Is there a particular way of editing the wsdl for what I want? 
> 
> No, I don't think so.  Actually how is the xml message looks like is 
> controlled by the xml processor api the component used underlying, for 
> smx-cxf, it's stax implementation  wstx-asl.
> Freeman
> 
> 
> -- 
> Freeman Fang
> ------------------------
> Open Source SOA: http://fusesource.com
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Question-on-missing-namespace-prefix-on-wsdl-first-example-response-body-tp23942162p23955226.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.


Re: Question on missing namespace prefix on wsdl-first example response body

Posted by Freeman Fang <fr...@gmail.com>.
angeloNZ wrote:
> Hi,
>
> I observed from running the wsdl-first example that the <GetPersonResponse>
> element contains a default namespace declaration and not a prefix.  I'm
> comparing this with the request body that gets generated by soapUI where the
> <GetPerson> element contains a "wsdl" namespace prefix:
>
> request generated by soapUI:  
>
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
> xmlns:wsdl="http://servicemix.apache.org/samples/wsdl-first">
>    <soap:Header/>
>    <soap:Body>
>       <wsdl:GetPerson>
>          <wsdl:personId>?</wsdl:personId>
>       </wsdl:GetPerson>
>    </soap:Body>
> </soap:Envelope>
>
> response generated by soapUI:  GetPersonResponse contains a default
> namespace instead of a xmlns:wsdl="" declaration.
>
> <soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
>    <soap:Body>
>       <GetPersonResponse
> xmlns="http://servicemix.apache.org/samples/wsdl-first">
>          <personId
> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">?</personId>
>          <ssn
> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">000-000-0000</ssn>
>          <name
> xmlns="http://servicemix.apache.org/samples/wsdl-first/types">Guillaume</name>
>       </GetPersonResponse>
>    </soap:Body>
> </soap:Envelope>
>
> I saw that the wsdl is doc/literal and that both GetPerson and
> GetPersonResponse is defined in the same schema definition where they share
> the same targetNamespace so I'm assuming that the response element will also
> contain the "wsdl" prefix.  Is this response standard behavior for doc/lit
> web services or is it just ServiceMix?  
>
> I also have another doc/lit web service in ServiceMix that has the same
> response format.  Is there a way to get a response where I will get the
> namespace prefix?  The default namespace is causing problems for me because
> I'm running xpath queries on the soap response and xpath returns null for
> default namespace declarations.  
>
> Is there a particular way of editing the wsdl for what I want?  If you could
> also point me to what particular ServiceMix class I can extend to achieve my
> goal would be appreciated.
>   
You are using wsdl-first or cxf-wsdl-first?
Sorry, I'm confused with your question, what kind of response are you 
expected?

And go back to your question

Is there a particular way of editing the wsdl for what I want? 

No, I don't think so.  Actually how is the xml message looks like is 
controlled by the xml processor api the component used underlying, for 
smx-cxf, it's stax implementation  wstx-asl.
Freeman


-- 
Freeman Fang
------------------------
Open Source SOA: http://fusesource.com