[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Consume WCF web service with .svc extension
Hi,
Still I am getting the same error. Below are the details from my debug
log. Also attached is the program which I modified using your example16
from LIBHTTP. Would be really grateful if you can help me understand my
error.� HTTPAPI Ver 1.24 released 2012-01-23 �� OS/400 Ver V5R4M0 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � http_persist_open(): entered � � � � �� http_long_ParseURL(): entered � � � � � DNS resolver retrans: 2 � � � � � � � � DNS resolver retry �: 2 � � � � � � � � DNS resolver options: x'00000136' � � � DNS default domain: [1]AON.COM � � � � � � DNS server found: 10.191.2.65 � � � � � DNS server found: 10.184.2.65 � � � � � DNS server found: 10.178.200.20 � � � � http_persist_post(): entered � � � � �� http_persist_req(POST) entered. � � � � http_long_ParseURL(): entered � � � � � do_oper(POST): entered � � � � � � � �� There are 0 cookies in the cache � � �� POST /wcf/CurrencyService.svc HTTP/1.1� POST /wcf/CurrencyService.svc HTTP/1.1 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � Host: [2]www.restfulwebservices.net � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � User-Agent: http-api/1.24 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� Content-Type: text/xml � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � SOAPAction: GetConversionRate � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� Content-Length: 393 � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � �� senddoc(): entered � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � � <?xml version="1.0" encoding="iso-8859-1"
standalone="no"?><soapenv:Envelope
xmlns:soapenv="[1][3]http://schemas.xmlsoap.org/soap/envellope/"
xmlns:ns="[2][4]http://www.restfulwebservices.net/ServiceContracts/2008
/01"><soapenv:Header/><soapenv:Body><ns:GetConversionRate><ns:FromCurre
ncy>USD</ns:FromCurrency><ns:ToCurrency>EUR</ns:ToCurrency></ns:GetConv
ersionRate></soapenv:Body></soapenv:Envelope>
recvresp(): entered � � � � � � � � HTTP/1.1 400 Bad Request � � � � �� Server: Microsoft-IIS/7.0 � � � � � X-Powered-By: [5]ASP.NET � � � � � � � Date: Thu, 28 Aug 2014 05:19:45 GMT
Content-Length: 0 � � � � � � � � � Connection: Keep-Alive � � � � � �� � � � � � � � � � � � � � � � � � � � �� SetError() #13: HTTP/1.1 400 Bad Request
recvresp(): end with 400 � � � � � � � � recvdoc parms: identity 0 � � � � � � �� header_load_cookies() entered � � � � �� recvdoc(): entered � � � � � � � � � � � SetError() #0: � � � � � � � � � � � � � SetError() #13: HTTP/1.1 400 Bad Request
http_close(): entered � � � � � � � � �� Thanks,
Nikhil
On Thu, Aug 28, 2014 at 1:21 AM, Charles Wilt
<[6]charles.wilt@xxxxxxxxx> wrote:
� �The extension doesn't matter...it's a standard SOAP web service
� ��(though there is a REST version also)
� �Sending it an XML like so:
� �<soapenv:Envelope
� �xmlns:soapenv="[1][7]http://schemas.xmlsoap.org/soap/envelope/"
� �xmlns:ns="[2][8]http://www.restfulwebservices.net/ServiceContracts
/2008/01
� �">
� �� �<soapenv:Header/>
� �� �<soapenv:Body>
� �� � � <ns:GetConversionRate>
� �� � � � �<ns:FromCurrency>USD</ns:FromCurrency>
� �� � � � �<ns:ToCurrency>EUR</ns:ToCurrency>
� �� � � </ns:GetConversionRate>
� �� �</soapenv:Body>
� �</soapenv:Envelope>
� �Gets a response back of:
� �<s:Envelope
xmlns:s="[3][9]http://schemas.xmlsoap.org/soap/envelope/">
� �� �<s:Body>
� �� � � <GetConversionRateResponse
� �xmlns="[4][10]http://www.restfulwebservices.net/ServiceContracts/2
008/01">
� �� � � � �<GetConversionRateResult
� �xmlns:a="[5][11]http://www.restfulwebservices.net/DataContracts/20
08/01"
� �xmlns:i="[6][12]http://www.w3.org/2001/XMLSchema-instance">
� �� � � � � � <a:FromCurrency>USD</a:FromCurrency>
� �� � � � � � <a:ToCurrency>EUR</a:ToCurrency>
� �� � � � � � <a:Rate>0.7577</a:Rate>
� �� � � � �</GetConversionRateResult>
� �� � � </GetConversionRateResponse>
� �� �</s:Body>
� �</s:Envelope>
� �Scott's presentation on consuming Web services is a good place
to start
� �[7][13]http://www.scottklement.com/presentations/#HTTPAPI
� �Otherwise, turn on HTTP debuging
� �callp http_debug(*ON);
� �And post the resulting log
� �/tmp/httpapi_debug.txt
� �Charles
� �On Wed, Aug 27, 2014 at 12:58 PM, Nikhil Rustagi
� �<[8][14]nik.rust@xxxxxxxxx> wrote:
� � �� �Hi,
� � �� �I have been trying to consume a wcf service using
HTTPAPI, but
� � �have
� � �� �been consistently getting error code 400 'Bad
Request'. Is � � � �there any
� � �� �example which I can use to consume a wcf service. The
current
� � �examples
� � �� �all use .asmx services.� � � �� �I tried with the below service:
� � �� � [1][9][15]http://www.restfulwebservices.net/wcf/CurrencyService.svc
� � �� �Nikhil
� � �References
� � �� �1.
� � �[10][16]http://www.restfulwebservices.net/wcf/CurrencyService.svc?
wsdl
� � �------------------------------------------------------------------
--
� � �---
� � �This is the FTPAPI mailing list.� To unsubscribe, please
go to:
� � �[11][17]http://www.scottklement.com/mailman/listinfo/ftpapi
� � �------------------------------------------------------------------
--
� � �---
References
� �1. [18]http://schemas.xmlsoap.org/soap/envelope/
� �2.
[19]http://www.restfulwebservices.net/ServiceContracts/2008/01
� �3. [20]http://schemas.xmlsoap.org/soap/envelope/
� �4.
[21]http://www.restfulwebservices.net/ServiceContracts/2008/01
� �5. [22]http://www.restfulwebservices.net/DataContracts/2008/01
� �6. [23]http://www.w3.org/2001/XMLSchema-instance
� �7. [24]http://www.scottklement.com/presentations/#HTTPAPI
� �8. mailto:[25]nik.rust@xxxxxxxxx
� �9.
[26]http://www.restfulwebservices.net/wcf/CurrencyService.svc
� 10.
[27]http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
� 11. [28]http://www.scottklement.com/mailman/listinfo/ftpapi
--------------------------------------------------------------------
---
This is the FTPAPI mailing list.� To unsubscribe, please go to:
[29]http://www.scottklement.com/mailman/listinfo/ftpapi
--------------------------------------------------------------------
---
References
1. http://AON.COM/
2. http://www.restfulwebservices.net/
3. http://schemas.xmlsoap.org/soap/envellope/
4. http://www.restfulwebservices.net/ServiceContracts/2008/01
5. http://ASP.NET/
6. mailto:charles.wilt@xxxxxxxxx
7. http://schemas.xmlsoap.org/soap/envelope/
8. http://www.restfulwebservices.net/ServiceContracts/2008/01
9. http://schemas.xmlsoap.org/soap/envelope/
10. http://www.restfulwebservices.net/ServiceContracts/2008/01
11. http://www.restfulwebservices.net/DataContracts/2008/01
12. http://www.w3.org/2001/XMLSchema-instance
13. http://www.scottklement.com/presentations/#HTTPAPI
14. mailto:nik.rust@xxxxxxxxx
15. http://www.restfulwebservices.net/wcf/CurrencyService.svc
16. http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
17. http://www.scottklement.com/mailman/listinfo/ftpapi
18. http://schemas.xmlsoap.org/soap/envelope/
19. http://www.restfulwebservices.net/ServiceContracts/2008/01
20. http://schemas.xmlsoap.org/soap/envelope/
21. http://www.restfulwebservices.net/ServiceContracts/2008/01
22. http://www.restfulwebservices.net/DataContracts/2008/01
23. http://www.w3.org/2001/XMLSchema-instance
24. http://www.scottklement.com/presentations/#HTTPAPI
25. mailto:nik.rust@xxxxxxxxx
26. http://www.restfulwebservices.net/wcf/CurrencyService.svc
27. http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
28. http://www.scottklement.com/mailman/listinfo/ftpapi
29. http://www.scottklement.com/mailman/listinfo/ftpapi
* This is an example of calling a SOAP Web service w/HTTPAPI.
*
* This sample calls the Currency Exchange Rate Web service
* provided by WebserviceX.net. For more info, search for it
* at http://www.WebserviceX.net
*
* To Compile (requires V5R1):
* CRTBNDRPG PGM(EXAMPLE16) SRCFILE(libhttp/QRPGLESRC)
*
* To Run:
* CALL EXAMPLE16 PARM('USD' 'JPY' 12.00)
*
* (This shows the value of USD 12.00 in Japanese currency.)
*
H DFTACTGRP(*NO) BNDDIR('HTTPAPI':'QC2LE')
D WEBSRVSUBA PR ExtPgm('WEBSRVSUBA')
D Country1 3A const
D Country2 3A const
D Amount 15P 5 const
D WEBSRVSUBA PI
D Country1 3A const
D Country2 3A const
D Amount 15P 5 const
/copy httpapi_h
D Incoming PR
D rate 8F
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 SOAP s 32767A varying
D rc s 10I 0
D rate s 8F
D Result s 12P 2
/free
if ( %parms < 3 );
http_comp( 'Please pass parms. e.g. CALL WEBSRVSUBA '
+ 'PARM(USD JPY 12.00)');
return;
endif;
// Note: http_debug(*ON/*OFF) can be used to turn debugging
// on and off. When debugging is turned on, diagnostic
// info is written to an IFS file named
// /tmp/httpapi_debug.txt
http_debug(*ON);
// Note: http_XmlStripCRLF(*ON/*OFF) controls whether or not
// the XML parser removes CR and LF characters from the
// Xml data that's passed to your 'Incoming' procedure.
http_XmlStripCRLF(*ON);
SOAP =
'<?xml version="1.0" encoding="iso-8859-1" standalone="no"?>'
+'<soapenv:Envelope'
+' xmlns:soapenv="[1]http://schemas.xmlsoap.org/soap/envelope/"'
+' xmlns:ns="[2]http://www.restfulwebservices.net/ServiceContracts/2008/'
+'01">'
+'<soapenv:Header/>'
+'<soapenv:Body>'
+'<ns:GetConversionRate>'
+'<ns:FromCurrency>'+ %trim(Country1) +'</ns:FromCurrency>'
+'<ns:ToCurrency>'+ %trim(Country2) + '</ns:ToCurrency>'
+'</ns:GetConversionRate>'
+'</soapenv:Body>'
+'</soapenv:Envelope>';
http_debug(*ON);
rc = http_url_post_xml(
'http://www.restfulwebservices.net/wcf/CurrencyService.svc'
: %addr(SOAP) + 2
: %len(SOAP)
: *NULL
: %paddr(Incoming)
: %addr(rate)
: HTTP_TIMEOUT
: HTTP_USERAGENT
: 'text/xml'
: 'GetConversionRate');
if (rc <> 1);
http_crash();
else;
Result = %dech(Amount * rate: 12: 2);
http_comp(%trim(Country1) + ' ' + %char(%dec(Amount:12:2))
+ ' = ' + %trim(Country2) + ' '+ %char(Result));
endif;
*inlr = *on;
/end-free
P Incoming B
D Incoming PI
D rate 8F
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 atof PR 8F extproc('atof')
D string * value options(*string)
/free
if (name = 'a:Rate');
rate = atof(value);
endif;
/end-free
P E
-----------------------------------------------------------------------
This is the FTPAPI mailing list. To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------