Hello Peter,
Can you explain why you are telling it that your data is in the
format of an HTML form that has been URL-encoded?
(application/x-www-form-urlencoded). The data that you're sending
does not appear to conform to the format of a URL encoded form, it
appears that you are simply sending an XML document as-is with no
additional encoding.
The error message "bad request / invalid url" is coming from the
web service, not from HTTPAPI. It could mean many different
things. So that is not very helpful to me -- it might be helpful
to the people who provide the service?
But, I would start by looking at their documentation (and/or the
working example that your colleague has) and see exactly how they
expect the document to be sent. Once we understand what they are
expecting, we can advise you on how to make HTTPAPI work that way.
-SK
Hi All,
I am new to HTTPAPI, so please
forgive
my ignorance/lack of knowlege. I need to send an xml data via a
secure
url to TNT in the UK and once they have received the data and
verified
the content, their system will return a character string with a
'COMPLETExxxxxxx'
message. Now I have written a program utilising the code below,
but the
only response I get is; " <h1>Bad Request (Invalid
URL)</h1>
" Now my colleague has successfully managed to manually send
the same xml data to the same url/port etc. and receive the
correct response
using SSIS. Any advice/help with what I may be doing wrong or
what I may
be missing would be greatly appreciated.
My code:
https_strict(*ON);
http_use_cookies(*OFF);
http_debug(*on:
'/tmp/whm0491-debug.txt');
callp http_long_parseURL(#url
: service
: userid
: pass
: host
: port
: path );
host=%xlate(lo:up:host);
callp http_xproc( HTTP_POINT_CERT_VAL
: %paddr(cert_val) );
rc = http_url_post_stmf(
#url
: #fromPath
: #resultPath
: #TIMEOUT
: 'ShipperGate_socket/1.0'
: 'application/x-www-form-urlencoded'
);
if (rc <> 1);
#msg = http_error();
endif;
The Debug log:
************Beginning of
data**************
HTTPAPI Ver 1.33 released
2016-12-06
NTLM Ver 1.4.0 released
2014-12-22
OS/400 Ver V6R1M0
New iconv() objects set,
PostRem=819.
PostLoc=0. ProtRem=819. ProtLoc=0
http_long_ParseURL(): entered
http_url_post_stmf(): entered
getting post file size...
opening file to be sent...
opening file to be received
http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain:
justgroup.internal
DNS server found: 10.0.0.21
DNS server found: 10.0.1.21
https_init(): entered
QSSLPCL = *OPSYS
SSL version 2 support disabled
SSL version 3 support disabled
Old interface to TLS version 1.0
support
enabled
Support for TLS 1.0 unavailable.
Support for TLS 1.1 unavailable.
Support for TLS 1.2 unavailable.
--------------------------------------------------------------
Dump of local-side certificate
information:
--------------------------------------------------------------
Nagle's algorithm (TCP_NODELAY)
disabled.
(GSKit) Identifier value is not
valid.
ssl_error(701): (GSKit)
Identifier value
is not valid.
SNI hostname error: (GSKit)
Identifier
value is not valid.
NOTE: SNI errors are not usually
fatal.
--------------------------------------------------------------
Dump of server-side certificate
information:
------------------------------------------------------------------
Cert Validation Code = 0
-----BEGIN CERTIFICATE-----
MIIGFjCCBP6gAwIBAgIQQGMG281+fMYQYk2cCN1IYjANBgkqhkiG9w0BAQsFADB+
MQswCQYDVQQGEwJVUzEdMBsGA1UEChMUU3ltYW50ZWMgQ29ycG9yYXRpb24xHzAd
BgNVBAsTFlN5bWFudGVjIFRydXN0IE5ldHdvcmsxLzAtBgNVBAMTJlN5bWFudGVj
IENsYXNzIDMgU2VjdXJlIFNlcnZlciBDQSAtIEc0MB4XDTE2MTIwOTAwMDAwMFoX
DTE4MDExNjIzNTk1OVowgZwxCzAJBgNVBAYTAkdCMRUwEwYDVQQIDAxXYXJ3aWNr
c2hpcmUxEzARBgNVBAcMCkF0aGVyc3RvbmUxKTAnBgNVBAoMIFROVCBFeHByZXNz
IFdvcmxkd2lkZSBVSyBMaW1pdGVkMRgwFgYDVQQLDA9UTlQgRXhwcmVzcyBJQ1Mx
HDAaBgNVBAMME2ljb25uZWN0aW9uLnRudC5jb20wggEiMA0GCSqGSIb3DQEBAQUA
A4IBDwAwggEKAoIBAQDZWHcuQAcmuSh/NFEPwMGKxChpugCBvZUagc1Qm7oawRMZ
aeelxZMTsApzQ09fkShHVs2l0Ti/P4ppksKP3D3LKyv7koxajre3945JLyVTaN0F
fkBEioy12pLlx23RZDNkOKfFBDVqupf/A2xRReMqF/1y8hUDj5pFlrCUa5z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Uo4sAJiVAu+CxGvv7rV3fwWzt
bDuyctyIMFCPlZo0PVI1tJdhFKrJjReplFZy4Mb3pnymaQ3C886w0JJBLfv2n23E
TI2xThbVnalrUzBkQkyVC3p2KhOQ/wdGYwWrAa8slClOUCPC6gv6RcOBUtH5chmG
No9EPTkFtFPoXSapfe/jlVXupU/KBeUr3PQNW3O9OfuTnLByEy8XWOs0ik7IQXqw
9/d2CkrRjf21DL8kXbWr28EK++eF8VA8BSZjOCB/0TTD6Y8jr19Ni503Uo2kksB6
Xt968zFYfLyT+8aVjGt8Tm+HFxUZi17bI2M=
-----END CERTIFICATE-----
Serial Number:
40:63:06:DB:CD:7E:7C:C6:10:62:4D:9C:08:DD:48:62
Common Name: iconnection.tnt.com
Country: GB
State/Province: Warwickshire
Locality: Atherstone
Org Unit: TNT Express Worldwide
UK Limited
Org: TNT Express ICS
Issuer CN: Symantec Class 3
Secure Server
CA - G4
Issuer Country: US
Issuer Org: Symantec Corporation
Issuer Org Unit: Symantec Trust
Network
Version: 03
not before: 20161209110000
not after: 20180117105959
pub key alg:
1.2.840.113549.1.1.11
Protocol Used: TLS Version 1.0
http_persist_post(): entered
http_persist_req(POST) entered.
http_long_ParseURL(): entered
http_long_ParseURL(): entered
do_oper(POST): entered
POST ShipperGate2.asp HTTP/1.1
Accept: */*
User-Agent:
ShipperGate_socket/1.0
Content-Type:
application/x-www-form-urlencoded
Content-Length: 26322
sendraw(): entered
<?xml version="1.0"
encoding="ISO-8859-1"
standalone="no"?>
<!DOCTYPE ESHIPPER SYSTEM
'http://iconnection.tnt.com:81/ShipperDTD2.0/EshipperIN2.dtd'>
<ESHIPPER>
<LOGIN>
<COMPANY>Sm********</COMPANY>
<PASSWORD>TNT*****</PASSWORD>
<APPID>EC</APPID>
<APPVERSION>2.2</APPVERSION>
</LOGIN>
<CONSIGNMENTBATCH>
<SENDER>
<COMPANYNAME>Smiggle
UK Limited</COMPANYNAME>
<STREETADDRESS1>c/o
ACS</STREETADDRESS1>
<STREETADDRESS2>Thurrock
Park Way</STREETADDRESS2>
<STREETADDRESS3>Tilbury
RM18 7HZ</STREETADDRESS3>
<CITY>Tilbury</CITY>
<PROVINCE>.</PROVINCE>
<POSTCODE>RM18
7HZ</POSTCODE>
<COUNTRY>GB</COUNTRY>
<ACCOUNT>0015*****</ACCOUNT>
<CONTACTNAME>Shane
Smith</CONTACTNAME>
<CONTACTDIALCODE>00441</CONTACTDIALCODE>
<CONTACTTELEPHONE>375400000</CONTACTTELEPHONE>
<CONTACTEMAIL></CONTACTEMAIL>
<COLLECTION>
<COLLECTIONADDRESS>
<COMPANYNAME>Smiggle UK
Limited</COMPANYNAME>
<STREETADDRESS1>c/o
ACS</STREETADDRESS1>
<STREETADDRESS2>Thurrock
Park Way</STREETADDRESS2>
<STREETADDRESS3>Tilbury
RM18 7HZ</STREETADDRESS3>
<CITY>Tilbury</CITY>
<PROVINCE>.</PROVINCE>
<POSTCODE>RM18
7HZ</POSTCODE>
<COUNTRY>GB</COUNTRY>
<CONTACTNAME>Shane
Smith</CONTACTNAME>
<CONTACTDIALCODE>00441</CONTACTDIALCODE>
<CONTACTTELEPHONE>375******</CONTACTTELEPHONE>
</COLLECTIONADDRESS>
<SHIPDATE>03/04/2017</SHIPDATE>
<PREFCOLLECTTIME>
<FROM>1400</FROM>
<TO>1700</TO>
</PREFCOLLECTTIME>
<ALTCOLLECTTIME>
<FROM/>
<TO/>
</ALTCOLLECTTIME>
<COLLINSTRUCTIONS>Collection
from Warehouse</COLLINSTRUCTIONS>
</COLLECTION>
</SENDER>
<CONSIGNMENT>
<CONREF>50042196</CONREF>
<DETAILS>
<RECEIVER>
<COMPANYNAME>Smiggle</COMPANYNAME>
<STREETADDRESS1>UNIT
7, LEVEL 3, DUNDRUM</STREETADDRESS1>
<STREETADDRESS2>TOWN
CENTRE, SANDYFORD RD</STREETADDRESS2>
<STREETADDRESS3>
</STREETADDRESS3>
<CITY>DUBLIN
16</CITY>
<PROVINCE>IE</PROVINCE>
<POSTCODE/>
<COUNTRY>IE</COUNTRY>
<VAT/>
<CONTACTNAME>Store
Manager</CONTACTNAME>
<CONTACTDIALCODE>001</CONTACTDIALCODE>
<CONTACTTELEPHONE>000000001</CONTACTTELEPHONE>
<CONTACTEMAIL/>
</RECEIVER>
<DELIVERY>
<COMPANYNAME>Smiggle</COMPANYNAME>
<STREETADDRESS1>UNIT 7,
LEVEL 3, DUNDRUM</STREETADDRESS1>
<STREETADDRESS2>TOWN
CENTRE,
SANDYFORD RD</STREETADDRESS2>
<STREETADDRESS3>
</STREETADDRESS3>
<CITY>DUBLIN
16</CITY>
<PROVINCE>IE</PROVINCE>
<POSTCODE/>
<COUNTRY>IE</COUNTRY>
<VAT/>
<CONTACTNAME>Store
Manager</CONTACTNAME>
<CONTACTDIALCODE>001</CONTACTDIALCODE>
<CONTACTTELEPHONE>000000001</CONTACTTELEPHONE>
<CONTACTEMAIL/>
</DELIVERY>
<CONNUMBER></CONNUMBER>
<CUSTOMERREF>0_0</CUSTOMERREF>
<CONTYPE>N</CONTYPE>
<PAYMENTIND>S</PAYMENTIND>
<ITEMS>1</ITEMS>
<TOTALWEIGHT>10.000</TOTALWEIGHT>
<TOTALVOLUME>.062</TOTALVOLUME>
<CURRENCY/>
<GOODSVALUE/>
<INSURANCEVALUE/>
<INSURANCECURRENCY/>
<SERVICE>15N</SERVICE>
<OPTION/>
<DESCRIPTION>Box
No 50042196</DESCRIPTION>
<DELIVERYINST>Deliver
to Store</DELIVERYINST>
<CUSTOMCONTROLIN/>
<HAZARDOUS>N</HAZARDOUS>
<UNNUMBER/>
<PACKAGE>
<ITEMS>1</ITEMS>
<DESCRIPTION>Box
No 50042196</DESCRIPTION>
<LENGTH>.55</LENGTH>
<HEIGHT>.39</HEIGHT>
<WIDTH>.29</WIDTH>
<WEIGHT>10.000</WEIGHT>
</PACKAGE>
</DETAILS>
</CONSIGNMENT>
</CONSIGNMENTBATCH>
<ACTIVITY>
<CREATE>
<CONREF>50042196</CONREF>
</CREATE>
<RATE/>
<BOOK/>
<SHIP/>
<PRINT/>
<SHOW_GROUPCODE/>
</ACTIVITY>
</ESHIPPER>
recvresp(): entered
HTTP/1.1 400 Bad Request
Content-Type: text/html
Date: Mon, 03 Apr 2017 06:29:25
GMT
Connection: close
Content-Length: 34
SetError() #13: HTTP/1.1 400 Bad
Request
recvresp(): end with 400
recvdoc parms: identity 34
recvdoc(): entered
SetError() #0:
recvdoc(): Receiving 34 bytes.
<h1>Bad Request (Invalid
URL)</h1>
SetError() #13: HTTP/1.1 400 Bad
Request
http_close(): entered
************End of
Data********************
thanx
Peter Moore
Just Group Ltd
658 Church St, Richmond, VIC 3121 Australia
phone: +61 3 9420 0634
email: peter.moore@xxxxxxxxxx
www.justgroup.com.au
______________________________________________________________________
"This communication is confidential and is intended only for the
person(s) to whom it is addressed. If you receive it in error
please inform sender as soon as possible and destroy all forms of
it that you control. The information may not necessarily be
authorised by Just Group Ltd or any of its subsidiary companies.
Such should not be taken as a communication of the Just Group
unless from a responsible and authorised executive acting in their
official capacity. Should this e-mail contain any inappropriate
material please inform the HR Division of the Just Group Ltd (03)
9420 0200."
______________________________________________________________________
|