[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Correct code?
Hi Chris,
OK, two things jump out to me straight away:
1) The 500 response code you get does not necessarily indicate an "internal
server error", it may be something as straightforward as the data you passed
within the body of your soap message is not valid. You may still get a soap
message back from the server. In this instance the response soap message
will contain the fault code and string which describes the error
encountered. So if you get a 500 response you should still check to see if
you got a soap message back. Our soap processor trigger a 500 response from
our webserver for an error caused due to an xml schema validation error,
when processing the passed data in the body of the soap message. So a 500
response is not always a "bad" thing - you need to determine which 500
errors are caused by data errors and code appropriately within your
application.
2) Your RPG code has an envelope using the namespace of SOAP-ENV but you do
not seem to declare it anywhere. If you really need to use SOAP-ENV then try
replacing the soap envelope namespace attribute
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" with
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/". But to be
honest, I'd rather use soap than SOAP-ENV. I don't like shouting in my code
if I can help it.
HTH
Larry Ducie
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx
[mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Chris RENTON
Sent: 19 July 2007 21:33
To: ftpapi@xxxxxxxxxxxxxxxxxxxxxx
Subject: Correct code?
I'm not sure if this is correct, I keep getting HTTP500 errors, the
service is on a local network server (birsvr06), here is the XML for
the SOAP calls:
POST /webservice/priceservice.asmx HTTP/1.1
Host: birsvr06
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://birsvr06/webservice/barcode"
<?xml version="1.0" encoding="utf-8"?>
<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>
<barcode xmlns="http://birsvr06/webservice">
<barcode>string</barcode>
</barcode>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length
<?xml version="1.0" encoding="utf-8"?>
<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>
<barcodeResponse xmlns="http://birsvr06/webservice">
<barcodeResult>
<product>
<brndcd>string</brndcd>
<pgroup>string</pgroup>
<colcde>string</colcde>
<sizcde>string</sizcde>
<description>string</description>
<colour>string</colour>
<size>string</size>
<message>string</message>
</product>
<product>
<brndcd>string</brndcd>
<pgroup>string</pgroup>
<colcde>string</colcde>
<sizcde>string</sizcde>
<description>string</description>
<colour>string</colour>
<size>string</size>
<message>string</message>
</product>
</barcodeResult>
</barcodeResponse>
</soap:Body>
</soap:Envelope>
And here is the current program i'm trying to get it to work with:
H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')
D SAPTEST1 PR ExtPgm('SAPTEST1')
D rBarcode 13A const
D SAPTEST1 PI
D rBarcode 13A const
/copy httpapi_h
D Incoming PR
D Result 32767A varying
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 32767A varying const
D attrs * dim(32767)
D const options(*varsize)
D SOAP s 32767A varying
D rc s 10I 0
D rbarcode s 13A
D Result s 32767A varying
/free
if ( %parms < 1 );
http_comp('Please pass the barcode you wish to convert');
return;
endif;
SOAP =
'<?xml version="1.0" encoding="utf-8"?>'
+'<SOAP-ENV:Envelope'
+' xmlns:xsi="[1]http://www.w3.org/2001/XMLSchema-instance"'
+' xmlns:xsd="[2]http://www.w3.org/2001/XMLSchema"'
+' xmlns:soap="[3]http://schemas.xmlsoap.org/soap/envelope/"'
+'>'
+'<SOAP-ENV:Body>'
+' <barcode xmlns="[4]http://birsvr06/webservice">'
+' <barcode>'+ %trim(rBarcode) +'</barcode>'
+' </barcode>'
+'</SOAP-ENV:Body>'
+'</SOAP-ENV:Envelope>';
http_debug(*ON);
rc = http_url_post_xml(
'http://birsvr06/webservice/priceservice.asmx'
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(Incoming)
: %addr(Result)
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml'
: 'http://birsvr06/webservice');
if (rc <> 1);
http_crash();
else;
Result = 'Product code details';
http_comp(%trim(brndcd) + %trim(pgroup) + %trim(colcde)
+ %trim(sizcde));
endif;
*inlr = *on;
/end-free
P Incoming B
D Incoming PI
D Result 32767A varying
D depth 10I 0 value
D name 1024A varying const
D path 24576A varying const
D value 32767A varying const
D attrs * dim(32767)
D const options(*varsize)
P E
Any ideas?
Chris Renton
Business Systems Developer
Sigmakalon
Ext 4213
Official Sponsors of the Johnstone's Paint Trophy - Bringing Colour to
the Beautiful Game
[5]www.johnstones-paints.co.uk/johnstonespainttrophy
**************************************
-----------------------------------------
SigmaKalon UK Limited, registered in England (number 00436135), with
its registered office at Huddersfield Road, Birstall, Batley, West
Yorkshire, WF17 9XA.
PRIVATE AND CONFIDENTIAL
This Email may contain information that is privileged, confidential or
otherwise protected from disclosure. It must not be used by, or its
contents copied or disclosed to persons other than the addressee(s).
If you have received this Email in error please notify our systems
administrator on +44 (0)1924 354827 and delete the Email.
WARNING
It is the responsibility of the recipient to ensure that the onward
transmission, opening or use of this message and any attachments will
not adversely affect its systems or data. Please carry out such virus
and other checks as you consider appropriate. No responsibility is
accepted by SigmaKalon UK Limited in this regard
The contents of this e-mail may not necessarily represent the views or
policies of SigmaKalon UK Limited.
No contracts may be concluded on behalf of SigmaKalon UK Limited by
means of email communication.
SigmaKalon UK Limited may monitor the content of e-mails, as
appropriate, to ensure its policies and procedures are being upheld by
its employees.
----------------------------------------
**************************************
References
1. http://www.w3.org/2001/XMLSchema-instance"'
2. http://www.w3.org/2001/XMLSchema"'
3. http://schemas.xmlsoap.org/soap/envelope/"'
4. http://195.99.128.7/webservice">'
5. http://www.johnstones-paints.co.uk/johnstonespainttrophy
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------