Westwind Proxy Generator
Posted: Fri Apr 12, 2024 6:52 am
Hello: I'm trying the Proxy Generator program cause the WebConnection program that bought long time ago didn't work with this webservice.
Created the proxy program from the WSDL file and did the following code:
The description of the service specifies a different URL which is not the same as the WSLD file URL and have an authenticationheader inside the SOAP.
The generated program section for this SendX12File request is:
What I don't see here is the reference to the new URL nor the AuthenticationHeader specified in the WSDL which is something like this (Have to change the website real addresses due to confidentiality agreement):
Was wondering if these kind of webservers can we dealt with this tool? and if so how. I tried the code with the WSDL url and the error is "Server was unable to process request ---> Object reference not set to an instance of an object". If I use the other soapaction url get what looks like a webpage saying "object moved to errorpage" like if that page doesn't exist. Tried many things like using Bridge for the Authentication Header but that didn't work either. Sorry for the long post if its not the right tool for the job please let me know which tool should be using then or if I get this working will buy the tool immediately. Thanks!
Created the proxy program from the WSDL file and did the following code:
Code: Select all
** Load the Proxy and Support Class Libraries
DO EdifileTransferProxy
*** Create an instance of the Proxy
LOCAL loProxy as EdiFileTransferProxy
loProxy = CREATEOBJECT("EdiFileTransferProxy","V4")
***loProxy.oService.IgnoreCertificateErrors()
LOCAL loBridge as wwDotNetBridge
loBridge = loProxy.oBridge
LOCAL loService as EdiFileTransfer.EdiFileTransfer
loService = loProxy.oService
loBridge.SetProperty(loService,"Url",lcUrl)
loProxy.oService.HttpLogin(lcUsername, lcPassword,.F.)
lcRequest = loProxy.SendX12File(LcFile, lcFileBody, lcFileDate, lcFixX12Envelope)
IF loProxy.LERROR
? loProxy.cErrorMsg
RETURN
ENDIF
The generated program section for this SendX12File request is:
Code: Select all
FUNCTION SendX12File(FileName as String,Body as String,FileDate as String,FixX12Envelope as Boolean) as FileTransferResult
LOCAL loException as Exception, lvResult as FileTransferResult
THIS.lError = .F.
this.cErrorMsg = ""
lvResult = .F.
TRY
lvResult = this.oBridge.InvokeMethod(this.oService, "SendX12File", FileName,Body,FileDate,FixX12Envelope)
CATCH to loException
THIS.GetErrorDetail(loException)
ENDTRY
RETURN lvResult
ENDFUNC
* SendX12File
Code: Select all
POST /webservices/editransfer/edifiletransfer.asmx HTTP/1.1
Host: www.server.com
Content-Type: application/soap+xml; charset=utf-8
Content-Length:
length
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Header>
<AuthenticationHeader lmlns="https://www.server.com/ws/EdiFileTransfer/">
<Username>string</Username>
<Password>string</Password>
</AuthenticationHeader>
</soap12:Header>
<soap12:Body>
<SendX12File xmlns="https://www.server.com/ws/EdiFileTransfer/">
<FileName>string</FileName>
<Body>string</Body>
<FileDate>string</FileDate>
<FixX12Envelope>boolean</FixX12Envelope>
</SendX12File>
</soap12:Body>
</soap12:Envelope>