axis-c-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roshan Weerasuriya <ros...@opensource.lk>
Subject Re: SOAP Header manipulation & Handler API
Date Wed, 03 Mar 2004 11:55:18 GMT
hi,

The method which Paul suggest, of setting the parameters sounds good to me 
as well. Ok so as per what we have discussed, if the those 2 methods 
(either one of what Paul or Jean-Yves suggest)
1. float StockService::getLastSellPrice(xsd__string Value0, 
xsd__dateTime  HeaderValue0) or
2. stub._setProperty("XXX", YYY) option on the stub instead, and then they 
write a handler that extracts property XXX and sets it as a header
          are used to set the parameters to be passed, the current API is 
capable of constructing the soap message.

If I take Jean-Yves's example then the current API would work like this.

//----------------------------eg Client side code using current 
api--------------------------------
/*
  * This method wrap the service methodgetLastSellPrice
  */
float StockService::getLastSellPrice(xsd__string Value0,
     xsd__dateTime  HeaderValue0)
{
float Ret;
if (AXIS_SUCCESS != m_pCall->Initialize(CPP_DOC_PROVIDER)) return Ret;
m_pCall->SetTransportProperty(SOAPACTION_HEADER , "");
m_pCall->SetSOAPVersion(SOAP_VER_1_1);
m_pCall->SetOperation("getLastSellPrice", "http://soapheader.ibm.com");

//--------------------------Construction of the HEADER 
BLOCK---------------------------------------------------------------------

IHeaderBlock* pIHeaderBlock = m_pCall->createHeaderBlock("quote_timestamp", 
"ns1", "http://soapheader.ibm.com");
BasicNode* pBasicNode = pIHeaderBlock->createImmediateChild(ELEMENT_NODE, 
"date", "", "", "");
BasicNode* pBasicNode2 = pIHeaderBlock->createChild(CHARACTER_NODE, "", "", 
"", convertToCharPointer(HeaderValue0));
/*convertToCharPointer - HeaderValue0 is converted to a char* before... or 
some thing similar to :
BasicNode* pBasicNode2 = pIHeaderBlock->createChild(CHARACTER_NODE, "", "", 
"", (void*)&HeaderValue0, XSD_DATETIME);
*/
pBasicNode->addChild(pBasicNode2);

//--------------------------end of Construction of the HEADER 
BLOCK----------------------------------------------------------------------

m_pCall->AddParameter((void*)&Value0, "ticker", XSD_STRING);
....................
}
//----------------------------end of eg Client side code using current 
api--------------------------

There fore in my opinion, what we have to figure out is how to set this 
parameter HeaderValue0. Whether we are going to set it as :
1. float StockService::getLastSellPrice(xsd__string Value0, 
xsd__dateTime  HeaderValue0) or
2. stub._setProperty("XXX", YYY) option on the stub instead, and then they 
write a handler that extracts property XXX and sets it as a header
3. or ..........

And the current API is capable of creating the SOAP HEADER once it has 
access to the above set parameters.

Your comments on this discussion is highly appreciated.

rgds,
roshan

At 06:02 PM 3/2/2004 +0000, you wrote:
>Jean-Yves
>
>The only problem with this approach is that the headers are not part of 
>the business logic interface in the WSDL, but they end up as part of it in 
>the Java/C.
>
>Ideally, we would have another way of describing headers. Sanjiva 
>Weerawarana made a proposal of such a model to the WSDL working group last 
>year, and there are some ideas that have been discussed there as well. 
>Another approach might be to define a WS-Policy extension. A number of 
>customers use the stub._setProperty("XXX", YYY) option on the JAX-RPC stub 
>instead, and then they write a handler that extracts property XXX and sets 
>it as a header. I know - it sounds like more work! However, it does give a 
>clearer interface between the body and the headers.
>
>Paul
>
>Jean-Yves Baudy wrote:
>
>>Hi Roshan
>>
>>For a good understanding of what I want to explain look at this URL.
>>
>>http://www-106.ibm.com/developerworks/webservices/library/ws-tipjax1.html#IDAHACIC

>>
>>
>>In the WSDL sample in the binding section (in bold) we say that the 
>>request_header part must be send in the header section. So the SOAP 
>>request must look like this (an example):
>>
>><?xml version='1.0' encoding='utf-8' ?>
>>    <SOAP-ENV:Envelope ...>
>>       <SOAP-ENV:Header>
>>          <ns1:quote_timestamp xmlns:ns1="http://soapheader.ibm.com">
>>             <date>2004-03-02T18:22:52Z</date>
>>          </ns1:quote_timestamp>
>>       </SOAP-ENV:Header>
>>       <SOAP-ENV:Body>
>>          <ns1:getLastSellPrice xmlns:ns1="http://soapheader.ibm.com">
>>             <ticker>Token</ticker>
>>          </ns1:getLastSellPrice>
>>       </SOAP-ENV:Body>
>>    </SOAP-ENV:Envelope>
>>
>>What I want to say is that I didn't find a way in the current CVS code to 
>>deal with this. I propose to define a specific HeaderBlock and it could 
>>be initiated like this :
>>
>>
>>/*
>>  * This method wrap the service methodgetLastSellPrice
>>  */
>>float StockService::getLastSellPrice(xsd__string Value0,
>>     xsd__dateTime  HeaderValue0)
>>{
>>float Ret;
>>if (AXIS_SUCCESS != m_pCall->Initialize(CPP_DOC_PROVIDER)) return Ret;
>>m_pCall->SetTransportProperty(SOAPACTION_HEADER , "");
>>m_pCall->SetSOAPVersion(SOAP_VER_1_1);
>>m_pCall->SetOperation("getLastSellPrice", "http://soapheader.ibm.com");
>>
>>/* Serialize the quote_timestamp here */
>>HeaderParamBlock* pParamHeaderBlock =
>>   (HeaderParamBlock*)m_pCall->
>>     createHeaderParamBlock("quote_timestamp", "",
>>"http://soapheader.ibm.com");
>>pParamHeaderBlock->
>>  AddParameter((void*)&HeaderValue0, "date", XSD_DATETIME);
>>
>>m_pCall->AddParameter((void*)&Value0, "ticker", XSD_STRING);
>>...
>>}
>>
>>But in that case we need to duplicate the API of the Call.h interface in 
>>this class. So I suggest to look for another design but my time is very 
>>limited.
>>
>>Regards,
>>
>>Jean-Yves
>>
>>
>> >hi Jean-Yves,
>> >
>> > >But I didn't find any APIs for passing or receiving parameters 
>> from >this WSDL binding file
>> >
>> >Can you just explain a bit more this scenario. i.e What you mean 
>> here, >with little bit detail.
>> >Currently I am trying to figure out what you mean exactly. So your 
>> help >to clarify this issue a bit more is greatly appreciated.
>> >
>> >rgds,
>> >roshan
>




Mime
View raw message