You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-user@axis.apache.org by Subra A Narayanan <as...@gmail.com> on 2007/08/13 02:32:44 UTC

Axiom Questions

Hello everyone,

Its Monday morning and I am back with my questions. :-)

Not sure if these questions belong here but will ask anyways. Please let me
know if I should be sending this mail to some other mailing list.

I am using Axis2 and have 2 basic questions about Axiom. I did some
searching on the web and tried looking through the Axis2/C source code but
don't have my answer. Here it goes:

Q1) I have a web service with 4 operations. The first 3 parameters are the
same for all the 4 operations. In other words, the first 3 child elements
inside the <SoapBody><Operation Name></Operation Name></SoapBody> are the
same for the 4 operations. So I created a function, called ReadFirst3Params
which gets called from all the 4 operations. Since, Axiom is based on a pull
parser, I know I have to have a reference to the 3rd parameter node to be
able to read the 4th parameter. Now my question is, do I need to return a
reference to the 3rd parameter node from my ReadFirst3Params function so
that I can continue reading the other params in the operation. Or is there
any other way of doing this. For e.g. an internal pointer that Axiom
maintains which will tell me the position with in the XML document. (I hope
my question makes sense)

Q2) One of the operation returns an attachment to the client as an mtom
attachment. I use axiom_data_handler_create to read in the binary file. I
have a requirement to be able to read in a part of the file rather than the
whole file. Just like pread function in 'C' where I can specify an offset
and the file is read from the beginning to the offset. Is there a function
in axiom to be able to do that? If not, how do I solve the above problem?


Thanks again for ur help!


Subra

Re: Axiom Questions

Posted by Subra A Narayanan <as...@gmail.com>.
I think thats what I was looking for. I will try it out and let you know.

Thanks!!

On 8/13/07, Kaushalye Kapuruge <ka...@wso2.com> wrote:
>
> Subra A Narayanan wrote:
> > Hey Samisa,
> >
> > With regards to my second question:
> >
> > I am not talking about reading part of the attachment. What I am
> > asking is can I read part of the file from the disk and attach it to
> > the message? 'axiom_data_handler_create' takes in a file name but no
> > offset. I can read a part of the file using pread, but but do I
> > convert the void *buff in to a data handler?
> Have you tried this?
> axiom_data_handler_set_binary_data(data_handler, env, ip_stream, len);
> First of all you'll have to keep you data(i.e. ip_stream) using
> axis2_byte_t*.
>
> Cheers,
> Kaushalye
> >
> > Subra
> >
> > On 8/13/07, *Samisa Abeysinghe* <samisa@wso2.com
> > <ma...@wso2.com>> wrote:
> >
> >     Subra A Narayanan wrote:
> >     > Hello everyone,
> >     >
> >     > Its Monday morning and I am back with my questions. :-)
> >     >
> >     > Not sure if these questions belong here but will ask anyways.
> Please
> >     > let me know if I should be sending this mail to some other
> >     mailing list.
> >     >
> >     > I am using Axis2 and have 2 basic questions about Axiom. I did
> some
> >     > searching on the web and tried looking through the Axis2/C
> >     source code
> >     > but don't have my answer. Here it goes:
> >     >
> >     > Q1) I have a web service with 4 operations. The first 3
> >     parameters are
> >     > the same for all the 4 operations. In other words, the first 3
> child
> >     > elements inside the <SoapBody><Operation Name></Operation
> >     > Name></SoapBody> are the same for the 4 operations. So I created a
> >     > function, called ReadFirst3Params which gets called from all the 4
> >     > operations. Since, Axiom is based on a pull parser, I know I
> >     have to
> >     > have a reference to the 3rd parameter node to be able to read
> >     the 4th
> >     > parameter. Now my question is, do I need to return a reference
> >     to the
> >     > 3rd parameter node from my ReadFirst3Params function so that I can
> >     > continue reading the other params in the operation.
> >     Not really, one can read the rest of the OM tree the way they want,
> as
> >     an example, using the qname (see
> >     axiom_element_get_children_with_qname).
> >
> >     > Or is there any other way of doing this. For e.g. an internal
> >     pointer
> >     > that Axiom maintains which will tell me the position with in the
> XML
> >     > document. (I hope my question makes sense)
> >     >
> >     > Q2) One of the operation returns an attachment to the client as an
> >     > mtom attachment. I use axiom_data_handler_create to read in the
> >     binary
> >     > file. I have a requirement to be able to read in a part of the
> file
> >     > rather than the whole file. Just like pread function in 'C' where
> I
> >     > can specify an offset and the file is read from the beginning to
> the
> >     > offset. Is there a function in axiom to be able to do that? If
> not,
> >     > how do I solve the above problem?
> >     We do not have provision to read part of the attachment as of now.
> Is
> >     there any way you can break the attachment to multiple parts and
> send
> >     that in the SOAP message. If you can do that, then you can read
> >     only the
> >     first attachment and forget about the rest and pass it on, I hope.
> >
> >     Samisa...
> >     >
> >     >
> >     > Thanks again for ur help!
> >     >
> >     >
> >     > Subra
> >     >
> >     >
> >     >
> >
> >
> >     --
> >     Samisa Abeysinghe : WSO2 WSF/C
> >     "
> >
> http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services
> >     <
> http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services
> >"
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
>
>
> --
> http://kaushalye.blogspot.com/
> http://wso2.org/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: Axiom Questions

Posted by Subra A Narayanan <as...@gmail.com>.
Dumindu,

Thanks for the reply! I am going to try it out for myself but just wanted to
make sure that this was a no issue :-)

Thanks again!

Subra

On 8/14/07, Dumindu Pallewela <du...@wso2.com> wrote:
>
> Subra A Narayanan wrote:
> > Hey Kaushalye,
> >
> > I noticed that ip_stream is of type axis2_byte_t. Looking at the
> > definition of axis2_byte_t in axutil_utils_defines.h, I realized that it
> > is nothing but a char. I am wondering if I read a part of a binary file
> > from disk using pread and store the read data in void *buffer and then
> > type cast the buffer in to a axis2_byte_t, if that will cause a problem?
>
> It should not. Because you give the length of the buffer alongside the
> buffer itself. FYI, the axiom_data_handler_set_binary_data function
> signature is as follows:
>
> axiom_data_handler_set_binary_data(
>      axiom_data_handler_t *data_handler,
>      const axutil_env_t *env,
>      axis2_byte_t* input_stream,
>      int input_stream_len)
>
>
> BTW, you could try this out and see for yourself ;)
>
> -Dumindu.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: Axiom Questions

Posted by Dumindu Pallewela <du...@wso2.com>.
Subra A Narayanan wrote:
> Hey Kaushalye,
> 
> I noticed that ip_stream is of type axis2_byte_t. Looking at the 
> definition of axis2_byte_t in axutil_utils_defines.h, I realized that it 
> is nothing but a char. I am wondering if I read a part of a binary file 
> from disk using pread and store the read data in void *buffer and then 
> type cast the buffer in to a axis2_byte_t, if that will cause a problem?

It should not. Because you give the length of the buffer alongside the 
buffer itself. FYI, the axiom_data_handler_set_binary_data function 
signature is as follows:

axiom_data_handler_set_binary_data(
     axiom_data_handler_t *data_handler,
     const axutil_env_t *env,
     axis2_byte_t* input_stream,
     int input_stream_len)


BTW, you could try this out and see for yourself ;)

-Dumindu.

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


Re: Axiom Questions

Posted by Subra A Narayanan <as...@gmail.com>.
Hey Kaushalye,

I noticed that ip_stream is of type axis2_byte_t. Looking at the definition
of axis2_byte_t in axutil_utils_defines.h, I realized that it is nothing but
a char. I am wondering if I read a part of a binary file from disk using
pread and store the read data in void *buffer and then type cast the buffer
in to a axis2_byte_t, if that will cause a problem?

Does my question make sense?

TIA
Subra

On 8/13/07, Kaushalye Kapuruge <ka...@wso2.com> wrote:
>
> Subra A Narayanan wrote:
> > Hey Samisa,
> >
> > With regards to my second question:
> >
> > I am not talking about reading part of the attachment. What I am
> > asking is can I read part of the file from the disk and attach it to
> > the message? 'axiom_data_handler_create' takes in a file name but no
> > offset. I can read a part of the file using pread, but but do I
> > convert the void *buff in to a data handler?
> Have you tried this?
> axiom_data_handler_set_binary_data(data_handler, env, ip_stream, len);
> First of all you'll have to keep you data(i.e. ip_stream) using
> axis2_byte_t*.
>
> Cheers,
> Kaushalye
> >
> > Subra
> >
> > On 8/13/07, *Samisa Abeysinghe* <samisa@wso2.com
> > <ma...@wso2.com>> wrote:
> >
> >     Subra A Narayanan wrote:
> >     > Hello everyone,
> >     >
> >     > Its Monday morning and I am back with my questions. :-)
> >     >
> >     > Not sure if these questions belong here but will ask anyways.
> Please
> >     > let me know if I should be sending this mail to some other
> >     mailing list.
> >     >
> >     > I am using Axis2 and have 2 basic questions about Axiom. I did
> some
> >     > searching on the web and tried looking through the Axis2/C
> >     source code
> >     > but don't have my answer. Here it goes:
> >     >
> >     > Q1) I have a web service with 4 operations. The first 3
> >     parameters are
> >     > the same for all the 4 operations. In other words, the first 3
> child
> >     > elements inside the <SoapBody><Operation Name></Operation
> >     > Name></SoapBody> are the same for the 4 operations. So I created a
> >     > function, called ReadFirst3Params which gets called from all the 4
>
> >     > operations. Since, Axiom is based on a pull parser, I know I
> >     have to
> >     > have a reference to the 3rd parameter node to be able to read
> >     the 4th
> >     > parameter. Now my question is, do I need to return a reference
> >     to the
> >     > 3rd parameter node from my ReadFirst3Params function so that I can
> >     > continue reading the other params in the operation.
> >     Not really, one can read the rest of the OM tree the way they want,
> as
> >     an example, using the qname (see
> >     axiom_element_get_children_with_qname).
> >
> >     > Or is there any other way of doing this. For e.g. an internal
> >     pointer
> >     > that Axiom maintains which will tell me the position with in the
> XML
> >     > document. (I hope my question makes sense)
> >     >
> >     > Q2) One of the operation returns an attachment to the client as an
> >     > mtom attachment. I use axiom_data_handler_create to read in the
> >     binary
> >     > file. I have a requirement to be able to read in a part of the
> file
> >     > rather than the whole file. Just like pread function in 'C' where
> I
> >     > can specify an offset and the file is read from the beginning to
> the
> >     > offset. Is there a function in axiom to be able to do that? If
> not,
> >     > how do I solve the above problem?
> >     We do not have provision to read part of the attachment as of now.
> Is
> >     there any way you can break the attachment to multiple parts and
> send
> >     that in the SOAP message. If you can do that, then you can read
> >     only the
> >     first attachment and forget about the rest and pass it on, I hope.
> >
> >     Samisa...
> >     >
> >     >
> >     > Thanks again for ur help!
> >     >
> >     >
> >     > Subra
> >     >
> >     >
> >     >
> >
> >
> >     --
> >     Samisa Abeysinghe : WSO2 WSF/C
> >     "
> >     http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services
>
> <http://wso2.org/projects/wsf/c?WSO2%C2%A0Web%C2%A0Services%C2%A0Framework/C%C2%A0-%C2%A0Open%C2%A0source%C2%A0C%C2%A0library%C2%A0for%C2%A0providing%C2%A0and%C2%A0consuming%C2%A0Web%C2%A0services>
> >     <http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services
>
> <http://wso2.org/projects/wsf/c?WSO2%C2%A0Web%C2%A0Services%C2%A0Framework/C%C2%A0-%C2%A0Open%C2%A0source%C2%A0C%C2%A0library%C2%A0for%C2%A0providing%C2%A0and%C2%A0consuming%C2%A0Web%C2%A0services>
> >"
> >
> >
> >
> ---------------------------------------------------------------------
> >     To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> >     <ma...@ws.apache.org>
> >     For additional commands, e-mail: axis-c-user-help@ws.apache.org
> >     <ma...@ws.apache.org>
> >
> >
>
>
> --
> http://kaushalye.blogspot.com/
> http://wso2.org/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: Axiom Questions

Posted by Kaushalye Kapuruge <ka...@wso2.com>.
Subra A Narayanan wrote:
> Hey Samisa,
>
> With regards to my second question:
>
> I am not talking about reading part of the attachment. What I am 
> asking is can I read part of the file from the disk and attach it to 
> the message? 'axiom_data_handler_create' takes in a file name but no 
> offset. I can read a part of the file using pread, but but do I 
> convert the void *buff in to a data handler?
Have you tried this?
axiom_data_handler_set_binary_data(data_handler, env, ip_stream, len);
First of all you'll have to keep you data(i.e. ip_stream) using 
axis2_byte_t*.

Cheers,
Kaushalye
>
> Subra
>
> On 8/13/07, *Samisa Abeysinghe* <samisa@wso2.com 
> <ma...@wso2.com>> wrote:
>
>     Subra A Narayanan wrote:
>     > Hello everyone,
>     >
>     > Its Monday morning and I am back with my questions. :-)
>     >
>     > Not sure if these questions belong here but will ask anyways. Please
>     > let me know if I should be sending this mail to some other
>     mailing list.
>     >
>     > I am using Axis2 and have 2 basic questions about Axiom. I did some
>     > searching on the web and tried looking through the Axis2/C
>     source code
>     > but don't have my answer. Here it goes:
>     >
>     > Q1) I have a web service with 4 operations. The first 3
>     parameters are
>     > the same for all the 4 operations. In other words, the first 3 child
>     > elements inside the <SoapBody><Operation Name></Operation
>     > Name></SoapBody> are the same for the 4 operations. So I created a
>     > function, called ReadFirst3Params which gets called from all the 4
>     > operations. Since, Axiom is based on a pull parser, I know I
>     have to
>     > have a reference to the 3rd parameter node to be able to read
>     the 4th
>     > parameter. Now my question is, do I need to return a reference
>     to the
>     > 3rd parameter node from my ReadFirst3Params function so that I can
>     > continue reading the other params in the operation.
>     Not really, one can read the rest of the OM tree the way they want, as
>     an example, using the qname (see
>     axiom_element_get_children_with_qname).
>
>     > Or is there any other way of doing this. For e.g. an internal
>     pointer
>     > that Axiom maintains which will tell me the position with in the XML
>     > document. (I hope my question makes sense)
>     >
>     > Q2) One of the operation returns an attachment to the client as an
>     > mtom attachment. I use axiom_data_handler_create to read in the
>     binary
>     > file. I have a requirement to be able to read in a part of the file
>     > rather than the whole file. Just like pread function in 'C' where I
>     > can specify an offset and the file is read from the beginning to the
>     > offset. Is there a function in axiom to be able to do that? If not,
>     > how do I solve the above problem?
>     We do not have provision to read part of the attachment as of now. Is
>     there any way you can break the attachment to multiple parts and send
>     that in the SOAP message. If you can do that, then you can read
>     only the
>     first attachment and forget about the rest and pass it on, I hope.
>
>     Samisa...
>     >
>     >
>     > Thanks again for ur help!
>     >
>     >
>     > Subra
>     >
>     >
>     >
>
>
>     --
>     Samisa Abeysinghe : WSO2 WSF/C
>     "
>     http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services
>     <http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services>"
>
>
>     ---------------------------------------------------------------------
>     To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
>     <ma...@ws.apache.org>
>     For additional commands, e-mail: axis-c-user-help@ws.apache.org
>     <ma...@ws.apache.org>
>
>


-- 
http://kaushalye.blogspot.com/
http://wso2.org/


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


Re: Axiom Questions

Posted by Subra A Narayanan <as...@gmail.com>.
Hey Samisa,

With regards to my second question:

I am not talking about reading part of the attachment. What I am asking is
can I read part of the file from the disk and attach it to the message?
'axiom_data_handler_create' takes in a file name but no offset. I can read a
part of the file using pread, but but do I convert the void *buff in to a
data handler?

Subra

On 8/13/07, Samisa Abeysinghe <sa...@wso2.com> wrote:
>
> Subra A Narayanan wrote:
> > Hello everyone,
> >
> > Its Monday morning and I am back with my questions. :-)
> >
> > Not sure if these questions belong here but will ask anyways. Please
> > let me know if I should be sending this mail to some other mailing list.
> >
> > I am using Axis2 and have 2 basic questions about Axiom. I did some
> > searching on the web and tried looking through the Axis2/C source code
> > but don't have my answer. Here it goes:
> >
> > Q1) I have a web service with 4 operations. The first 3 parameters are
> > the same for all the 4 operations. In other words, the first 3 child
> > elements inside the <SoapBody><Operation Name></Operation
> > Name></SoapBody> are the same for the 4 operations. So I created a
> > function, called ReadFirst3Params which gets called from all the 4
> > operations. Since, Axiom is based on a pull parser, I know I have to
> > have a reference to the 3rd parameter node to be able to read the 4th
> > parameter. Now my question is, do I need to return a reference to the
> > 3rd parameter node from my ReadFirst3Params function so that I can
> > continue reading the other params in the operation.
> Not really, one can read the rest of the OM tree the way they want, as
> an example, using the qname (see axiom_element_get_children_with_qname).
>
> > Or is there any other way of doing this. For e.g. an internal pointer
> > that Axiom maintains which will tell me the position with in the XML
> > document. (I hope my question makes sense)
> >
> > Q2) One of the operation returns an attachment to the client as an
> > mtom attachment. I use axiom_data_handler_create to read in the binary
> > file. I have a requirement to be able to read in a part of the file
> > rather than the whole file. Just like pread function in 'C' where I
> > can specify an offset and the file is read from the beginning to the
> > offset. Is there a function in axiom to be able to do that? If not,
> > how do I solve the above problem?
> We do not have provision to read part of the attachment as of now. Is
> there any way you can break the attachment to multiple parts and send
> that in the SOAP message. If you can do that, then you can read only the
> first attachment and forget about the rest and pass it on, I hope.
>
> Samisa...
> >
> >
> > Thanks again for ur help!
> >
> >
> > Subra
> >
> >
> >
>
>
> --
> Samisa Abeysinghe : WSO2 WSF/C
> "
> http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services
> "
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
>
>

Re: Axiom Questions

Posted by Samisa Abeysinghe <sa...@wso2.com>.
Subra A Narayanan wrote:
> Hello everyone,
>
> Its Monday morning and I am back with my questions. :-)
>
> Not sure if these questions belong here but will ask anyways. Please 
> let me know if I should be sending this mail to some other mailing list.
>
> I am using Axis2 and have 2 basic questions about Axiom. I did some 
> searching on the web and tried looking through the Axis2/C source code 
> but don't have my answer. Here it goes:
>
> Q1) I have a web service with 4 operations. The first 3 parameters are 
> the same for all the 4 operations. In other words, the first 3 child 
> elements inside the <SoapBody><Operation Name></Operation 
> Name></SoapBody> are the same for the 4 operations. So I created a 
> function, called ReadFirst3Params which gets called from all the 4 
> operations. Since, Axiom is based on a pull parser, I know I have to 
> have a reference to the 3rd parameter node to be able to read the 4th 
> parameter. Now my question is, do I need to return a reference to the 
> 3rd parameter node from my ReadFirst3Params function so that I can 
> continue reading the other params in the operation.
Not really, one can read the rest of the OM tree the way they want, as 
an example, using the qname (see axiom_element_get_children_with_qname).

> Or is there any other way of doing this. For e.g. an internal pointer 
> that Axiom maintains which will tell me the position with in the XML 
> document. (I hope my question makes sense)
>
> Q2) One of the operation returns an attachment to the client as an 
> mtom attachment. I use axiom_data_handler_create to read in the binary 
> file. I have a requirement to be able to read in a part of the file 
> rather than the whole file. Just like pread function in 'C' where I 
> can specify an offset and the file is read from the beginning to the 
> offset. Is there a function in axiom to be able to do that? If not, 
> how do I solve the above problem?
We do not have provision to read part of the attachment as of now. Is 
there any way you can break the attachment to multiple parts and send 
that in the SOAP message. If you can do that, then you can read only the 
first attachment and forget about the rest and pass it on, I hope.

Samisa...
>
>
> Thanks again for ur help!
>
>
> Subra
>
>
>


-- 
Samisa Abeysinghe : WSO2 WSF/C
"http://wso2.org/projects/wsf/c?WSO2&nbsp;Web&nbsp;Services&nbsp;Framework/C&nbsp;-&nbsp;Open&nbsp;source&nbsp;C&nbsp;library&nbsp;for&nbsp;providing&nbsp;and&nbsp;consuming&nbsp;Web&nbsp;services"


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