problems using getAnyObject() -- please help

2007-10-26 Thread Aggarwal, Vineet
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

  FocusTypeCodeEN/FocusTypeCode

/AlertContext  

Matches

  MatchInformation  

MatchedDataRecords

  MatchedRecord

RecordTypeEXTERNAL_ENTITY/RecordType

RelationshipMatched/Relationship

MatchedData

  Attribute name=EXTRL_NTITY_TYPE_CD
type=stringNM/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

  FocusTypeCodeEN/FocusTypeCode

/AlertContext  

Matches

  MatchInformation  

MatchedDataRecords

  MatchedRecord

RecordTypeEXTERNAL_ENTITY/RecordType/

RelationshipMatched/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


Re: problems using getAnyObject() -- please help

2007-10-26 Thread Nadir Amra
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 examplesince you already showed the a 
SOAP response I do not need that. 


Nadir K. Amra


Aggarwal, Vineet [EMAIL PROTECTED] 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
   FocusTypeCodeEN/FocusTypeCode
 /AlertContext 
 Matches
   MatchInformation 
 MatchedDataRecords
   MatchedRecord
 RecordTypeEXTERNAL_ENTITY/RecordType
 RelationshipMatched/Relationship
 MatchedData
   Attribute name=EXTRL_NTITY_TYPE_CD 
 type=stringNM/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
   FocusTypeCodeEN/FocusTypeCode
 /AlertContext 
 Matches
   MatchInformation 
 MatchedDataRecords
   MatchedRecord
 RecordTypeEXTERNAL_ENTITY/RecordType/
 RelationshipMatched/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;
 
   

RE: problems using getAnyObject() -- please help

2007-10-26 Thread Aggarwal, Vineet
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:[EMAIL PROTECTED] 
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 examplesince you already showed the
a 
SOAP response I do not need that. 


Nadir K. Amra


Aggarwal, Vineet [EMAIL PROTECTED] 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
   FocusTypeCodeEN/FocusTypeCode
 /AlertContext 
 Matches
   MatchInformation 
 MatchedDataRecords
   MatchedRecord
 RecordTypeEXTERNAL_ENTITY/RecordType
 RelationshipMatched/Relationship
 MatchedData
   Attribute name=EXTRL_NTITY_TYPE_CD 
 type=stringNM/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
   FocusTypeCodeEN/FocusTypeCode
 /AlertContext 
 Matches
   MatchInformation 
 MatchedDataRecords
   MatchedRecord
 RecordTypeEXTERNAL_ENTITY/RecordType/
 RelationshipMatched/Relationship
 MatchedData
 
 Note that there a few things wrong with this.  First of all