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 "Aggarwal, Vineet" <Vi...@mantas.com> on 2007/10/26 16:29:49 UTC

problems using getAnyObject() -- please help

Hi all,

 

I have been struggling with this for days.  I've finally reached the
point where I can't get any further and need to reach out for help.

 

I need to be able to work directly with the XML contents of the SOAP
request rather than going through one of the objects created in the
server side stubs.  The only way I've discovered to be able to do this
is by using IWrapperSoapDeSerializer::getAnyObject().  I thought this
was the appropriate method because of the comments in the header:  "Will
deserialize the next available SOAP element and all child elements."

 

I will walk through some examples of what I've tried in an attempt to
properly explain the issues I am running into.  Note that these are just
code snippets, I am leaving some of the obvious code out, and you can
pretty much assume that I've set things up properly.  Here is what I did
with my first attempt at printing out the XML:

 

AnyType *pV0 = pIHSDZ->getAnyObject();

for (int i = 0; i < pV0->_size; i++)

{

  cout << pV0->_array[i];

}

 

This only printed out part of the XML.  As such, I realized that I
needed to make multiple calls to getAnyObject() in order to get the next
elements, so I tried this:

 

AnyType *pV0 = pIHSDZ->getAnyObject();

while (pV0 != NULL)

{

  for (int i = 0; i < pV0->_size; i++)

  {

    cout << pV0->_array[i];

  }

  pV0 = pIHSDZ->getAnyObject();

}

 

This resulted in a segmentation fault, which after reading multiple
posts online, I discovered that it was because getAnyObject() will never
return NULL, so we end up making calls to it even after no further
objects remain, resulting in the segmentation fault.  This is where my
confusion comes in.  If I ended up getting all the XML and then made a
call to getAnyObect() and it then seg faulted, I would completely
understand.  However, it seg faults after I only get part of the XML
(leading me to believe that further calls to getAnyObect() actually
SHOULD return something).

 

Let me illustrate this with an example.  Say the XML contents of the
SOAP message is the following:

 

<?xml version="1.0" encoding="UTF-8"?>

<mantas:MantasAlertData 

  xmlns:mantas="http://namespaces.mantas.com/MAD"

  xmlns:action="http://namespaces.mantas.com/MAD/Action"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://namespaces.mantas.com/MAD
MantasAlertData.xsd"

> 

  <AlertData>

    <AlertContext>

      <FocusTypeCode>EN</FocusTypeCode>

    </AlertContext>  

    <Matches>

      <MatchInformation>  

        <MatchedDataRecords>

          <MatchedRecord>

            <RecordType>EXTERNAL_ENTITY</RecordType>

            <Relationship>Matched</Relationship>

            <MatchedData>

              <Attribute name="EXTRL_NTITY_TYPE_CD"
type="string">NM</Attribute>                              

            </MatchedData>

          </MatchedRecord>   

        </MatchedDataRecords>                       

      </MatchInformation>

    </Matches>    

  </AlertData> 

</mantas:MantasAlertData>

 

If you run my above code, this is what will get output to the consoled
before the segmentation fault:

 

<?xml version="1.0" encoding="UTF-8"?>

<mantas:MantasAlertData 

  xmlns:mantas="http://namespaces.mantas.com/MAD"

  xmlns:action="http://namespaces.mantas.com/MAD/Action"

  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://namespaces.mantas.com/MAD
MantasAlertData.xsd"

> 

  <AlertData>

    <AlertContext>

      <FocusTypeCode>EN</FocusTypeCode>

    </AlertContext>  

    <Matches>

      <MatchInformation>  

        <MatchedDataRecords>

          <MatchedRecord>

            <RecordType>EXTERNAL_ENTITY</RecordType/>

            <Relationship>Matched</Relationship>

            <MatchedData>

 

Note that there a few things wrong with this.  First of all, why doesn't
the rest get printed out?  If there is more data, why does it seg fault?
I even put in a counter to check how many times I go through the loop
before it seg faults, and limited the loop to that number...that solves
the seg fault issue, but I still don't get all the data.  Secondly, the
data is somewhat corrupted:  I don't know where the extra slashes have
come from (e.g. </RecordType/> instead of </RecordType>).  The same
happens with the reverse situation as well.  That is, if I try to feed
some XML through an AnyType object back into the response, it also gets
corrupted.  For example, the following code:

 

pIWSSZ->createSoapMethod("PrioritizeAlertResponse","http://namespaces.te
ch.com");

try

{

  AnyType *pAny = new AnyType();

  pAny->_size = 1;

  pAny->_array = new char*[1];

  pAny->_array[0] = "<AlertData></AlertData>";

  

  return pIWSSZ->addOutputAnyObject(pAny);

}

 

Produces the following response:

 

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<SOAP-ENV:Body>

<ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">

<AlertData/></ns1:PrioritizeAlertResponse>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

 

Whereas I am expecting:

 

<?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<SOAP-ENV:Body>

<ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">

<AlertData></AlertData></ns1:PrioritizeAlertResponse>

</SOAP-ENV:Body>

</SOAP-ENV:Envelope>

 

Does anybody have any idea why I am experiencing the above issues?  If
not, is there any other way to directly access the XML?  I know this is
a lot to digest, but I could REALLY use some help.  I am working on a
solution for which I centered the web services around Axis for C++, and
if I can't get it to work, I am basically screwed.  I'm not sure I have
the time to rearchitect some other solution (i.e. using Axis for Java
and calling the C++ code through JNI or something).

 

Thanks in advance for any help, it is much appreciated!

 

Vineet


RE: problems using getAnyObject() -- please help

Posted by Nadir Amra <am...@us.ibm.com>.
Just the client code....

Nadir K. Amra


"Aggarwal, Vineet" <Vi...@mantas.com> wrote on 10/26/2007 
10:10:25 AM:

> Nadir,
> 
> Thanks for your message.  I actually am using 1.6b and not the latest
> code from SVN.  Unfortunately, I can't seem to compile a version myself
> that works, so I've been using the pre-compiled binary for Linux (when I
> do a build myself, it builds fine, but seg faults when I try to run
> anything, including just the simple_axis_server).
> 
> My application is quite large, so I'm not sure I'll be able to build a
> small program to reproduce the problem, but I will certainly try.
> Perhaps I can modify the Calculator example to break (it currently works
> fine for me).  What exactly do you need, just the client code, or all
> the code involved?
> 
> Thanks again,
> Vineet
> 
> -----Original Message-----
> From: Nadir Amra [mailto:amra@us.ibm.com] 
> Sent: Friday, October 26, 2007 10:48 AM
> To: Apache AXIS C User List
> Subject: Re: problems using getAnyObject() -- please help
> 
> Vineet,
> 
> First I want to make sure you are using the latest code from SVN and not
> 
> 1.6b. 
> 
> I have a lot on my plate but I can take a look sometime next week. 
> 
> Assuming you are, and to expedite the debugging I will need to do,
> please 
> attach a complete simple client example....since you already showed the
> a 
> SOAP response I do not need that. 
> 
> 
> Nadir K. Amra
> 
> 
> "Aggarwal, Vineet" <Vi...@mantas.com> wrote on 10/26/2007 
> 09:29:49 AM:
> 
> > Hi all,
> > 
> > I have been struggling with this for days.  I?ve finally reached the
> > point where I can?t get any further and need to reach out for help.
> > 
> > I need to be able to work directly with the XML contents of the SOAP
> > request rather than going through one of the objects created in the 
> > server side stubs.  The only way I?ve discovered to be able to do 
> > this is by using IWrapperSoapDeSerializer::getAnyObject().  I 
> > thought this was the appropriate method because of the comments in 
> > the header:  ?Will deserialize the next available SOAP element and 
> > all child elements.?
> > 
> > I will walk through some examples of what I?ve tried in an attempt 
> > to properly explain the issues I am running into.  Note that these 
> > are just code snippets, I am leaving some of the obvious code out, 
> > and you can pretty much assume that I?ve set things up properly. 
> > Here is what I did with my first attempt at printing out the XML:
> > 
> > AnyType *pV0 = pIHSDZ->getAnyObject();
> > for (int i = 0; i < pV0->_size; i++)
> > {
> >   cout << pV0->_array[i];
> > }
> > 
> > This only printed out part of the XML.  As such, I realized that I 
> > needed to make multiple calls to getAnyObject() in order to get the 
> > next elements, so I tried this:
> > 
> > AnyType *pV0 = pIHSDZ->getAnyObject();
> > while (pV0 != NULL)
> > {
> >   for (int i = 0; i < pV0->_size; i++)
> >   {
> >     cout << pV0->_array[i];
> >   }
> >   pV0 = pIHSDZ->getAnyObject();
> > }
> > 
> > This resulted in a segmentation fault, which after reading multiple 
> > posts online, I discovered that it was because getAnyObject() will 
> > never return NULL, so we end up making calls to it even after no 
> > further objects remain, resulting in the segmentation fault.  This 
> > is where my confusion comes in.  If I ended up getting all the XML 
> > and then made a call to getAnyObect() and it then seg faulted, I 
> > would completely understand.  However, it seg faults after I only 
> > get part of the XML (leading me to believe that further calls to 
> > getAnyObect() actually SHOULD return something).
> > 
> > Let me illustrate this with an example.  Say the XML contents of the
> > SOAP message is the following:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <mantas:MantasAlertData 
> >   xmlns:mantas="http://namespaces.mantas.com/MAD"
> >   xmlns:action="http://namespaces.mantas.com/MAD/Action"
> >   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >   xsi:schemaLocation="http://namespaces.mantas.com/MAD 
> MantasAlertData.xsd"
> > > 
> >   <AlertData>
> >     <AlertContext>
> >       <FocusTypeCode>EN</FocusTypeCode>
> >     </AlertContext> 
> >     <Matches>
> >       <MatchInformation> 
> >         <MatchedDataRecords>
> >           <MatchedRecord>
> >             <RecordType>EXTERNAL_ENTITY</RecordType>
> >             <Relationship>Matched</Relationship>
> >             <MatchedData>
> >               <Attribute name="EXTRL_NTITY_TYPE_CD" 
> > type="string">NM</Attribute> 
> >             </MatchedData>
> >           </MatchedRecord> 
> >         </MatchedDataRecords> 
> >       </MatchInformation>
> >     </Matches> 
> >   </AlertData> 
> > </mantas:MantasAlertData>
> > 
> > If you run my above code, this is what will get output to the 
> > consoled before the segmentation fault:
> > 
> > <?xml version="1.0" encoding="UTF-8"?>
> > <mantas:MantasAlertData 
> >   xmlns:mantas="http://namespaces.mantas.com/MAD"
> >   xmlns:action="http://namespaces.mantas.com/MAD/Action"
> >   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >   xsi:schemaLocation="http://namespaces.mantas.com/MAD 
> MantasAlertData.xsd"
> > > 
> >   <AlertData>
> >     <AlertContext>
> >       <FocusTypeCode>EN</FocusTypeCode>
> >     </AlertContext> 
> >     <Matches>
> >       <MatchInformation> 
> >         <MatchedDataRecords>
> >           <MatchedRecord>
> >             <RecordType>EXTERNAL_ENTITY</RecordType/>
> >             <Relationship>Matched</Relationship>
> >             <MatchedData>
> > 
> > Note that there a few things wrong with this.  First of all, why 
> > doesn?t the rest get printed out?  If there is more data, why does 
> > it seg fault?  I even put in a counter to check how many times I go 
> > through the loop before it seg faults, and limited the loop to that 
> > number?that solves the seg fault issue, but I still don?t get all 
> > the data.  Secondly, the data is somewhat corrupted:  I don?t know 
> > where the extra slashes have come from (e.g. </RecordType/> instead 
> > of </RecordType>).  The same happens with the reverse situation as 
> > well.  That is, if I try to feed some XML through an AnyType object 
> > back into the response, it also gets corrupted.  For example, the 
> > following code:
> > 
> > 
> pIWSSZ->createSoapMethod("PrioritizeAlertResponse","http://namespaces.te
> ch.com
> > ");
> > try
> > {
> >   AnyType *pAny = new AnyType();
> >   pAny->_size = 1;
> >   pAny->_array = new char*[1];
> >   pAny->_array[0] = "<AlertData></AlertData>";
> > 
> >   return pIWSSZ->addOutputAnyObject(pAny);
> > }
> > 
> > Produces the following response:
> > 
> > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 
> xmlns:SOAP-ENV="
> > http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.
> > org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > <SOAP-ENV:Body>
> > <ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">
> > <AlertData/></ns1:PrioritizeAlertResponse>
> > </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> > 
> > Whereas I am expecting:
> > 
> > <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 
> xmlns:SOAP-ENV="
> > http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.
> > org/2001/XMLSchema" 
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> > <SOAP-ENV:Body>
> > <ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">
> > <AlertData></AlertData></ns1:PrioritizeAlertResponse>
> > </SOAP-ENV:Body>
> > </SOAP-ENV:Envelope>
> > 
> > Does anybody have any idea why I am experiencing the above issues? 
> > If not, is there any other way to directly access the XML?  I know 
> > this is a lot to digest, but I could REALLY use some help.  I am 
> > working on a solution for which I centered the web services around 
> > Axis for C++, and if I can?t get it to work, I am basically screwed.
> > I?m not sure I have the time to rearchitect some other solution (i.
> > e. using Axis for Java and calling the C++ code through JNI or 
> something).
> > 
> > Thanks in advance for any help, it is much appreciated!
> > 
> > Vineet
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.org
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-c-user-help@ws.apache.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: problems using getAnyObject() -- please help

Posted by "Aggarwal, Vineet" <Vi...@mantas.com>.
Nadir,

Thanks for your message.  I actually am using 1.6b and not the latest
code from SVN.  Unfortunately, I can't seem to compile a version myself
that works, so I've been using the pre-compiled binary for Linux (when I
do a build myself, it builds fine, but seg faults when I try to run
anything, including just the simple_axis_server).

My application is quite large, so I'm not sure I'll be able to build a
small program to reproduce the problem, but I will certainly try.
Perhaps I can modify the Calculator example to break (it currently works
fine for me).  What exactly do you need, just the client code, or all
the code involved?

Thanks again,
Vineet

-----Original Message-----
From: Nadir Amra [mailto:amra@us.ibm.com] 
Sent: Friday, October 26, 2007 10:48 AM
To: Apache AXIS C User List
Subject: Re: problems using getAnyObject() -- please help

Vineet,

First I want to make sure you are using the latest code from SVN and not

1.6b. 

I have a lot on my plate but I can take a look sometime next week. 

Assuming you are, and to expedite the debugging I will need to do,
please 
attach a complete simple client example....since you already showed the
a 
SOAP response I do not need that. 


Nadir K. Amra


"Aggarwal, Vineet" <Vi...@mantas.com> wrote on 10/26/2007 
09:29:49 AM:

> Hi all,
> 
> I have been struggling with this for days.  I?ve finally reached the
> point where I can?t get any further and need to reach out for help.
> 
> I need to be able to work directly with the XML contents of the SOAP
> request rather than going through one of the objects created in the 
> server side stubs.  The only way I?ve discovered to be able to do 
> this is by using IWrapperSoapDeSerializer::getAnyObject().  I 
> thought this was the appropriate method because of the comments in 
> the header:  ?Will deserialize the next available SOAP element and 
> all child elements.?
> 
> I will walk through some examples of what I?ve tried in an attempt 
> to properly explain the issues I am running into.  Note that these 
> are just code snippets, I am leaving some of the obvious code out, 
> and you can pretty much assume that I?ve set things up properly. 
> Here is what I did with my first attempt at printing out the XML:
> 
> AnyType *pV0 = pIHSDZ->getAnyObject();
> for (int i = 0; i < pV0->_size; i++)
> {
>   cout << pV0->_array[i];
> }
> 
> This only printed out part of the XML.  As such, I realized that I 
> needed to make multiple calls to getAnyObject() in order to get the 
> next elements, so I tried this:
> 
> AnyType *pV0 = pIHSDZ->getAnyObject();
> while (pV0 != NULL)
> {
>   for (int i = 0; i < pV0->_size; i++)
>   {
>     cout << pV0->_array[i];
>   }
>   pV0 = pIHSDZ->getAnyObject();
> }
> 
> This resulted in a segmentation fault, which after reading multiple 
> posts online, I discovered that it was because getAnyObject() will 
> never return NULL, so we end up making calls to it even after no 
> further objects remain, resulting in the segmentation fault.  This 
> is where my confusion comes in.  If I ended up getting all the XML 
> and then made a call to getAnyObect() and it then seg faulted, I 
> would completely understand.  However, it seg faults after I only 
> get part of the XML (leading me to believe that further calls to 
> getAnyObect() actually SHOULD return something).
> 
> Let me illustrate this with an example.  Say the XML contents of the
> SOAP message is the following:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <mantas:MantasAlertData 
>   xmlns:mantas="http://namespaces.mantas.com/MAD"
>   xmlns:action="http://namespaces.mantas.com/MAD/Action"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://namespaces.mantas.com/MAD 
MantasAlertData.xsd"
> > 
>   <AlertData>
>     <AlertContext>
>       <FocusTypeCode>EN</FocusTypeCode>
>     </AlertContext> 
>     <Matches>
>       <MatchInformation> 
>         <MatchedDataRecords>
>           <MatchedRecord>
>             <RecordType>EXTERNAL_ENTITY</RecordType>
>             <Relationship>Matched</Relationship>
>             <MatchedData>
>               <Attribute name="EXTRL_NTITY_TYPE_CD" 
> type="string">NM</Attribute> 
>             </MatchedData>
>           </MatchedRecord> 
>         </MatchedDataRecords> 
>       </MatchInformation>
>     </Matches> 
>   </AlertData> 
> </mantas:MantasAlertData>
> 
> If you run my above code, this is what will get output to the 
> consoled before the segmentation fault:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <mantas:MantasAlertData 
>   xmlns:mantas="http://namespaces.mantas.com/MAD"
>   xmlns:action="http://namespaces.mantas.com/MAD/Action"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://namespaces.mantas.com/MAD 
MantasAlertData.xsd"
> > 
>   <AlertData>
>     <AlertContext>
>       <FocusTypeCode>EN</FocusTypeCode>
>     </AlertContext> 
>     <Matches>
>       <MatchInformation> 
>         <MatchedDataRecords>
>           <MatchedRecord>
>             <RecordType>EXTERNAL_ENTITY</RecordType/>
>             <Relationship>Matched</Relationship>
>             <MatchedData>
> 
> Note that there a few things wrong with this.  First of all, why 
> doesn?t the rest get printed out?  If there is more data, why does 
> it seg fault?  I even put in a counter to check how many times I go 
> through the loop before it seg faults, and limited the loop to that 
> number?that solves the seg fault issue, but I still don?t get all 
> the data.  Secondly, the data is somewhat corrupted:  I don?t know 
> where the extra slashes have come from (e.g. </RecordType/> instead 
> of </RecordType>).  The same happens with the reverse situation as 
> well.  That is, if I try to feed some XML through an AnyType object 
> back into the response, it also gets corrupted.  For example, the 
> following code:
> 
> 
pIWSSZ->createSoapMethod("PrioritizeAlertResponse","http://namespaces.te
ch.com
> ");
> try
> {
>   AnyType *pAny = new AnyType();
>   pAny->_size = 1;
>   pAny->_array = new char*[1];
>   pAny->_array[0] = "<AlertData></AlertData>";
> 
>   return pIWSSZ->addOutputAnyObject(pAny);
> }
> 
> Produces the following response:
> 
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 
xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.
> org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <SOAP-ENV:Body>
> <ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">
> <AlertData/></ns1:PrioritizeAlertResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Whereas I am expecting:
> 
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 
xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.
> org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <SOAP-ENV:Body>
> <ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">
> <AlertData></AlertData></ns1:PrioritizeAlertResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Does anybody have any idea why I am experiencing the above issues? 
> If not, is there any other way to directly access the XML?  I know 
> this is a lot to digest, but I could REALLY use some help.  I am 
> working on a solution for which I centered the web services around 
> Axis for C++, and if I can?t get it to work, I am basically screwed.
> I?m not sure I have the time to rearchitect some other solution (i.
> e. using Axis for Java and calling the C++ code through JNI or 
something).
> 
> Thanks in advance for any help, it is much appreciated!
> 
> Vineet

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-user-help@ws.apache.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: problems using getAnyObject() -- please help

Posted by Nadir Amra <am...@us.ibm.com>.
Vineet,

First I want to make sure you are using the latest code from SVN and not 
1.6b. 

I have a lot on my plate but I can take a look sometime next week. 

Assuming you are, and to expedite the debugging I will need to do, please 
attach a complete simple client example....since you already showed the a 
SOAP response I do not need that. 


Nadir K. Amra


"Aggarwal, Vineet" <Vi...@mantas.com> wrote on 10/26/2007 
09:29:49 AM:

> Hi all,
> 
> I have been struggling with this for days.  I?ve finally reached the
> point where I can?t get any further and need to reach out for help.
> 
> I need to be able to work directly with the XML contents of the SOAP
> request rather than going through one of the objects created in the 
> server side stubs.  The only way I?ve discovered to be able to do 
> this is by using IWrapperSoapDeSerializer::getAnyObject().  I 
> thought this was the appropriate method because of the comments in 
> the header:  ?Will deserialize the next available SOAP element and 
> all child elements.?
> 
> I will walk through some examples of what I?ve tried in an attempt 
> to properly explain the issues I am running into.  Note that these 
> are just code snippets, I am leaving some of the obvious code out, 
> and you can pretty much assume that I?ve set things up properly. 
> Here is what I did with my first attempt at printing out the XML:
> 
> AnyType *pV0 = pIHSDZ->getAnyObject();
> for (int i = 0; i < pV0->_size; i++)
> {
>   cout << pV0->_array[i];
> }
> 
> This only printed out part of the XML.  As such, I realized that I 
> needed to make multiple calls to getAnyObject() in order to get the 
> next elements, so I tried this:
> 
> AnyType *pV0 = pIHSDZ->getAnyObject();
> while (pV0 != NULL)
> {
>   for (int i = 0; i < pV0->_size; i++)
>   {
>     cout << pV0->_array[i];
>   }
>   pV0 = pIHSDZ->getAnyObject();
> }
> 
> This resulted in a segmentation fault, which after reading multiple 
> posts online, I discovered that it was because getAnyObject() will 
> never return NULL, so we end up making calls to it even after no 
> further objects remain, resulting in the segmentation fault.  This 
> is where my confusion comes in.  If I ended up getting all the XML 
> and then made a call to getAnyObect() and it then seg faulted, I 
> would completely understand.  However, it seg faults after I only 
> get part of the XML (leading me to believe that further calls to 
> getAnyObect() actually SHOULD return something).
> 
> Let me illustrate this with an example.  Say the XML contents of the
> SOAP message is the following:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <mantas:MantasAlertData 
>   xmlns:mantas="http://namespaces.mantas.com/MAD"
>   xmlns:action="http://namespaces.mantas.com/MAD/Action"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://namespaces.mantas.com/MAD 
MantasAlertData.xsd"
> > 
>   <AlertData>
>     <AlertContext>
>       <FocusTypeCode>EN</FocusTypeCode>
>     </AlertContext> 
>     <Matches>
>       <MatchInformation> 
>         <MatchedDataRecords>
>           <MatchedRecord>
>             <RecordType>EXTERNAL_ENTITY</RecordType>
>             <Relationship>Matched</Relationship>
>             <MatchedData>
>               <Attribute name="EXTRL_NTITY_TYPE_CD" 
> type="string">NM</Attribute> 
>             </MatchedData>
>           </MatchedRecord> 
>         </MatchedDataRecords> 
>       </MatchInformation>
>     </Matches> 
>   </AlertData> 
> </mantas:MantasAlertData>
> 
> If you run my above code, this is what will get output to the 
> consoled before the segmentation fault:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <mantas:MantasAlertData 
>   xmlns:mantas="http://namespaces.mantas.com/MAD"
>   xmlns:action="http://namespaces.mantas.com/MAD/Action"
>   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://namespaces.mantas.com/MAD 
MantasAlertData.xsd"
> > 
>   <AlertData>
>     <AlertContext>
>       <FocusTypeCode>EN</FocusTypeCode>
>     </AlertContext> 
>     <Matches>
>       <MatchInformation> 
>         <MatchedDataRecords>
>           <MatchedRecord>
>             <RecordType>EXTERNAL_ENTITY</RecordType/>
>             <Relationship>Matched</Relationship>
>             <MatchedData>
> 
> Note that there a few things wrong with this.  First of all, why 
> doesn?t the rest get printed out?  If there is more data, why does 
> it seg fault?  I even put in a counter to check how many times I go 
> through the loop before it seg faults, and limited the loop to that 
> number?that solves the seg fault issue, but I still don?t get all 
> the data.  Secondly, the data is somewhat corrupted:  I don?t know 
> where the extra slashes have come from (e.g. </RecordType/> instead 
> of </RecordType>).  The same happens with the reverse situation as 
> well.  That is, if I try to feed some XML through an AnyType object 
> back into the response, it also gets corrupted.  For example, the 
> following code:
> 
> 
pIWSSZ->createSoapMethod("PrioritizeAlertResponse","http://namespaces.tech.com
> ");
> try
> {
>   AnyType *pAny = new AnyType();
>   pAny->_size = 1;
>   pAny->_array = new char*[1];
>   pAny->_array[0] = "<AlertData></AlertData>";
> 
>   return pIWSSZ->addOutputAnyObject(pAny);
> }
> 
> Produces the following response:
> 
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 
xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.
> org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <SOAP-ENV:Body>
> <ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">
> <AlertData/></ns1:PrioritizeAlertResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Whereas I am expecting:
> 
> <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope 
xmlns:SOAP-ENV="
> http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.
> org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <SOAP-ENV:Body>
> <ns1:PrioritizeAlertResponse xmlns:ns1="http://namespaces.mantas.com">
> <AlertData></AlertData></ns1:PrioritizeAlertResponse>
> </SOAP-ENV:Body>
> </SOAP-ENV:Envelope>
> 
> Does anybody have any idea why I am experiencing the above issues? 
> If not, is there any other way to directly access the XML?  I know 
> this is a lot to digest, but I could REALLY use some help.  I am 
> working on a solution for which I centered the web services around 
> Axis for C++, and if I can?t get it to work, I am basically screwed.
> I?m not sure I have the time to rearchitect some other solution (i.
> e. using Axis for Java and calling the C++ code through JNI or 
something).
> 
> Thanks in advance for any help, it is much appreciated!
> 
> Vineet

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