Quantcast
Channel: West Wind Message Board Messages
Viewing all articles
Browse latest Browse all 10393

Re: newbie wwSoap

$
0
0
Re: newbie wwSoap
West Wind Client Tools
Re: newbie wwSoap
05/08/2012
06:49:34 PM
3HX14CQB6 Show this entire thread in new window
Gratar Image based on email address
From:
Rick Strahl
To:
Attachments:
None

Not sure... seems to work for me although I get NULL as a result which apparently means invalid username and password.


****************** *** USAGE EXAMPLE ****************** *** Load Proxy Class and Dependencies DO servicesproxy *** Create Proxy Instance & specify .NET version loProxy = CREATEOBJECT("servicesProxy","V2") *** Call your methods and retrieve result lcResult = loProxy.Login("adasdasd","asdasdas") ? lcResult && NULL *** Check for error message if result is failing ? loProxy.cErrorMsg RETURN

Using this code I see the message going to the server and returning an XML response. It won't work for me obviously since I don't have the right credentials, but it does run and return a response.

+++ Rick ---

ah!

ok, i'll switch.

downloaded the proxy generator and gave it a try....

DO servicesproxy
loProxy = CREATEOBJECT("servicesProxy","V2")
loresult = loproxy.login(alltrim(misc.uktuser),alltrim(misc.uktdpass))

... but loresult is NULL. cErrorMessage is empty.

any thoughts would be much appreciated....

thanks

n

*** Dependencies - DO servicesproxy.prg DO wwDotNetBridge SET PROCEDURE TO servicesproxy ADDITIVE #IF .F. ****************** *** USAGE EXAMPLE ****************** *** Load Proxy Class and Dependencies DO servicesproxy *** Create Proxy Instance & specify .NET version loProxy = CREATEOBJECT("servicesProxy","V2") *** Call your methods and retrieve result lcResult = loProxy.YourMethod("Parm1",22.12) *** Check for error message if result is failing ? loProxy.cErrorMsg #ENDIF ************************************************************* DEFINE CLASS servicesProxy AS Custom ************************************************************* *: Generated with West Wind .NET Web Service Proxy Generator *: Created: 05/08/12 12:33:03 PM *: *: It's recommended you don't modify this class as it may be *: regenerated. If you need customization use a subclass in *: separate PRG file that overrides behavior. ************************************************************* *** Stock Properties oBridge = null oService = null cServiceUrl = "https://www.uktenantdata.com/services.asmx" cWsdlUrl = "https://www.uktenantdata.com/services.asmx?wsdl" cAssemblyPath = LOWER(FULLPATH([servicesproxy.dll])) cComClass = "services.services" cErrorMsg = "" cErrorDetailXml = "" lError = .F. *** Holds any array based results DIMENSION aResult[1] ************************************************************************ * Init **************************************** *** Function: *** Assume: *** Pass: *** Return: ************************************************************************ FUNCTION Init(lcDotNetVersion,llNoLoad) IF !llNoLoad IF !this.LoadService(lcDotNetVersion) ERROR this.cErrorMsg ENDIF ENDIF ENDFUNC * Init ************************************************************************ * LoadService **************************************** *** Function: *** Assume: *** Pass: *** Return: ************************************************************************ FUNCTION LoadService(lcDotNetVersion) LOCAL loBridge as wwDotNetBridge IF ISNULL(this.oBridge) THIS.oBridge = CREATEOBJECT("wwDotNetBridge",lcDotNetVersion) IF !this.oBridge.Loadassembly(this.cAssemblyPath) this.cErrorMsg = this.oBridge.cErrorMsg RETURN .F. ENDIF ENDIF IF ISNULL(this.oService) this.oService = this.oBridge.Createinstance(this.cComClass) IF ISNULL(this.oService) this.cErrorMsg = this.oBridge.cErrorMsg RETURN .F. ENDIF *** For some reason accessing URL directly doesnt work - use indirect referencing *this.oService.Url = this.cServiceUrl this.oBridge.SetProperty(this.oService,"Url",this.cServiceUrl) ENDIF ENDFUNC * LoadService ************************************************************************ * isTokenValid **************************************** FUNCTION isTokenValid(tkn as Guid) as Boolean LOCAL loException as Exception, lvResult as Boolean THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oBridge.InvokeMethod(this.oService, "isTokenValid", tkn) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * isTokenValid ************************************************************************ * login **************************************** FUNCTION login(email as String,pwd as String) as utdNugget LOCAL loException as Exception, lvResult as utdNugget THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oBridge.InvokeMethod(this.oService, "login", email,pwd) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * login ************************************************************************ * addApplicants **************************************** FUNCTION addApplicants(tkn as Guid,id as Int32,apts as ApplicantArray) as Boolean LOCAL loException as Exception, lvResult as Boolean THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oService.addApplicants(tkn,id,@apts) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * addApplicants ************************************************************************ * newApplication **************************************** FUNCTION newApplication(tkn as Guid,movedate as DateTime,rent as Int32,tenancyperiod as Int32,address as PostalAddress,apts as ApplicantArray,autoadjustshares as Boolean) as Int32 LOCAL loException as Exception, lvResult as Int32 THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oService.newApplication(tkn,movedate,rent,tenancyperiod,address,@apts,autoadjustshares) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * newApplication ************************************************************************ * applicantRecommendation **************************************** FUNCTION applicantRecommendation(tkn as Guid,id as Int32) as RECOMMENDATION_ENUM LOCAL loException as Exception, lvResult as RECOMMENDATION_ENUM THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oBridge.InvokeMethod(this.oService, "applicantRecommendation", tkn,id) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * applicantRecommendation ************************************************************************ * adjustApplicantsShare **************************************** FUNCTION adjustApplicantsShare(tkn as Guid,id as Int32,apts as ApplicantArray) as Boolean LOCAL loException as Exception, lvResult as Boolean THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oService.adjustApplicantsShare(tkn,id,@apts) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * adjustApplicantsShare ************************************************************************ * applicantStatus **************************************** FUNCTION applicantStatus(tkn as Guid,id as Int32) as Int32 LOCAL loException as Exception, lvResult as Int32 THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oBridge.InvokeMethod(this.oService, "applicantStatus", tkn,id) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * applicantStatus ************************************************************************ * applicationRecommendation **************************************** FUNCTION applicationRecommendation(tkn as Guid,id as Int32,rc as AGENT_RECOMMENDATION_ENUM) as Boolean LOCAL loException as Exception, lvResult as Boolean THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oBridge.InvokeMethod(this.oService, "applicationRecommendation", tkn,id,rc) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * applicationRecommendation ************************************************************************ * applicantCreditReport **************************************** FUNCTION applicantCreditReport(tkn as Guid,id as Int32) as CreditReport LOCAL loException as Exception, lvResult as CreditReport THIS.lError = .F. this.cErrorMsg = "" lvResult = .F. TRY lvResult = this.oBridge.InvokeMethod(this.oService, "applicantCreditReport", tkn,id) CATCH to loException THIS.GetErrorDetail(loException) ENDTRY RETURN lvResult ENDFUNC * applicantCreditReport ************************************************************************ * GetErrorDetail **************************************** *** Function: Internal method to pick up error information *** from exceptions ************************************************************************ PROTECTED FUNCTION GetErrorDetail(loException,laError) LOCAL loException, loType, lcTypeName this.lError = .T. this.cErrorDetailXml = "" this.cErrorMsg = loException.Message IF AT("OLE ",this.cErrorMsg) > 0 AND AT(":",this.cErrorMsg) > 0 this.cErrorMsg = ALLTRIM(SUBSTR(this.cErrorMsg,AT(":",this.cErrorMsg) + 1)) ENDIF *** Make sure we're dealing with a SOAP Exception loException = THIS.oBridge.oDotnetBridge.LastException IF ISNULL(loException) OR ISNULL(loException.InnerException) RETURN ENDIF IF TYPE("loException.InnerException") = "O" loException = loException.InnerException ENDIF loType = this.oBridge.InvokeMethod(loException,"GetType") lcTypeName = this.oBridge.GetProperty(loType,"Name") IF lcTypeName != "SoapException" RETURN ENDIF *** Grab the full XML Error Detail block this.cErrorDetailXml = this.oBridge.GetPropertyEx(loException,"Detail.OuterXml") ENDFUNC * GetErrorDetail ENDDEFINE



Hi Nigel,

wwSoap is pretty old and no longer fully supported. It doesn't work with everything and it never was intended to. It does some things better than the SOAP toolkit (namely objects) but it doesn't necessarily work with everything. For this reason we discontinued further devlopment on it a few years back and moved to a different architecture using .NET as a proxy which is much more reliable.

West Wind Web Service Proxy Generator

which is a much more stable platform that is maintained by Microsoft's WSDL parsing engine. The complexities of keeping up with the huge number of variations in services was too much for us to manage with wwSoap going forward.

FWIW, in your example, the service is not expecting an email and password parameter but a complex object that has email and passowrd properties, so you need to pass this complex type not the individual values.

+++ Rick ---



hello ?

hi..

using the ms soap toolkit this code returns an xml object


THIS.owshandler = NEWOBJECT("WSHandler","_ws3client.vcx") THIS.ows = THIS.owshandler.SetupClient("https://www.uktenantdata.com/services.asmx?wsdl", "services", "servicesSoap") loNugget = THIS.ows.login(ALLTRIM(misc.uktduser),ALLTRIM(misc.uktdpass)) THIS.token = loNugget.ITEM(0).TEXT

but this .callwsdlmethod is returning .t.

DO wwsoap this.ows = CREATEOBJECT("wwSOAP") loSDL = this.ows.parseservicewsdl("https://www.uktenantdata.com/services.asmx?wsdl") this.ows.addparameter("email",ALLTRIM(misc.uktduser)) this.ows.addparameter("pwd",ALLTRIM(misc.uktdpass)) loNugget = this.ows.callwsdlmethod("login",losdl)

What am i missing?

the relevant bit from the wsdl looks like this

<s:element name="login">
<s:complexType>
<s:sequence>
<s:element name="email" type="s:string" maxOccurs="1" minOccurs="0"/>
<s:element name="pwd" type="s:string" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="loginResponse">
<s:complexType>
<s:sequence>
<s:element name="loginResult" type="tns:utdNugget" maxOccurs="1" minOccurs="0"/>
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="utdNugget">
<s:sequence>
<s:element name="Token" type="s1:guid" maxOccurs="1" minOccurs="1"/>
<s:element name="ExpiresSeconds" type="s:int" maxOccurs="1" minOccurs="1"/>
</s:sequence>
</s:complexType>


tia

nigel







Rick Strahl
West Wind Technologies

Making waves on the Web

from Maui, Hawaii

Viewing all articles
Browse latest Browse all 10393

Trending Articles