On 21 =D7=90=D7=A4=D7=A8=D7=99=D7=9C, 11:05, Angelo Laris
<AngeloLa...@[EMAIL PROTECTED]
> wrote:
> Hello Everyone,
>
> I have a problem with executing a receive pipeline which I hope you can
he=
lp.
>
> I am getting the following exception.
>
> Microsoft.XLANGs.Pipeline.XLANGPipelineManagerException: The pipeline
> manager could not prepare the message(s) for processing pipeline
>
"Decillion.MAPS.SGX.Pipelines.RECEIVE_FlatFile_MT202_ATC_DP_DS_EPSDR_EPSFC=
_=C2=ADEPSCR_RTS".
> Error Details: "System.IO.Stream" ---> System.InvalidCastException:
> System.IO.Stream
>
> =C2=A0 =C2=A0at
Microsoft.XLANGs.Core.CustomFormattedPart.ProtectedRetriev=
eAs(Type t)
>
> =C2=A0 =C2=A0at Microsoft.XLANGs.Core.Part.RetrieveAs(Type t)
>
> =C2=A0 =C2=A0at
Microsoft.XLANGs.Pipeline.PipelineXPart.ToBaseMessagePart(=
)
>
> =C2=A0 =C2=A0at
Microsoft.XLANGs.Pipeline.PipelineXMessage.ToBaseMessage()=
>
> =C2=A0 =C2=A0at
>
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecutePipeline(ReceivePipe=
l=C2=ADine p, XLANGMessage inMsg)
>
> =C2=A0 =C2=A0--- End of inner exception stack trace ---
>
> =C2=A0 =C2=A0at
>
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecutePipeline(ReceivePipe=
l=C2=ADine p, XLANGMessage inMsg)
>
> =C2=A0 =C2=A0at
>
Microsoft.XLANGs.Pipeline.XLANGPipelineManager.ExecuteReceivePipeline(Type=
> receivePipelineType, XLANGMessage inMsg)
>
> =C2=A0 =C2=A0at
>
Decillion.MAPS.SGX.Orchestration.SGX_TO_SWIFT_MTXXX_ATC_DP_DS_EPSDR_EPSFC_=
E=C2=ADPSCR_RTS.segment3(StopConditions stopOn)
>
> =C2=A0 =C2=A0at
Microsoft.XLANGs.Core.SegmentScheduler.RunASegment(Segment=
s,
> StopConditions stopCond, Exception& exp)
> Microsoft.XLANGs.Pipeline.XLANGPipelineManagerException
> Scoped@[EMAIL PROTECTED]
> SGX_TO_SWIFT_MTXXX_ATC_DP_DS_EPSDR_EPSFC_EPSCR_RTS.??__scope34
> SGX_TO_SWIFT_MTXXX_ATC_DP_DS_EPSDR_EPSFC_EPSCR_RTS.??__scope33
>
SGX_TO_SWIFT_MTXXX_ATC_DP_DS_EPSDR_EPSFC_EPSCR_RTS.SGX_TO_SWIFT_MTXXX_ATC_=
D=C2=ADP_DS_EPSDR_EPSFC_EPSCR_RTS
> 170625e1-a1b3-4fbd-ac5a-6026e6ecabd0
>
>
--------------------------------------------------------------------------=
-=C2=AD-----
>
> I am using a Message of type RAWSTRING which is where I think the
problem =
is.
>
> Here is the code below which I copied from the Microsoft Web Site.
>
> Note it has a CustomFormatter called
> [CustomFormatter(typeof(RawStringFormatter))]
>
>
--------------------------------------------------------------------------=
-=C2=AD-----
>
> namespace Microsoft.Samples.BizTalk.XlangCustomFormatters
> {
> =C2=A0 =C2=A0public abstract class BaseFormatter : IFormatter
> =C2=A0 =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 public virtual SerializationBinder Binder
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0get { throw new
NotSup****tedException();=
}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set { throw new
NotSup****tedException();=
}
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public virtual StreamingContext Context
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0get { throw new
NotSup****tedException();=
}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set { throw new
NotSup****tedException();=
}
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public virtual ISurrogateSelector SurrogateSelector
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0get { throw new
NotSup****tedException();=
}
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0set { throw new
NotSup****tedException();=
}
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public abstract void Serialize( Stream stm, object
ob=
j );
> =C2=A0 =C2=A0 =C2=A0 public abstract object Deserialize( Stream stm );
> =C2=A0 =C2=A0}
>
> =C2=A0 =C2=A0public class RawStringFormatter : BaseFormatter
> =C2=A0 =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 public override void Serialize(Stream s, object o)
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RawString rs =3D (RawString)o;
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0byte[] ba =3D rs.ToByteArray();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0s.Write( ba, 0, ba.Length );
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public override object Deserialize(Stream stm)
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0StreamReader sr =3D new StreamReader(
st=
m, true );
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0string s =3D sr.ReadToEnd();
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return new RawString( s );
> =C2=A0 =C2=A0 =C2=A0 }
> =C2=A0 =C2=A0}
>
> =C2=A0 =C2=A0[CustomFormatter(typeof(RawStringFormatter))]
> =C2=A0 =C2=A0[Serializable]
> =C2=A0 =C2=A0public class RawString
> =C2=A0 =C2=A0{
> =C2=A0 =C2=A0 =C2=A0 [XmlIgnore]
> =C2=A0 =C2=A0 =C2=A0 string _val;
>
> =C2=A0 =C2=A0 =C2=A0 public RawString(string s )
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (null=3D=3Ds)
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 throw new
ArgumentNullException(=
);
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0_val =3D s;
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public RawString()
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public byte[] ToByteArray()
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return Encoding.UTF8.GetBytes( _val );
> =C2=A0 =C2=A0 =C2=A0 }
>
> =C2=A0 =C2=A0 =C2=A0 public override string ToString()
> =C2=A0 =C2=A0 =C2=A0 {
> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return _val;
> =C2=A0 =C2=A0 =C2=A0 }
> =C2=A0 =C2=A0}
>
> }
>
>
--------------------------------------------------------------------------=
-=C2=AD-----
>
> Can anyone please help it would be greatly appreciated.
>
> Thanks
>
> Angelo Laris
Hi.
Unfortunately, you can't execute inline pipeline from orchestration
with custom formatted CLR object.
This restriction is because of the engine is creating IBaseMessage
from the XLangMessage before executing the pipeline.
In this process, the engine is retrieving the parts as
System.IO.Stream.
You can find the code under Microsoft.XLANGs.Pipeline.PipelineXPart of
assembly Microsoft.XLANGs.Pipeline (with reflector of course).
Stream dataStream =3D (Stream) this.xpart.RetrieveAs(typeof(Stream));
Just look inside Microsoft.XLANGs.Core.CustomFormattedPart of assembly
Microsoft.XLANGs.Engine
You'll see the method ProtectedRetrieveAs(Type t) this method will
throw casting exception if the CLR object is not the same type as t.
So, in this case, the object must be of type Stream.
The only thing I can think of is to add implicitly conversion of the
object into Stream.
Hope I helped.
Pinhas Kolsky
http://pinhask.blogspot.com


|