View previous topic :: View next topic
|
Author |
Message |
guptaritu1
New User
Joined: 10 Jun 2009 Posts: 5 Location: Delhi
|
|
|
|
We have a C++ application deployed with CICS. We were trying to expose the same as Web Service.
We tried using the DFHLS2WS CICS web service assistant to expose the following C Structure to the web
Struct {
int X;
char[9];
int Y;
}dfhrequest;
The utility generates the WSDL and WSBIND file.
WSDL is then used to generate the soap message which is received by CWI
Our C++ application program is invoked by CICS default transaction.
The C++ application program is designed to pick up data as follows:
4 bytes as integer variable. ( 0 to 3)
Next 9 bytes as charcater array ( 4 to 12 )
Next 4 bytes as character ( 13 to 16 )
But the data is not received that ways. We observed from the attached commarea that data is coming like following
4 bytes as integer variable. ( 0 to 3)
Next 12 bytes as character array ( 4 to 16 )
Next 4 bytes as character ( 16 to 20 )
We did further tests with following structures
Struct {
int X;
intZ;
int Y;
}dfhrequest;
Struct {
Char X[9];
Char Y[10];
Char Z[11];
}dfhrequest;
Struct {
int a;
int b;
int c;
Char X[9];
Char Y[10];
Char Z[11];
}dfhrequest;
Perfect results in all of these cases.
It seems when there is a mix of data types int, character, int there is a problem of offset which is causing issue.
Can somebody suggest how we can set the UNALIGN because it seems we cannot have keyword unaligned in C. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
Hi Ritu,
I am mainframe (COBOL) programmer but i will still let u know what i think might be happening.
In mainframe there are some cases called boundary allignment which requires fields to be alligned in multiples of four ( bytes ). so here... in ur case when u have a mix of integer and char fields it might be advisable to put in fillers (between the struct wherever required) so that each field is alligned as multiples of four. |
|
Back to top |
|
|
guptaritu1
New User
Joined: 10 Jun 2009 Posts: 5 Location: Delhi
|
|
|
|
when we send it as a single charcater array.. say int, char int are taken as char[16], then when it reaches our application it will use the bytes in commarea and take first 4 bytes as int and next 9 bytes as character and would expect the \0 as the terminator for the character array.
But we get Soap parsing error. |
|
Back to top |
|
|
Binop B
Active User
Joined: 18 Jun 2009 Posts: 407 Location: Nashville, TN
|
|
|
|
hi...
no idea what soap parsing error is....
... anyways... i did not und the "terminator" concept. are u telling that the destination C++ programs is always expecting a null termination ( single byte ) after every character field ?? |
|
Back to top |
|
|
guptaritu1
New User
Joined: 10 Jun 2009 Posts: 5 Location: Delhi
|
|
|
|
when we send it as a single charcater array.. say int, char int are taken as char[16], then when it reaches our application it will use the bytes in commarea and take first 4 bytes as int and next 9 bytes as character and would expect the \0 as the terminator for the character array.
But we get Soap parsing error. |
|
Back to top |
|
|
Robert Sample
Global Moderator
Joined: 06 Jun 2008 Posts: 8696 Location: Dubuque, Iowa, USA
|
|
|
|
From the z/OS XL C/C++ Language Reference manual, with emphasis added by me:
Quote: |
Structure members are assigned to memory addresses in increasing order, with the first component starting at the beginning address of the structure name itself. To allow proper alignment of components, padding bytes may appear between any consecutive members in the structure layout. |
I suggest you add pad bytes before your int Y definition so that it starts on byte 16. Although I haven't found any clear definition in the manual, int fields on z/OS appear to be treated as full words since they are 4 bytes and therefore are aligned on 4-byte boundaries. |
|
Back to top |
|
|
|