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

Re: I sent 3 email with code ..

$
0
0
Re: I sent 3 email with code ..
Web Service Proxy Generator
Re: I sent 3 email with code ..
Jul. 15, 2013
05:51 am
3TZ0CJHZLShow this entire thread in new window
Gratar Image based on email address
From:Jim M
To:Rick Strahl
this is whats created when generated..


****
DO shipserviceproxy
loProxy = CREATEOBJECT("ShipServiceProxy","V2")
lcResult = loproxy.processshipment("Parm1")
? loProxy.cErrorMsg <-- error says method not found shipmethod shipmethod.processshipment to found


looking at loproxy has none of the methods that are found in reflector...


***


*shipserviceproxy.prg**************************

DO wwDotNetBridge
SET PROCEDURE TO shipserviceproxy ADDITIVE


*************************************************************
DEFINE CLASS ShipServiceProxy AS Custom
*************************************************************
*: Generated with West Wind .NET Web Service Proxy Generator
*: Created: 07/15/13 08:40:17 AM
*:
*: 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://wwwcie.ups.com/webservices/Ship"
cWsdlUrl = "http://telecom.shieldswired.us/WIREDWEB/ship.wsdl"
cAssemblyPath = LOWER(FULLPATH([shipserviceproxy.dll]))
cComClass = "ShipService.ShipService"

cErrorMsg = ""
cErrorDetailXml = ""
lError = .F.

*** Holds any array based results
DIMENSION aResult[1]

************************************************************************
* Init
****************************************
FUNCTION Init(lcDotNetVersion,llNoLoad)

IF !llNoLoad
IF !this.LoadService(lcDotNetVersion)
ERROR this.cErrorMsg
ENDIF
ENDIF

ENDFUNC
* Init

************************************************************************
* LoadService
****************************************
*** Function: Loads an instance of the .NET Runtime if not loaded
*** and loads wwDotnetBridge .NET component into the runtime.
*** Assume: .NET is available
*** Failure will throw a FoxPro error
*** Pass: lcDotnetVersion
*** "V2","V4" or explicit .NET version
*** defaults to V2
*** Return: .T. or .F.
************************************************************************
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

RETURN .T.
ENDFUNC
* LoadService

************************************************************************
* HttpLogin
****************************************
*** Function: Sends authentication credentials to the server.
*** Assume: Negotiates the auth protocol requested by the server
*** Pass: username/password
*** OR pass "Windows" or empty for username to use
*** Windows default credentials (works only with Windows Auth)
*** Return: nothing
************************************************************************
FUNCTION HttpLogin(lcUserName, lcPassword, llPreAuthenticate)

IF EMPTY(lcUserName)
lcUserName = "Windows"
ENDIF
IF EMPTY(lcPassword)
lcPassword = ""
ENDIF

this.oService.HttpLogin(lcUsername, lcPassword, llPreAuthenticate)


************************************************************************
* ProcessShipment
****************************************
FUNCTION ProcessShipment(ShipmentRequest as ShipmentRequest) as ShipmentResponse
LOCAL loException as Exception, lvResult as ShipmentResponse

THIS.lError = .F.
this.cErrorMsg = ""

lvResult = .F.
TRY
lvResult = this.oBridge.InvokeMethod(this.oService, "ProcessShipment", ShipmentRequest)

CATCH to loException
THIS.GetErrorDetail(loException)
ENDTRY

RETURN lvResult
ENDFUNC
* ProcessShipment



************************************************************************
* ProcessShipConfirm
****************************************
FUNCTION ProcessShipConfirm(ShipConfirmRequest as ShipConfirmRequest) as ShipConfirmResponse
LOCAL loException as Exception, lvResult as ShipConfirmResponse

THIS.lError = .F.
this.cErrorMsg = ""

lvResult = .F.
TRY
lvResult = this.oBridge.InvokeMethod(this.oService, "ProcessShipConfirm", ShipConfirmRequest)

CATCH to loException
THIS.GetErrorDetail(loException)
ENDTRY

RETURN lvResult
ENDFUNC
* ProcessShipConfirm



************************************************************************
* ProcessShipAccept
****************************************
FUNCTION ProcessShipAccept(ShipAcceptRequest as ShipAcceptRequest) as ShipAcceptResponse
LOCAL loException as Exception, lvResult as ShipAcceptResponse

THIS.lError = .F.
this.cErrorMsg = ""

lvResult = .F.
TRY
lvResult = this.oBridge.InvokeMethod(this.oService, "ProcessShipAccept", ShipAcceptRequest)

CATCH to loException
THIS.GetErrorDetail(loException)
ENDTRY

RETURN lvResult
ENDFUNC
* ProcessShipAccept


************************************************************************
* 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
ELSE
RETURN
ENDIF

loType = this.oBridge.InvokeMethod(loException,"GetType")
lcTypeName = this.oBridge.GetProperty(loType,"Name")

IF lcTypeName != "SoapException"
this.cErrorDetailXml = this.oBridge.GetPropertyEx(loException,"Message")
RETURN
ENDIF

*** Grab the full XML Error Detail block
this.cErrorDetailXml = this.oBridge.GetPropertyEx(loException,"Detail.OuterXml")

ENDFUNC
* GetErrorDetail


ENDDEFINE

**************************


From what I see the service has three methods, which are mapped by the proxy both in FoxPro and .NET.

Look for the ShipService class in the .NET Proxy (via Reflector).

+++ Rick ---



this is the wsdl link
http://telecom.shieldswired.us/wiredweb/ship.wsdl

after generating everything.. the reflector methods to not correspond to a method in the prg class-methods..

shouldn't there be a 1 to 1 match?


I purchased proxy gen about 5...6 years ago.. used it to call telecom services... It did the job... That was 6.. 7 years ago.. so now 6..7 years later.. I need to use proxy gen again.. I could find what I did with the software.. So I just purchased it again.
This time around.. not so smooth.. 5 days later and I'm still at square one..

I think the proxy gen is parsing the wsdl wrong.. or the ups ship wsdl file is wrong..

Thanks
Jim


What I'm saying is post your code so that those of us that want to look at this can just run the code without having to figure out what needs to be called.

I understand that you just want this to work, and believe me I want to help, but I don't want to spend a half an hour trying to figure out your Web service to call and what parameters to pass. So if you can post the code that you're using as a simple ready to run (even if it fails) sample, that makes life a lot easier for testing and getting me to check out the important parts that don't work with ambiguity of whether I'm passing the right data.

Any mehtod you call on the service proxy has to match parameter types EXACTLY! Meaning you can't just pass arbitrary parameters to these method you have to actually pass the right types.

The easiest ways to figure this out is to use Reflector to look at the generated .NET assembly to see all the parameters that are required and then matching those up with FoxPro values that need to be passed in. There are examples in the help file in the walk through and video that demonstrate how to call and pass complex parameters (like an invoice).

+++ Rick ---


By the way... I don't want anyone to do the work for me... I could just as easily get this done with another tool or do it from scratch.. I bought this tool to get the job done.. and all I ask is why cant I even call a class after everything is generated..


I thought it was something wrong with the ups shipping wsdl.. so I tried it with your wsdl...

Doesn’t even work with.. http://store.west-wind.com/Service/webstoreconsumerservice.asmx?wsdl What am I missing? I read the Docs…
DO webstoreserviceproxy

*** Create Proxy Instance & specify .NET version
loProxy = CREATEOBJECT("WebStoreServiceProxy","V2")
* loProxy = CREATEOBJECT("WebStoreServiceProxy","V4")


*** Call your methods and retrieve result
lcResult = loProxy.UploadInvoice("fake param","fake param")

*** Check for error message if result is failing
? loProxy.cErrorMsg

Errors out before even going outside the router,,
says Method "WebStoreSerice,WebStoreService.UploadInvoice" not found


All generated DLL PRG CS files are in the folder that above code is in..








Viewing all articles
Browse latest Browse all 10393

Trending Articles