> I am trying to connect to a .Net web service in foxpro 8. If I connect to a web service that is not password protected, it works fine. However, when I try to connect to a web service that is password protected, I get this error:
>
> OLE IDispatch exception code 0 from WSDLReader: WSDLReader:XML Parser failed at linenumber 0, lineposition 0, reason is: Access is denied.
> HRESULT=0x1: Incorrect function.
> - WSDLReader:Loading of the WSDL file failed HRESULT=0x80070057: The parameter is incorrect.
> - Client:One of the parameters supplied is invalid. HRESULT=0x80070057: The parameter is incorrect.
>
>
> The WSDLReader is called inside of SOAPCLIENT_INIT method...See below:
>
> **This code is part of the foxpro class WSHandler--> connectws method
>
> * SOAPCLIENT_CLASS => "MSSOAP.SoapClient30"
> THIS.wsObject = CREATEOBJECT(SOAPCLIENT_CLASS)
> THIS.SetClientProperties()
> THIS.wsObject.SOAPCLIENT_INIT(THIS.WSDL, THIS.Service, THIS.Port, THIS.WSML)
> THIS.SetConnectorProperties()
>
> I have read that you can set the proxy user name and password in the SetConnectorProperties(), but this this doesn't seem to make since, because the access denied error occurs on the SOAPCLIENT_INIT line. (Before SetConnectorProperties() is encountered)
>
> If anyone has connected to a webservice on a password protected website, please help!!!
>
> Thank you,
>
> Darren Shafer
> Amerisafe Insurance Co, Inc.
> Programmer / Analyst
I figured out why this wasn't working and I figured I would post the solution in case anyone else was wondering. If you are trying to access a webservice that is protected using BASIC AUTHENTICATION then the following code will allow you to send a username, password with your soap request:
*Create a Simple Object Access Protocol Object
wsClient = CREATEOBJECT("MSSOAP.SoapClient30")
*Attempt to read the Wsdl file for the webservice
wsClient.mssoapinit([WebServicePath],[WebServiceName])
*Authentication
wsClient.ConnectorProperty("AuthUser") = ALLTRIM([username])
wsClient.ConnectorProperty("AuthPassword") = ALLTRIM([password])
*When using Soap 3.0, set Authentication Scheme property ( 1 is for Basic Authentication)
wsClient.ConnectorProperty("WinHTTPAuthScheme") = 1
Monday, December 21, 2009
MSSOAP Error
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment