Web Service error

I am getting an error like this, when i am trying to communicate to the webservice url hosted on other machine…Could u please able to help me?
Unable to automatically step into the server. Connecting to the server machine *‘XXXXX’ Failed.*The Microsoft Visual Studio Remote Debugging Monitor (MSVSMON.EXE) does not appear to be running on the remote computer

Hi,

Can you please specify which Aspose product are you using?

Best Regards,

Hi,
I am using Aspose.Word.net for this… here scenario like
I am able to get a document from a server by calling their web service,

DataObject Remote_Xml = sr.retrieveDocument(DocumentID);
return Remote_Xml;

The retrieveDocument method will actualy gives me adoc as soap attachment. I should download it in the form of docx and convert it as pdf using aspose.
please help me in this.

Hi
Thanks for your request. In your case, you need just get the document as a stream and then create a Document object from this Stream. The technique will be similar to the one described here:
https://docs.aspose.com/words/net/serialize-and-work-with-a-document-in-a-database/
Please let us know if you have any difficulties in implementing this, we will be glad to help you.
Best regards,

Hi Thanks for your advice!
I tried implementing the logic and almsot succeeded in that but when actyually doing the conversion to memory stream from byte array i have land up in the below error:

Document doc_Documentum = new Document(doc_stream); //getting error here

Error : Unknown file format
Here is my code:

Documentum_Srvc.HCDocumentumService sr = new CreateDocument.Documentum_Srvc.HCDocumentumService();
DataObject Remote_Xml = sr.retrieveDocument(DocumentID);
byte[] _ByteArray = ObjectToByteArray(Remote_Xml);
MemoryStream doc_stream = new MemoryStream(_ByteArray);
Document doc_Documentum = new Document(doc_stream);

Here The Scenario like, I am getting the Response object “Remote Xml” in the form of DataObject , so i wrote a function(ObjectToByteArray) to convert it in to byte array. from byte array i am trying to load in to memory stream and from memroy stream i am converting it as document object. this point of time i am hitting this error. please help me.
If you ahve any other way to suggest then, that also would be helpful.
Thanks a lot,
Nikhil Nair

I Drilled down to the issue and found that the format is coming as “msw12” which is equalent to “docx” format. int his situation how can i move forward like saving this in to a doc object.
pls advice.

Hi
Thanks for your request. Could you please save the stream to file and attach this file here for testing? I will check it and provide you more information.
Best regards,

How to save stream object toa file.

Hi
Thanks for your request. You can use code like this:

public void SaveStreamToFile(string fileFullPath, Stream stream)
{
    if (stream.Length == 0) return;
    // Create a FileStream object to write a stream to a file
    using(FileStream fileStream = System.IO.File.Create(fileFullPath, (int) stream.Length))
    {
        // Fill the bytes[] array with the stream data
        byte[] bytesInStream = new byte[stream.Length];
        stream.Read(bytesInStream, 0, (int) bytesInStream.Length);
        // Use FileStream object to write to the specified file
        fileStream.Write(bytesInStream, 0, bytesInStream.Length);
    }
}

Best regards,

Hi,
Please find teh attached file, i have saved as stream object. When I am trying to convert this as dcoument I am getting this error.

Pls find teh file attached, while converting this in to document i am getting the error like (Unknown file format). Pls advice accordingly.

Hi
Thank you for additional information. The file you have attached is not a Word document, that is why you get an exception when try to create a document from it.
I think you should check your code where you extract stream, most likely the problem is there.
Best regards,

I saved the stream in to a txt file and attached previously.

stream = new MemoryStream(); // read xml in memory
writer = new StreamWriter(stream, Encoding.Unicode);
Documentum_Srvc.HCDocumentumService sr = new CreateDocument.Documentum_Srvc.HCDocumentumService();
DataObject Remote_Xml = sr.retrieveDocument(DocumentID);
byte[] _ByteArray = ObjectToByteArray(Remote_Xml);
if (_ByteArray != null)
{
    MemoryStream doc_stream = new MemoryStream(_ByteArray);
    SaveStreamToFile(@"C:\Documents and Settings\898588\Desktop\aspose-docs\New Folder\New Folder\\mystream.txt", doc_stream);
    doc_stream.Position = 0;
    yesdoc = new Document(doc_stream);
    yesdoc.Save(@"C:\Documents and Settings\898588\Desktop\aspose-docs\New Folder\New Folder\\Documentum.docx");
}
return yesdoc;

this is the code, i am trying… I am trying to see how i can change the format of the file with in stream itself, so that i can change the extension to .docx and aspose dll can make use of that. any idea?

Hi Nair,
Yes, I checked the attached file. And as I mention it is not a Word document. To create the Document object from stream your stream should contain a Word document. Since your stream does not contain a Word document, Aspose.Words throws an exception when you attempt to create a Document object from your stream.
Best regards,

Hi,
Is there any suggestion for converting an aspose document object to DataPackage?

while I am converting the Word Dcoument to Datapackage i am getting below error:

Error 6 Argument ‘1’: cannot convert from ‘Aspose.Words.Document’ to ‘CreateDocument.Documentum_Srvc.DataPackage’
Any suggestions is welcome.

Hi Nair,
Thanks for your inquiry. DataPackage seems to be your own custom class, so I cannot know how to work with it. But definitely, you cannot simply cast Aspose.Words.Document object to DataPackage.
Best regards,