This project has moved. For the latest updates, please go here.

Position.set is not supported

Oct 15, 2008 at 10:57 AM
Hi,

I'm trying to use the SFTP adapter with the EdiSend pipeline included with BizTalk 2006 R2. This renders the following error:

------------------------------
Method: Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage
Error: Unable to transmit file .
Inner Exception:
Position.set is not supported
------------------------------
Information:
Type: Blogical.Shared.Adapters.Sftp.SftpException
Target: Microsoft.BizTalk.Message.Interop.IBaseMessage ProcessMessageInternal(Microsoft.BizTalk.Message.Interop.IBaseMessage, Blogical.Shared.Adapters.Sftp.ISftp)
Message: Unable to transmit file .
Inner Exception:
Position.set is not supported

Stacktrace:
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage(IBaseMessage message)
------------------------------
Type: System.NotSupportedException
Target: Void set_Position(Int64)
Message: Position.set is not supported
Stacktrace:
   at Microsoft.BizTalk.Edi.MessageCore.StitchingStream.set_Position(Int64 value)
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)
-----------------------------

Any suggestions on how to solve this?
Coordinator
Oct 15, 2008 at 12:30 PM

I haven't seen this problem before, but I assume the Microsoft.BizTalk.Edi.MessageCore.StitchingStream isn't seekable. You might get arround this by not resetting the possition of the stream.

Current code base 
file: SftpTransmitterEndpoint.cs
method: ProcessMessageInternal:

private IBaseMessage ProcessMessageInternal(IBaseMessage message, ISftp sftp)
  {
            string filePath = "";
           
            try
            {
                Stream source = message.BodyPart.Data;
                
source.Position = 0; // This is where I think the exception occurs

Try chaning it to:
private IBaseMessage ProcessMessageInternal(IBaseMessage message, ISftp sftp)
  {
            string filePath = "";
           
            try
            {
                Stream source = message.BodyPart.Data;
               
if(source.CanSeek) // Only reset position if stream is seekable
                    source.Position = 0;


I'm not sure this is solves your problem, and it requires the position of stream to be a 0 when the adapter gets the message. If this does help, please keep me updated, so we can share it!

HTH

//Mikael

Oct 17, 2008 at 12:37 PM
Hi,

As I couldn't get hold of the source code to the adapter, I solved it by creating a custom pipeline with the EDI assembler and a custom pipeline component copying the stream into a memory stream.
Coordinator
Oct 22, 2008 at 7:04 PM
Here is the source code: http://www.codeplex.com/SftpAdapter/Release/ProjectReleases.aspx?ReleaseId=13188

Solving it by copying the stream into a memory stream is not a good idea, since you can't control the memory consumtion. If you still want to solve it in a pipeline component, try using a virtual stream instead.
HTH
Feb 10, 2009 at 4:47 PM
Mikael,

This did work on EDI Send.

Thanks!
Jan 11, 2010 at 4:07 PM

Hi Mikael,

I had the same issue while sending an EDI file to SFTP location. I made the suggested change (added If(source.CanSeek)). I resinstall the adapter by uninstalling the default installation (from control panel) and installing the newly compiled msi.

Im getting he following warning:

Unable to transmit file /test/temp/bbeeca9c6e39.txt.
Inner Exception:
The source 'SFTPAdapter' is not registered in log 'Blogical'. (It is registered in log 'Application'.) " The Source and Log properties must be matched, or you may set Log to the empty string, and it will automatically be matched to the Source property.

Your help will be greatly appreciated.

Note: there are no proper uninstall instructions.

Coordinator
Jan 11, 2010 at 4:21 PM
Try running the host instance with administrative privilages, which will create the Blogical event source. When it is created, you can set it back. You can add it manually using installutil. Have a look at the documentation for more info.
//Mikael


From: [email removed]
To: [email removed]
Date: Mon, 11 Jan 2010 09:07:34 -0800
Subject: Re: Position.set is not supported [SftpAdapter:37772]

From: kerenmo
Hi Mikael,
I had the same issue while sending an EDI file to SFTP location. I made the suggested change (added If(source.CanSeek)). I resinstall the adapter by uninstalling the default installation (from control panel) and installing the newly compiled msi.
Im getting he following warning:
Unable to transmit file /test/temp/bbeeca9c6e39.txt.
Inner Exception:
The source 'SFTPAdapter' is not registered in log 'Blogical'. (It is registered in log 'Application'.) " The Source and Log properties must be matched, or you may set Log to the empty string, and it will automatically be matched to the Source property.
Your help will be greatly appreciated.
Note: there are no proper uninstall instructions.
Read the full discussion online.
To add a post to this discussion, reply to this email (SftpAdapter@discussions.codeplex.com)
To start a new discussion for this project, email SftpAdapter@discussions.codeplex.com
You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.
Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com


Yes! Windows 7 gör din dator bättre och enklare Yes! Windows 7 gör din dator bättre och enklare
Mar 24, 2011 at 2:32 AM

Hi

Thanks for providing the adapter first. I like it.

I just download the V1.3 and install it to my biztalk 2009. It is perfect in receiving the file, but I got the same issue in send port with EdiSend pipeline, if I change the send pipeline to PassThrouTrassmit, it is running fine.

Is this 'bug' update in version 1.3? How can I fix it?

Thanks

Coordinator
Mar 24, 2011 at 6:06 AM

I'm willing to bet that the problem is within the message, and not the adapter. The adapter doesn't really care of the content of the message.

What kind of exception do you get?

//Mikael

Mar 24, 2011 at 1:12 PM

Hi Mikael

Here is the exception:

Method: Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage
Error: [SftpTransmitterEndpoint] Unable to transmit file .
Inner Exception:
Position.set is not supported
. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections

------------------------------
Information:
Type: Blogical.Shared.Adapters.Sftp.SftpException
Target: Microsoft.BizTalk.Message.Interop.IBaseMessage ProcessMessageInternal(Microsoft.BizTalk.Message.Interop.IBaseMessage, Blogical.Shared.Adapters.Sftp.ISftp)
Message: [SftpTransmitterEndpoint] Unable to transmit file .
Inner Exception:
Position.set is not supported
. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections
Stacktrace:
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage(IBaseMessage message)

------------------------------
Type: System.NotSupportedException
Target: Void set_Position(Int64)
Message: Position.set is not supported
Stacktrace:
   at Microsoft.BizTalk.Edi.MessageCore.StitchingStream.set_Position(Int64 value)
   at Microsoft.BizTalk.Streaming.BasicStreamWrapper.set_Position(Int64 value)
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)

Thanks you.

Coordinator
Mar 24, 2011 at 6:00 PM

Ok, from what I can see the adapter tries to set the position of the stream:

private IBaseMessage ProcessMessageInternal(IBaseMessage message, ISftp sftp)
{
            string filePath = "";
           
            try
            {
                Stream source = message.BodyPart.Data;
                source.Position = 0;

I think this is the problem, as some stream are forward read only. Se the last exception: Position.set is not supported

In your case, this might not be neccesary, but in many other cases it would be. What you could do is to download the code and comment out that line. Build and deploy...

//Mikael

Mar 25, 2011 at 2:16 AM

Hi Mikael

Thank you very much. After comment the code you mentioned, it works fine now.

I have one more quesion, is there any risk to comment the code source.Position = 0; what's this code for?

 

Coordinator
Mar 25, 2011 at 7:46 AM

I'd say it's a low risk. But it's there because streams are sometimes passed to the adapter where the position is not reset. This is most often caused by a pipeline component reading the message.

HTH

//Mikael

Sep 26, 2011 at 3:59 PM

Hi Mikael,

First of all a big thanks to you for providing the adapter. I am using BizTalk 2010 and working on a EDI project (850/855 documents exchange). I am getting the same  error as mentioned above:

Exception Details:

Method: Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage
Error: [SftpTransmitterEndpoint] Unable to transmit file .
Inner Exception:
Position.set is not supported
. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections

------------------------------
Information:
Type: Blogical.Shared.Adapters.Sftp.SftpException
Target: Microsoft.BizTalk.Message.Interop.IBaseMessage ProcessMessageInternal(Microsoft.BizTalk.Message.Interop.IBaseMessage, Blogical.Shared.Adapters.Sftp.ISftp)
Message: [SftpTransmitterEndpoint] Unable to transmit file .
Inner Exception:
Position.set is not supported
. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections
Stacktrace:
at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)
at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage(IBaseMessage message)

------------------------------
Type: System.NotSupportedException
Target: Void set_Position(Int64)
Message: Position.set is not supported
Stacktrace:
at Microsoft.BizTalk.Edi.MessageCore.StitchingStream.set_Position(Int64 value)
at Microsoft.BizTalk.Streaming.BasicStreamWrapper.set_Position(Int64 value)
at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)

You have suggested changing the source code to make this work. Can you expalin in detail which file under which solution and project do I need to modify and also which version of Visual Studio do I need to use for that. My current development environment is VS 2010 and I am using BizTalk 2010 for my development.

Any help is highly appreciated.

 

Thanks
Sachin

 

 

Sep 26, 2011 at 4:21 PM
kissedi wrote:

Hi Mikael

Here is the exception:

Method: Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage
Error: [SftpTransmitterEndpoint] Unable to transmit file .
Inner Exception:
Position.set is not supported
. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections

------------------------------
Information:
Type: Blogical.Shared.Adapters.Sftp.SftpException
Target: Microsoft.BizTalk.Message.Interop.IBaseMessage ProcessMessageInternal(Microsoft.BizTalk.Message.Interop.IBaseMessage, Blogical.Shared.Adapters.Sftp.ISftp)
Message: [SftpTransmitterEndpoint] Unable to transmit file .
Inner Exception:
Position.set is not supported
. Changing any Send Port Transport properties might require the host to be restarted, as the connection pool might still have connections
Stacktrace:
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessage(IBaseMessage message)

------------------------------
Type: System.NotSupportedException
Target: Void set_Position(Int64)
Message: Position.set is not supported
Stacktrace:
   at Microsoft.BizTalk.Edi.MessageCore.StitchingStream.set_Position(Int64 value)
   at Microsoft.BizTalk.Streaming.BasicStreamWrapper.set_Position(Int64 value)
   at Blogical.Shared.Adapters.Sftp.SftpTransmitterEndpoint.ProcessMessageInternal(IBaseMessage message, ISftp sftp)

Thanks you.

Hi kissedi,

 

If you were able to fix this error, can you provide me the new MSI so that I can also install this. I am unable to open the source code.

sachinsandeep@gmail.com

Thanks

Sachin