Donnie,
I fixed the namespace problem with v1.15.3 and I successfully generated a
stub, which successfully received the response message of your web service.
Please find the sample attached as plain text.
The v1.13 Base64 UnMarshaller always returns the binary data as it has been
encoded on the server. For example, when the server encodes a PDF to
Base64, the Base64 UnMarshaller returns the binary data of that PDF. After
having saved the binary data to a stream file, the stream file can be
opened with Acrobat Reader.
Starting with v1.15 you can control that behavior with parameter BASE64TYPE
of the WSDL2RPG command. The default value is *BINARY which makes the
Base64 UnMarshaller to return binary data. With *CHAR the UnMarshaller
decodes the Base64 data to binary and then translates it to the job CCSID:
when (depth = 2
and
name = 'transactions');
p_assert(namespace = ''
: 'Namespace should be empty');
if (not Value_isNil(attrs));
UnMarshaller_setFieldIdentifier(name: path);
currentItem.transactions =
UnMarshaller_toBase64Binary(value); // = BASE64TYPE(*BINARY)
// : getPostCcsid()); = BASE64TYPE(*CHAR)
endif;
Here is what I did in my test program to parse the Base64 encoded XML
document of element <transactions>:
// If the Web service finished successfully ...
if (not OTSWebSvcs_Port_isError());
// ... get response data from response data structure
rc = http_parse_xml_string(
%addr(dequeue2Response.dequeue2Return.transactions) + 2
: %len(dequeue2Response.dequeue2Return.transactions)
: OTSWebSvcs_Port_getPostCcsid() // = 1208
: *null
: %paddr(incoming)
: %addr(result));
if (rc <> 0);
text = http_error();
sndMsg(text);
else;
if (result <> 'Hello World');
sndMsg('Result does not match ''Hello World''');
else;
sndMsg('*** Success ***');
endif;
endif;
Parser callback procedure:
P Incoming B
D Incoming PI
D userdata * value
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 65535A varying const
D attrs * dim(32767)
D const options(*varsize)
D result S like(userData_t ) based(userdata)
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
/free
if ( path = '');
select;
when name = 'Test';
result = value;
endsl;
endif;
/end-free
P E
The server side of this test case is an Axis2 web service that has been
generated from your WSDL file.
Thomas.
Am 27.10.2012 00:04, schrieb Donnie:
Thomas,
I would like to run your attached program here but I get the following
message when I try to download your attachment:
"Forbidden. You don't have permission to access
/pipermail/ftpapi/attachments/20121026/2c431c5a/attachment.zip on this
server."
I'll debug impl_dequeue2ResponseStart() like you suggested and let you
know what I find.
A few facts on my end:
1. soapUI returns the correct response for me, too.
2. I'm currently using WSDL2RPG v1.15.2 and HTTPAPI v1.24
3. The generated test stub returns an empty response from the
webservice call.
4. Add OTSWebSvcs_RedirectResponse_toStmf(stmf); to the test stub and
I get the attached file.
I still have WSDL2RPG v1.13 on our box and the test stub generated from
that version did return a response. If I go back to v1.13 let me ask
this. The <transactions> element will be returned as EBCDIC or ASCII?
If ASCII, then what is the recommended way to convert it to EBCDIC? As
for parsing the <transactions> element, would you agree that HTTPAPI
procedure: http_parse_xml_string() would be the best choice?
Thanks,
Donnie
------------------------------
Message: 4
Date: Fri, 26 Oct 2012 20:58:04 +0200
From: Thomas Raddatz <[1]thomas.raddatz@xxxxxxxxxxx>
To: HTTPAPI and FTPAPI Projects <[2]ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: First Attempt At Decoding Base64 XML Element
Message-ID: <[3]508ADD3C.1050500@xxxxxxxxxxx>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Another option is to start the debugger for ESSSRV02 and adding a
breakpoint to the "select;" statement of procedure
impl_dequeue2ResponseStart().
When the debugger stops with "depth = 1" check the "namespace"
variable. If
it is empty, remove the following statement, compile your program
and try
it again:
select;
when (depth = 1
and
name = 'dequeue2Response'
Add: );
Rmv: and
Rmv: namespace = '[4]http://websvcs.otswebws');
if (MultiRef_isReference(attrs));
If that does not work, you should send the debug log to me.
Thomas.
------------------------------
Message: 5
Date: Fri, 26 Oct 2012 22:30:09 +0200
From: Thomas Raddatz <[5]thomas.raddatz@xxxxxxxxxxx>
To: HTTPAPI and FTPAPI Projects <[6]ftpapi@xxxxxxxxxxxxxxxxxxxxxx>
Subject: Re: First Attempt At Decoding Base64 XML Element
Message-ID: <[7]508AF2D1.8050205@xxxxxxxxxxx>
Content-Type: text/plain; charset="iso-8859-1"; Format="flowed"
Donnie,
After are more extensive test I am no longer sure what is going
wrong on
your side. Attached you find your programs, slightly changed to make
them
run on our system.
I used soapUI and the response that you posted on 23.10.2012. Guess
what? I
got back everything:
> EVAL dequeue2Response
DEQUEUE2RESPONSE.DEQUEUE2RETURN.COUNT = 3
DEQUEUE2RESPONSE.DEQUEUE2RETURN.TRANSACTIONS =
....5...10...15...20...25...30...35...40...45...50...55...60
1 '<?xml version="1.0" encoding="UTF-8"?><tranBlock><tran
ID="7'
61 '939" companyID="TMTSW" auxID="0093368348"><T.7.01.0>
<key>26'
121 '75704</k'
DEQUEUE2RESPONSE.DEQUEUE2RETURN.TRANSACTIONIDOUT = 7941
Please compare the changed modules with the one you use.
You do not need to try 1.15.2 because that version seems to have a
problem
with the namespaces (actually no namespaces) of your wsdl. These
namespaces
are driving me crazy. I wished someone could explain that to me in
detail.
I understand that an element has to be qualified with a namespace
prefix
when it is a complex type that is a child of another complex type
and if
both namespaces are different. It has to be qualified even if the
schema
specifies "elementFormDefault" as "unqualified". I am going to check
that
again.
Thomas.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Donnie.zip
Type: application/zip
Size: 18636 bytes
Desc: not available
URL:
<[8]http://scottklement.com/pipermail/ftpapi/attachments/20121026/2c
431c5a/attachment.zip>
------------------------------
References
1. mailto:thomas.raddatz@xxxxxxxxxxx
2. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
3. mailto:508ADD3C.1050500@xxxxxxxxxxx
4. http://websvcs.otswebws/
5. mailto:thomas.raddatz@xxxxxxxxxxx
6. mailto:ftpapi@xxxxxxxxxxxxxxxxxxxxxx
7. mailto:508AF2D1.8050205@xxxxxxxxxxx
8.
http://scottklement.com/pipermail/ftpapi/attachments/20121026/2c431c5a/attachment.zip
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------