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

Trying to call an in house IIS web-service from RPGLE



   I'm trying to call a windows web-service that has been written in
   house.  It is used in our .Net world and I can call it using Asna's AVR
   product or C# code, by using code below:

    Uri uri = new Uri("http://"; + environment +
   "/SDI/Services/SdiExternalService.svc");

   this._sdiService = new
   SdiExternalServiceReference.SdiExternalServiceClient("Sdi.Portal.Servic
   es.SdiExternalService", new EndpointAddress(uri));

   I then can call a method in that service by:

   this.SdiService.GetPolicyBalance(companyPolicyNumber)


   I have created an RPG-ILE program to call this web-service and I'm
   getting an error:

   "This page requires a user-id & password"


   Below are the calls to HTTPapi's I have in sequence:

    ** If debug of HTTPapi is requested then turn it on!

   C                   If        XDEBUG = 'Y'

   C                   CallP     http_debug(*ON)

   C                   Else

   C                   CallP     http_debug(*OFF)

   C                   EndIF

    ** Send User Id and PW to log on!

   C                   CallP     http_setauth(HTTP_AUTH_BASIC:

   C                                            xID: xPW)

   C                   If        rc < 0

   C                   Eval      msg = http_error

   C                   Dsply                   msg

   C                   CallP     HTTP_Crash()

   C                   Return

   C                   EndIF

    ** Call Web-Service and get back response
   nse.

   C                   Eval      rc=http_url_post(%trim(URL):
       URL

   C
   %addr(iSymPolicy):                      Pointer data out

   C
   %len(iSymPolicy):                       size data out

   C
   %trim(oPolBalance))                     Response Back

   C                   If        rc <>
   1

   C                   Eval      msg = http_error

   C                   Dsply
   msg

   C                   CallP
   https_cleanup()

   C                   CallP     HTTP_Crash()

   C
   Return

   C                   EndIF


   I've tried various URL's formats:

   [1]http://172.25.85.1/SDI/Services/SdiExternalService.svc

   [2]http://172.25.85.1/SDI/Services/SdiExternalService/GetPolicyBalance.
   svc

   Both giving me the "This page requires a user-id & password" message.
   I've checked my fields xID and XPW and they have a valid UserID and PW
   combination.  If I take the first url and past it into a browser it
   asks me for UserId/PW the first time and the one I'm supplying in the
   program will sign on and give me basic MS website for service which
   gives the link to the wsdl.

   I've got this working on a vendors website that required Digital Cert
   using this approc, so I'm nost sure why I'm getting the error about
   UserId/PW unless there is something I'm not doing correctly in setting
   everything up.  Below is the httpapi_debug.txt file from the IFS for
   this test.

   If you can point me to the error of my ways it would be appreciated!

   Thanks,

   -- Jim


   ....+....1....+....2....+....3....+....4....+....5....+....6....+....7.
   ...+....8

    ************Beginning of
   data**************

   HTTPAPI Ver 1.24beta8 released
   2009-12-28

   OS/400 Ver V6R1M0



   http_setauth():
   entered

   http_url_post(): entered

   http_persist_open():
   entered

   http_long_ParseURL():
   entered

   DNS resolver retrans: 2

   DNS resolver retry  :
   2

   DNS resolver options:
   x'00000136'

   DNS default domain:
   MFBSADV.MOFBDV.COM

   WARNING: No name servers are configured for DNS resolution! You will
   not be able...

   http_persist_post():
   entered

   http_long_ParseURL():
   entered

   do_oper(POST):
   entered

   POST /SDI/Services/SdiExternalService.svc
   HTTP/1.1

   Host: 172.25.85.1

   User-Agent:
   http-api/1.24

   Content-Type: text/xml

   Content-Length: 10

   Authorization: Basic TG93YXJqOkplbG8xMjNy


   senddoc(): entered

   APV0325113

   recvresp(): entered

   HTTP/1.1 401 Unauthorized

   Content-Type: text/html

   Server: Microsoft-IIS/7.5

   WWW-Authenticate: Negotiate

   WWW-Authenticate: NTLM

   X-Powered-By: ASP.NET

   Date: Fri, 19 Oct 2012 13:57:17 GMT

   Content-Length: 1293


   Jim Lowary


   Missouri Farm Bureau Information Technology Department

   Programmer/Analyst IV

   701 South Country Club Drive  |  (573) 893-1427 ext. 2607

   Jefferson City, MO 65102          |  [3]JLowary@xxxxxxxx

References

   1. http://172.25.85.1/SDI/Services/SdiExternalService.svc
   2. http://172.25.85.1/SDI/Services/SdiExternalService/GetPolicyBalance.svc
   3. mailto:JLowary@xxxxxxxx
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------