Web Service Proxy Generator
Trouble when calling: CreateInstanceOnType()
Gravatar is a globally recognized avatar based on your email address. Trouble when calling: CreateInstanceOnType()
  Alec Gagne
  All
  Apr 20, 2022 @ 08:11pm

Hi Rick,

I seem to be doing something wrong here...
After reading another page (https://www.west-wind.com/wsdlgenerator/docs/_2tz19ezkl.htm)
and another thread ( https://support.west-wind.com/Thread6860SNG8S.wwt )

I'm trying to create an instance of the SOAP Header so I can set the needed username and password properties.


DO SwiftUploadV2Proxy

LOCAL loProxy
loProxy = CREATE("SwiftUploadV2Proxy")

LOCAL loBridge as wwDotNetBridge
loBridge = loProxy.oBridge

LOCAL loService as SwiftUploadV2.SwiftUploadV2
loService = loProxy.oService

loService.Url = m.lcUrl 

*** Create the SOAP header instance
loBridge.CreateInstanceOnType(loService,"SwiftUploadCredentialsValue","SwiftUploadV2.SwiftUploadCredentials")

loBridge.SetPropertyEx(loService,"SwiftUploadCredentialsValue.UserName",m.lcUserName)
loBridge.SetPropertyEx(loService,"SwiftUploadCredentialsValue.Password",m.lcPassword)

Following the execution of the code in the VFP debugger all seems to work okay up to a point.
The code errors when I attempt to CreateInstanceOnType() I get an OLE Error Code 0x80020006: Unknown Name

I have been provided a sample file to show the structure of the SOAP Header and Request as follows


<?xml version="1.0"?>
<!-- Sample SOAP Request for Upload Method -->
.........
   <soapenv:Header>
      <swif:SwiftUploadCredentials>
         <swif:Password>Valid Password</swif:Password>
         <swif:UserName>Valid Username</swif:UserName>
      </swif:SwiftUploadCredentials>
   </soapenv:Header>
   <soapenv:Body>
      <swif:UploadRequest>
         <swif:FileName>MyFile.XML</swif:FileName>
         <swif:ORINumber>AB1234567</swif:ORINumber>
         <swif:File>
            <![CDATA[Binary string]]>
         </swif:File>
      </swif:UploadRequest>
   </soapenv:Body>
</soapenv:Envelope>

Inclusive in the documentation is the following:

  • All data inputs are wrapped in SOAP (Simple Object Access Protocol) envelopes and the SOAP header contains an object called SwiftUploadCredentials of type Credentials that has two parameters: UserName and Password. NOTE: Due to the inclusion of a username and password, the method must be executed in SSL. *

Perhaps it is just the way they worded it, however this language makes it sound like the UserName and Password are not properties of the SwiftUploadCredentials object but the sample code that I'm using appears to be attempting to set them as properties.

How do I determine the proper 'name' to use in that CreateInstanceOnType() method call so I can get past this error or do I need to use a different approach to getting the UserName and Password set in the header? Clearly I'm confused here....

Thanks

Alec

Gravatar is a globally recognized avatar based on your email address. re: Trouble when calling: CreateInstanceOnType()
  Rick Strahl
  Alec Gagne
  Apr 21, 2022 @ 12:38am

I imagine the name of the type is SwiftUploadCredentials not SwiftUploadCredentialsValue, but you need to check and see what is actually defined in the .NET proxy type using Reflector or similar.

+++ Rick ---

© 1996-2022