In Orch: System.InvalidCastException when .NET assembly calls com

From: aman (aman_at_discussions.microsoft.com)
Date: 02/08/05


Date: Tue, 8 Feb 2022 08:49:06 -0800

Ok here is the scenario.

(1) I am using a COM component (call it A) that is an application proxy from
a different server.
(2) Created an signed Interop assembly using the tlbimp utility and put it
in the GAC
(3) Got a .NET component (call it B) that uses the interop for some
functionality
(4) Call to .NET component from a windows form is fine.

(6) Wrote a biztalk orchestration that uses the .NET component (B)
(7) Published the orchestration as webservice
(8) call to the webservice works fine when a method does not call interop
assembly (A).
(9) call to the webservice fails with the following errro when the method
calls the interop assembly.
The adapter "SOAP" raised an error message. Details "An exception is thrown
by the Orchestration schedule, Date Dump: <string>Message : QueryInterface
for interface tax.IAvailabilityInterface failed.
Source : interop.tax
Type : System.InvalidCastException
</string>".

(10) Did some debugging line by line (printing to the log file) and found
the exact line where it fails.
  oAvail.LineIndex = iLineIndex
where oAvail is an object of interop assembly (A) called by the .NET
assembly (B),
where iLineIndex is an integer,
where the property oAvail.LineIndex is also an integer

(11) Remember this works fine when called from and windows.net form
application

(12) Did some further investigation using the ildasm on the interop assembly
and found :
.property int32 LineIndex() {
  .custom instance void
[mscorlib]System.Runtime.InteropServices.DispIdAttribute::.ctor(int32) = ( 01
00 0A 00 00 00 00 00 )
  .set instance void tax.IAvailabilityInterface::set_LineIndex(int32)
} // end of property IAvailabilityInterface::LineIndex

(13) Hmm.. int32 eh? did a
        oAvail.LineIndex = Convert.ToInt32(iLineIndex)
 but still the same problem when calling from an orchestration. This Code
compiles fine and works fine again from a windows .net forms application

(14) HELP!!!!.. any suggestions, thoughs would be much appreciated.

Best Regards,

aman



Relevant Pages

  • Re: Custom pipeline in a Orchestration webservice
    ... other message and implement your transform functionality. ... In Orchestration my Receive shape receives the message type ... But when i publish this Orchestration as a webservice. ...
    (microsoft.public.biztalk.general)
  • Re: Consuming BizTalk webservice
    ... The web service exposed by your orchestration is not different from any other webservice. ... In your orchestration case the parameter you pass will be the message, from a XSD schema which is equivalent to a complex type in ..NET. ... Say for example a webservice is expecting an object of type Employee, then the client application needs to construct that object and pass it as a parameter, which will eventually get serialized in the wire format and transmitted to the webservice. ... calls all want this object of "rootNodeName" type. ...
    (microsoft.public.biztalk.general)
  • Re: Receiving Emails
    ... Why do you want to access the .NET component from an Orchestration. ... You can modify the component little bit so that it polls your exchange server regularly and submit messages into BizTalk either via HTTP or drop a file, ... because of a conflict with the open Outlook client. ...
    (microsoft.public.biztalk.general)
  • RE: Manual Invokation of orchestration from remote machine.
    ... I have a question regarding the orchestration as a webservice. ... The wizard created the webservice which is in turn calling the ... >> BTSHttpReceive.dll is the piece that allows BizTalk to receive messages from HTTP. ...
    (microsoft.public.biztalk.general)
  • Re: Web Reference Problem
    ... BizTalk 2004 doesn't support array parameters in webservices directly in the ... component you call from the orchestration from an expression shape. ... Are you exposing the webservice and consuming it from the same biztalk ... or are this separate biztalk groups entirely? ...
    (microsoft.public.biztalk.general)