Web Service Proxy Generator
Westwind Proxy Generator
Gravatar is a globally recognized avatar based on your email address. Westwind Proxy Generator
  Aida Rivera
  All
  Dec 29, 2021 @ 01:22pm

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:

** 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 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:

************************************************************************
*  SendX12File
****************************************
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

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):

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>

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!

Gravatar is a globally recognized avatar based on your email address. re: Westwind Proxy Generator
  Rick Strahl
  Aida Rivera
  Dec 29, 2021 @ 02:35pm

Please reformat your message using the formatting tools (as shown in the BIG BLACK NOTICE on the bottom before your press Post). You can edit your message and apply the code styling.

+++ Rick ---

Gravatar is a globally recognized avatar based on your email address. re: Westwind Proxy Generator
  Aida Rivera
  Rick Strahl
  Dec 29, 2021 @ 08:59pm

Edit the message but ...found out how to do it and it works! just send my first file to the server. Apparently the WSDL soapaction URL do not exist anymore and is just the main url. This is what I needed:

loBridge.CreateInstanceOnType(loService,"AuthenticationHeaderValue","EdiFileTransfer.AuthenticationHeader")
loBridge.SetPropertyEx(loService,"AuthenticationHeaderValue.Username",lcUserName)
loBridge.SetPropertyEx(loService,"AuthenticationHeaderValue.Password",lcPassword)

Will be buying the tool soon. Regards, Aida

Gravatar is a globally recognized avatar based on your email address. re: Westwind Proxy Generator
  Rick Strahl
  Aida Rivera
  Dec 30, 2021 @ 10:00pm

You should be able to change the final service URL of the service URL via:

loProxy.oService.Url = "http://newService.com/subpath/myService.svc"

Note this has to be the Service Address not the WSDL address. The service address is usually found in the WSDL or if it's a .NET service it's the URL you're using for that service template with the ?WSDL at the end.

Your login isn't a 'login'. The login is set as part of a SOAP Header, so you need to use the SoapHeader syntax:

You'll have to look at the generated code to find the exact type name for the SOAP header and create the header object as shown in the example.

Hope this helps,

+++ Rick ---

© 1996-2022