[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Consume WCF web service with .svc extension



   It appears that this web service does not like the
   encoding="iso-8859-1" that you have specified in your XML processing
   instructions (the first line of the XML document you're sending.
   Probably it doesn't want the document to send an encoding (instead it
   expects the encoding to be within the HTTP transaction, if necessary).
   Please remove the encoding (just delete it) from your XML processing
   instructions, recompile your RPG, and try again.
   On 8/28/2014 12:34 AM, Nikhil Rustagi wrote:

   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 �  �  �  �  �  �
 �  �  �  �  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �
   http_persist_open(): entered �  �  �  �  �
 �
   http_long_ParseURL(): entered �  �  �  �  &#65533
;
   DNS resolver retrans: 2 �  �  �  �  �  &#6
5533;  �  �
   DNS resolver retry � : 2 �  �  �  �  &#655
33;  �  �  �
   DNS resolver options: x'00000136' �  �  �
   DNS default domain: [1]AON.COM �  �  �  �  &#6553
3;  �
   DNS server found: 10.191.2.65 �  �  �  �  &#65533
;
   DNS server found: 10.184.2.65 �  �  �  �  &#65533
;
   DNS server found: 10.178.200.20 �  �  �  �
   http_persist_post(): entered �  �  �  �  �
 �
   http_persist_req(POST) entered. �  �  �  �
   http_long_ParseURL(): entered �  �  �  �  &#65533
;
   do_oper(POST): entered �  �  �  �  �  &#65
533;  �  � �
   There are 0 cookies in the cache �  �  � �
   POST /wcf/CurrencyService.svc HTTP/1.1�
   POST /wcf/CurrencyService.svc HTTP/1.1 �  �  �  �
  �  �  �  �  �  �  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �
   Host: [2]www.restfulwebservices.net �  �  �  �  &
#65533;  �  �  �  �  �  �  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �
   User-Agent: http-api/1.24 �  �  �  �  �  &
#65533;  �  �  �  �  �  �  �  &
#65533;  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  � �
   Content-Type: text/xml �  �  �  �  �  &#65
533;  �  �  �  �  �  �  �  &#65
533;  �  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �
   SOAPAction: GetConversionRate �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  � �
   Content-Length: 393 �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  � �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  � �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  � �
   senddoc(): entered �  �  �  �  �  �
  �  �  �  �  �  �  �  �
  �  �  �
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   �  �  �  �  �  �  �  &#65533
;  �  �  �  �  �  �  �  &#65533
;
   <?xml version="1.0" encoding="iso-8859-1"
   standalone="no"?><soapenv:Envelope
   xmlns:soapenv="[1][3][1]http://schemas.xmlsoap.org/soap/envellope/";
   xmlns:ns="[2][4][2]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 &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533
;  &#65533;  &#65533;
   HTTP/1.1 400 Bad Request &#65533;  &#65533;  &#65533;  &#65533;  &#65533; &#6
5533;
   Server: Microsoft-IIS/7.0 &#65533;  &#65533;  &#65533;  &#65533;  &#65533;
   X-Powered-By: [5]ASP.NET &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#
65533;  &#65533;
   Date: Thu, 28 Aug 2014 05:19:45 GMT
   Content-Length: 0 &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;
 &#65533;  &#65533;  &#65533;
   Connection: Keep-Alive &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65
533; &#65533;
   &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533
;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533
;  &#65533;  &#65533;  &#65533;  &#65533; &#65533;
   SetError() #13: HTTP/1.1 400 Bad Request
   recvresp(): end with 400 &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#
65533;  &#65533;  &#65533;
   recvdoc parms: identity 0 &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &
#65533;  &#65533; &#65533;
   header_load_cookies() entered &#65533;  &#65533;  &#65533;  &#65533;  &#65533
; &#65533;
   recvdoc(): entered &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;
  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;
   SetError() #0: &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#
65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#65533;
   SetError() #13: HTTP/1.1 400 Bad Request
   http_close(): entered &#65533;  &#65533;  &#65533;  &#65533;  &#65533;  &#655
33;  &#65533;  &#65533;  &#65533; &#65533;
   Thanks,
   Nikhil

   On Thu, Aug 28, 2014 at 1:21 AM, Charles Wilt
   [3]<[6]charles.wilt@xxxxxxxxx> wrote:

     &#65533;  &#65533; The extension doesn't matter...it's a standard SOAP web
service
     &#65533;  &#65533; &#65533; (though there is a REST version also)
     &#65533;  &#65533; Sending it an XML like so:
     &#65533;  &#65533; <soapenv:Envelope
     &#65533;  &#65533; xmlns:soapenv="[1][7][4]http://schemas.xmlsoap.org/soap/
envelope/"
     &#65533;
     &#65533; xmlns:ns="[2][8][5]http://www.restfulwebservices.net/ServiceContra
cts
     /2008/01
     &#65533;  &#65533; ">
     &#65533;  &#65533; &#65533;&#65533;  &#65533; <soapenv:Header/>
     &#65533;  &#65533; &#65533;&#65533;  &#65533; <soapenv:Body>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  <n
s:GetConversionRate>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533; <ns:FromCurrency>USD</ns:FromCurrency>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533; <ns:ToCurrency>EUR</ns:ToCurrency>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  </
ns:GetConversionRate>
     &#65533;  &#65533; &#65533;&#65533;  &#65533; </soapenv:Body>
     &#65533;  &#65533; </soapenv:Envelope>
     &#65533;  &#65533; Gets a response back of:
     &#65533;  &#65533; <s:Envelope
     xmlns:s="[3][9][6]http://schemas.xmlsoap.org/soap/envelope/";>
     &#65533;  &#65533; &#65533;&#65533;  &#65533; <s:Body>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  <G
etConversionRateResponse
     &#65533;
     &#65533; xmlns="[4][10][7]http://www.restfulwebservices.net/ServiceContract
s/2
     008/01">
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533; <GetConversionRateResult
     &#65533;
     &#65533; xmlns:a="[5][11][8]http://www.restfulwebservices.net/DataContracts
/20
     08/01"
     &#65533;  &#65533; xmlns:i="[6][12][9]http://www.w3.org/2001/XMLSchema-inst
ance">
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  <a:FromCurrency>USD</a:FromC
urrency>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  <a:ToCurrency>EUR</a:ToCurre
ncy>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  <a:Rate>0.7577</a:Rate>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  &#
65533;&#65533;  &#65533; </GetConversionRateResult>
     &#65533;  &#65533; &#65533;&#65533;  &#65533;&#65533;  &#65533;&#65533;  </
GetConversionRateResponse>
     &#65533;  &#65533; &#65533;&#65533;  &#65533; </s:Body>
     &#65533;  &#65533; </s:Envelope>
     &#65533;  &#65533; Scott's presentation on consuming Web services is a good
 place
     to start
     &#65533;  &#65533; [7][13][10]http://www.scottklement.com/presentations/#HT
TPAPI
     &#65533;  &#65533; Otherwise, turn on HTTP debuging
     &#65533;  &#65533; callp http_debug(*ON);
     &#65533;  &#65533; And post the resulting log
     &#65533;  &#65533; /tmp/httpapi_debug.txt
     &#65533;  &#65533; Charles
     &#65533;  &#65533; On Wed, Aug 27, 2014 at 12:58 PM, Nikhil Rustagi
     &#65533;  &#65533; [11]<[8][14]nik.rust@xxxxxxxxx> wrote:
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; Hi,
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; I have been trying
to consume a wcf service using
     HTTPAPI, but
     &#65533;  &#65533;  &#65533; have
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; been consistently g
etting error code 400 'Bad
     Request'. Is &#65533;
     &#65533;  &#65533;  &#65533; there any
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; example which I can
 use to consume a wcf service. The
     current
     &#65533;  &#65533;  &#65533; examples
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; all use .asmx servi
ces.&#65533;
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; I tried with the be
low service:
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533;
     [1][9][15][12]http://www.restfulwebservices.net/wcf/CurrencyService.svc
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; Nikhil
     &#65533;  &#65533;  &#65533; References
     &#65533;  &#65533;  &#65533; &#65533;&#65533;  &#65533; 1.
     &#65533;  &#65533;
     &#65533; [10][16][13]http://www.restfulwebservices.net/wcf/CurrencyService.
svc?
     wsdl
     &#65533;  &#65533;
     &#65533; ------------------------------------------------------------------
     --
     &#65533;  &#65533;  &#65533; ---
     &#65533;  &#65533;  &#65533; This is the FTPAPI mailing list.&#65533;&#6553
3;  To unsubscribe, please
     go to:
     &#65533;  &#65533;  &#65533; [11][17][14]http://www.scottklement.com/mailma
n/listinfo/ftpapi
     &#65533;  &#65533;
     &#65533; ------------------------------------------------------------------
     --
     &#65533;  &#65533;  &#65533; ---
     References
     &#65533;  &#65533; 1. [18][15]http://schemas.xmlsoap.org/soap/envelope/
     &#65533;  &#65533; 2.
     [19][16]http://www.restfulwebservices.net/ServiceContracts/2008/01
     &#65533;  &#65533; 3. [20][17]http://schemas.xmlsoap.org/soap/envelope/
     &#65533;  &#65533; 4.
     [21][18]http://www.restfulwebservices.net/ServiceContracts/2008/01
     &#65533;  &#65533; 5. [22][19]http://www.restfulwebservices.net/DataContrac
ts/2008/01
     &#65533;  &#65533; 6. [23][20]http://www.w3.org/2001/XMLSchema-instance
     &#65533;  &#65533; 7. [24][21]http://www.scottklement.com/presentations/#HT
TPAPI
     &#65533;  &#65533; 8. mailto:[[22]25]nik.rust@xxxxxxxxx
     &#65533;  &#65533; 9.
     [26][23]http://www.restfulwebservices.net/wcf/CurrencyService.svc
     &#65533;  10.
     [27][24]http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
     &#65533;  11. [28][25]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---
     This is the FTPAPI mailing list.&#65533;  To unsubscribe, please go to:
     [29][26]http://www.scottklement.com/mailman/listinfo/ftpapi
     --------------------------------------------------------------------
     ---

References

   1. [27]http://AON.COM/
   2. [28]http://www.restfulwebservices.net/
   3. [29]http://schemas.xmlsoap.org/soap/envellope/
   4. [30]http://www.restfulwebservices.net/ServiceContracts/2008/01
   5. [31]http://ASP.NET/
   6. [32]mailto:charles.wilt@xxxxxxxxx
   7. [33]http://schemas.xmlsoap.org/soap/envelope/
   8. [34]http://www.restfulwebservices.net/ServiceContracts/2008/01
   9. [35]http://schemas.xmlsoap.org/soap/envelope/
  10. [36]http://www.restfulwebservices.net/ServiceContracts/2008/01
  11. [37]http://www.restfulwebservices.net/DataContracts/2008/01
  12. [38]http://www.w3.org/2001/XMLSchema-instance
  13. [39]http://www.scottklement.com/presentations/#HTTPAPI
  14. [40]mailto:nik.rust@xxxxxxxxx
  15. [41]http://www.restfulwebservices.net/wcf/CurrencyService.svc
  16. [42]http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
  17. [43]http://www.scottklement.com/mailman/listinfo/ftpapi
  18. [44]http://schemas.xmlsoap.org/soap/envelope/
  19. [45]http://www.restfulwebservices.net/ServiceContracts/2008/01
  20. [46]http://schemas.xmlsoap.org/soap/envelope/
  21. [47]http://www.restfulwebservices.net/ServiceContracts/2008/01
  22. [48]http://www.restfulwebservices.net/DataContracts/2008/01
  23. [49]http://www.w3.org/2001/XMLSchema-instance
  24. [50]http://www.scottklement.com/presentations/#HTTPAPI
  25. [51]mailto:nik.rust@xxxxxxxxx
  26. [52]http://www.restfulwebservices.net/wcf/CurrencyService.svc
  27. [53]http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
  28. [54]http://www.scottklement.com/mailman/listinfo/ftpapi
  29. [55]http://www.scottklement.com/mailman/listinfo/ftpapi


-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
[56]http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

References

   1. http://schemas.xmlsoap.org/soap/envellope/
   2. http://www.restfulwebservices.net/ServiceContracts/2008
   3. mailto:[6]charles.wilt@xxxxxxxxx
   4. http://schemas.xmlsoap.org/soap/envelope/
   5. http://www.restfulwebservices.net/ServiceContracts
   6. http://schemas.xmlsoap.org/soap/envelope/
   7. http://www.restfulwebservices.net/ServiceContracts/2
   8. http://www.restfulwebservices.net/DataContracts/20
   9. http://www.w3.org/2001/XMLSchema-instance
  10. http://www.scottklement.com/presentations/#HTTPAPI
  11. mailto:[8][14]nik.rust@xxxxxxxxx
  12. http://www.restfulwebservices.net/wcf/CurrencyService.svc
  13. http://www.restfulwebservices.net/wcf/CurrencyService.svc
  14. http://www.scottklement.com/mailman/listinfo/ftpapi
  15. http://schemas.xmlsoap.org/soap/envelope/
  16. http://www.restfulwebservices.net/ServiceContracts/2008/01
  17. http://schemas.xmlsoap.org/soap/envelope/
  18. http://www.restfulwebservices.net/ServiceContracts/2008/01
  19. http://www.restfulwebservices.net/DataContracts/2008/01
  20. http://www.w3.org/2001/XMLSchema-instance
  21. http://www.scottklement.com/presentations/#HTTPAPI
  22. mailto:25]nik.rust@xxxxxxxxx
  23. http://www.restfulwebservices.net/wcf/CurrencyService.svc
  24. http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
  25. http://www.scottklement.com/mailman/listinfo/ftpapi
  26. http://www.scottklement.com/mailman/listinfo/ftpapi
  27. http://AON.COM/
  28. http://www.restfulwebservices.net/
  29. http://schemas.xmlsoap.org/soap/envellope/
  30. http://www.restfulwebservices.net/ServiceContracts/2008/01
  31. http://ASP.NET/
  32. mailto:charles.wilt@xxxxxxxxx
  33. http://schemas.xmlsoap.org/soap/envelope/
  34. http://www.restfulwebservices.net/ServiceContracts/2008/01
  35. http://schemas.xmlsoap.org/soap/envelope/
  36. http://www.restfulwebservices.net/ServiceContracts/2008/01
  37. http://www.restfulwebservices.net/DataContracts/2008/01
  38. http://www.w3.org/2001/XMLSchema-instance
  39. http://www.scottklement.com/presentations/#HTTPAPI
  40. mailto:nik.rust@xxxxxxxxx
  41. http://www.restfulwebservices.net/wcf/CurrencyService.svc
  42. http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
  43. http://www.scottklement.com/mailman/listinfo/ftpapi
  44. http://schemas.xmlsoap.org/soap/envelope/
  45. http://www.restfulwebservices.net/ServiceContracts/2008/01
  46. http://schemas.xmlsoap.org/soap/envelope/
  47. http://www.restfulwebservices.net/ServiceContracts/2008/01
  48. http://www.restfulwebservices.net/DataContracts/2008/01
  49. http://www.w3.org/2001/XMLSchema-instance
  50. http://www.scottklement.com/presentations/#HTTPAPI
  51. mailto:nik.rust@xxxxxxxxx
  52. http://www.restfulwebservices.net/wcf/CurrencyService.svc
  53. http://www.restfulwebservices.net/wcf/CurrencyService.svc?wsdl
  54. http://www.scottklement.com/mailman/listinfo/ftpapi
  55. http://www.scottklement.com/mailman/listinfo/ftpapi
  56. 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
-----------------------------------------------------------------------