You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by Christian Kloner <kl...@par.univie.ac.at> on 2006/07/17 10:05:14 UTC

[Axis2] ServiceClient should provide Namespace declaration

hi,

I know you can use the OperationClient to get access to the underlying 
SOAPEnvelope such that you can create it and have access to it on your own.
But I find the ServiceClient more convenient because all the Envelope 
creation is done behind the curtain.  But now, I am missing a method 
like "declareNamespace(OMNamespace, Type)" where Type is an enum of 
HEADER, BODY or ENVELOPE. Because if you look at the following message 
fragment, you will see, that the header contains a WebServiceAddress 
where for each element the wsa namespace is repeated. I think the only 
possibility to avoid this is to add a method which does the declaration 
to the Header OMElement. Is this right? Or should there be reasons why 
such methods should not be there?

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Header>
<wsa:MessageID 
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
soapenv:mustUnderstand="0">urn:uuid:E866B6CA2E6142C24C11531204167313</wsa:MessageID>
<wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
soapenv:mustUnderstand="0">http://127.0.1.1:8080/wsrf/services/gridminer/TestService</wsa:To>
<wsa:From xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
soapenv:mustUnderstand="0">
<wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
</wsa:From>
<wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
soapenv:mustUnderstand="0">http://testservice.gridminer.org/TestPortType/getAttribute</wsa:Action>
<ns1:TestResourceKey xmlns:ns1="http://keys.ae.gridminer.org/keys" 
soapenv:mustUnderstand="0">23743079</ns1:TestResourceKey>
</soapenv:Header>

If it should not be there, is there a possiblity to make the method 
"fillSoapEnvelope(MessageContext, OMElement)" protected or to use 
default scope? Because then i will simple extend ServiceClient and 
override the method.
thank you.

Christian

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [Axis2] ServiceClient should provide Namespace declaration

Posted by Christian Kloner <kl...@par.univie.ac.at>.
sry. but default scope is of corse not possible for "fillSoapEnvelope" 
and all the variables which are used in the method must then be protected.

So I think declareNamespace(...) would be fine. :) The enum class can 
for example be named "NamespaceScope".

Christian

Christian Kloner wrote:
> hi,
> 
> I know you can use the OperationClient to get access to the underlying 
> SOAPEnvelope such that you can create it and have access to it on your own.
> But I find the ServiceClient more convenient because all the Envelope 
> creation is done behind the curtain.  But now, I am missing a method 
> like "declareNamespace(OMNamespace, Type)" where Type is an enum of 
> HEADER, BODY or ENVELOPE. Because if you look at the following message 
> fragment, you will see, that the header contains a WebServiceAddress 
> where for each element the wsa namespace is repeated. I think the only 
> possibility to avoid this is to add a method which does the declaration 
> to the Header OMElement. Is this right? Or should there be reasons why 
> such methods should not be there?
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope 
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header>
> <wsa:MessageID 
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
> soapenv:mustUnderstand="0">urn:uuid:E866B6CA2E6142C24C11531204167313</wsa:MessageID> 
> 
> <wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
> soapenv:mustUnderstand="0">http://127.0.1.1:8080/wsrf/services/gridminer/TestService</wsa:To> 
> 
> <wsa:From xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
> soapenv:mustUnderstand="0">
> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address> 
> 
> </wsa:From>
> <wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing" 
> soapenv:mustUnderstand="0">http://testservice.gridminer.org/TestPortType/getAttribute</wsa:Action> 
> 
> <ns1:TestResourceKey xmlns:ns1="http://keys.ae.gridminer.org/keys" 
> soapenv:mustUnderstand="0">23743079</ns1:TestResourceKey>
> </soapenv:Header>
> 
> If it should not be there, is there a possiblity to make the method 
> "fillSoapEnvelope(MessageContext, OMElement)" protected or to use 
> default scope? Because then i will simple extend ServiceClient and 
> override the method.
> thank you.
> 
> Christian
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [Axis2] ServiceClient should provide Namespace declaration

Posted by Christian Kloner <kl...@par.univie.ac.at>.
hi Eran,

thank you very much. :) So I took the ServiceClient code with a clear 
conscience and modified it to my needs.

Christian


Eran Chinthaka wrote:
> Hi Christian,
> 
> The ServiceClient is carefully designed abstraction of the client API
> which provides easy and simple API. So don't expect each and every
> convenience method from ServiceClient. If you wanna do all sorts of
> flexible things, then please use OperationClient.
> 
> -- Chinthaka
> 
> Christian Kloner wrote:
>> hi,
>>
>> I know you can use the OperationClient to get access to the underlying
>> SOAPEnvelope such that you can create it and have access to it on your own.
>> But I find the ServiceClient more convenient because all the Envelope
>> creation is done behind the curtain.  But now, I am missing a method
>> like "declareNamespace(OMNamespace, Type)" where Type is an enum of
>> HEADER, BODY or ENVELOPE. Because if you look at the following message
>> fragment, you will see, that the header contains a WebServiceAddress
>> where for each element the wsa namespace is repeated. I think the only
>> possibility to avoid this is to add a method which does the declaration
>> to the Header OMElement. Is this right? Or should there be reasons why
>> such methods should not be there?
>>
>> <?xml version='1.0' encoding='UTF-8'?>
>> <soapenv:Envelope
>> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
>> <soapenv:Header>
>> <wsa:MessageID
>> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
>> soapenv:mustUnderstand="0">urn:uuid:E866B6CA2E6142C24C11531204167313</wsa:MessageID>
>>
>> <wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
>> soapenv:mustUnderstand="0">http://127.0.1.1:8080/wsrf/services/gridminer/TestService</wsa:To>
>>
>> <wsa:From xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
>> soapenv:mustUnderstand="0">
>> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
>>
>> </wsa:From>
>> <wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
>> soapenv:mustUnderstand="0">http://testservice.gridminer.org/TestPortType/getAttribute</wsa:Action>
>>
>> <ns1:TestResourceKey xmlns:ns1="http://keys.ae.gridminer.org/keys"
>> soapenv:mustUnderstand="0">23743079</ns1:TestResourceKey>
>> </soapenv:Header>
>>
>> If it should not be there, is there a possiblity to make the method
>> "fillSoapEnvelope(MessageContext, OMElement)" protected or to use
>> default scope? Because then i will simple extend ServiceClient and
>> override the method.
>> thank you.
>>
>> Christian
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
>> For additional commands, e-mail: axis-dev-help@ws.apache.org
>>
>>
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-dev-help@ws.apache.org


Re: [Axis2] ServiceClient should provide Namespace declaration

Posted by Eran Chinthaka <ch...@opensource.lk>.
Hi Christian,

The ServiceClient is carefully designed abstraction of the client API
which provides easy and simple API. So don't expect each and every
convenience method from ServiceClient. If you wanna do all sorts of
flexible things, then please use OperationClient.

-- Chinthaka

Christian Kloner wrote:
> hi,
> 
> I know you can use the OperationClient to get access to the underlying
> SOAPEnvelope such that you can create it and have access to it on your own.
> But I find the ServiceClient more convenient because all the Envelope
> creation is done behind the curtain.  But now, I am missing a method
> like "declareNamespace(OMNamespace, Type)" where Type is an enum of
> HEADER, BODY or ENVELOPE. Because if you look at the following message
> fragment, you will see, that the header contains a WebServiceAddress
> where for each element the wsa namespace is repeated. I think the only
> possibility to avoid this is to add a method which does the declaration
> to the Header OMElement. Is this right? Or should there be reasons why
> such methods should not be there?
> 
> <?xml version='1.0' encoding='UTF-8'?>
> <soapenv:Envelope
> xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
> <soapenv:Header>
> <wsa:MessageID
> xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
> soapenv:mustUnderstand="0">urn:uuid:E866B6CA2E6142C24C11531204167313</wsa:MessageID>
> 
> <wsa:To xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
> soapenv:mustUnderstand="0">http://127.0.1.1:8080/wsrf/services/gridminer/TestService</wsa:To>
> 
> <wsa:From xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
> soapenv:mustUnderstand="0">
> <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
> 
> </wsa:From>
> <wsa:Action xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/03/addressing"
> soapenv:mustUnderstand="0">http://testservice.gridminer.org/TestPortType/getAttribute</wsa:Action>
> 
> <ns1:TestResourceKey xmlns:ns1="http://keys.ae.gridminer.org/keys"
> soapenv:mustUnderstand="0">23743079</ns1:TestResourceKey>
> </soapenv:Header>
> 
> If it should not be there, is there a possiblity to make the method
> "fillSoapEnvelope(MessageContext, OMElement)" protected or to use
> default scope? Because then i will simple extend ServiceClient and
> override the method.
> thank you.
> 
> Christian
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-dev-help@ws.apache.org
> 
>