× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Orlando,

You have a hard-coded "VARYINGDATAOFFSET" of 2. The number 2 only works with fields 65535 long (or shorter). For fields larger than that, the offset should be 4.

Instead of using %ADDR(SOAP) + VARYINGOFFSET consider using %addr(SOAP:*DATA) so that RPG can figure out the offset for you. With %ADDR(var:*DATA) you do not have to add an offset since RPG returns the offset of the data rather than the offset of the length. Only disadvantage is that it requires v7r1 (which should no longer be a problem.)

Everything Kevin said is correct, too. When you get a 500 error, it's because the server found a problem, and it does NOT mean that you won't get an XML document as a response -- you will still get a document, but it will contain an error message.

But, in this case, it was pretty obvious from the description what the cause would be, since you're adding the wrong offset, you'll get part of the length bytes sent in the data, which the server won't be expecting, so will definitely give you an XML error.

-SK


On 9/18/2017 9:39 PM, orlando misas wrote:
Hi,

When I consume a web services using httpapi and the xml structure I send is
less than 65000 bytes the process runs perfect; however when the field
containing the xml structure is larger than 65000 bytes, the httpapi
returns the error 'HTTP / 1.1 500 Internal Server Error'. the definition of
the field for the first and second case is:
d soap s 65000 a (first case)
d soap s 200000 a (second case)
How do I set the field so I can send a larger frame of information to 65000
bytes?

The program is as follows:

h dftactgrp (* no) bnddir ('HTTPAPI')
/copy HTTPAPI_H

D MapXmlData PR
D country 50a varying
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 VARYINGDATAOFFSET...
d c const(2)
d SOAP s 200000a
d TransaccionCrearResult...
D s 1000a varying
d wTimeOut s 10i 0
d wait s 1a
d rc s 10i 0
d cia s 2A
d Lote s 8A
d DocAceptacion s 7A
d Trabajo s 36A
d Aplicacion s 2A
d Ambiente s 1A
d Usuario s 10A
d ParAdicionales s 200000A
d Errores s 1000A
d Documentos s 1000A
d Conceptos s 1000A

C *Entry PList
C Parm CIA
C Parm Lote
C Parm DocAceptacion
C Parm Trabajo
C Parm Aplicacion
C Parm Ambiente
C Parm Usuario
C Parm ParAdicionales
C Parm Errores
C Parm Documentos
C Parm Conceptos
/free

SOAP = '<soap:Envelope +
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; +
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; +
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/";>+
<soap:Body>+
<TransaccionCadenasCrear xmlns="http://tempuri.org/";>+
<ltParametros>'+
%Trim(ParAdicionales)+
'</ltParametros>+
<lote>'+%Trim(Lote)+'</lote>+
<docaceptacion>'+%Trim(DocAceptacion)+'</docaceptacion>+
<trabajo>'+%Trim(Trabajo)+'</trabajo>+
<chraplicacion>'+%Trim(Aplicacion)+'</chraplicacion>+
<chrambiente>'+%Trim(Ambiente)+'</chrambiente>+
<chrusuario>'+%Trim(Usuario)+'</chrusuario>+
<cia>'+%Trim(Cia)+'</cia>+
<documentos></documentos>+
<conceptos></conceptos>+
</TransaccionCadenasCrear>+
</soap:Body>+
</soap:Envelope>';
http_setCCSIDs(1208: 0);
http_debug(*ON);

rc = http_post_xml( 'http://srvplantas.com/Aplicativos_I+
<http://srvplantasleo.leonisa.com/Aplicativos_I+>
nformaticos/WebServices/Service.asmx'
: %addr(SOAP) + VARYINGDATAOFFSET
: %len(SOAP)
: *NULL
: %paddr(MapXmlData)
: %addr(TransaccionCrearResult)
: wTimeOut
: HTTP_USERAGENT
: 'text/xml; charset=UTF-8');

if (rc<>1);
http_crash();
endif;

*inlr = *on;

/end-free

P MapXmlData B
D MapXmlData PI
D country 50a varying
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)

/free
if (name = 'TransaccionCadenasCrearResult');
errores = value;
endif;
if (name = 'documentos');
Documentos = value;
endif;
if (name = 'conceptos');
conceptos = value;
endif;
/end-free
P E

Thanks for the collaboration

Orlando Misas
omisas@xxxxxxxxx


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.