Using Document Service NOT from mobile device

thetallblokethetallbloke Member Posts: 66
edited 2010-03-17 in Dynamics Mobile
Hi guys,

Has anyone had any sucess using the Document Service to handle an XML file NOT from a mobile device.

I need to build a custom sales order entry screen in .Net... I've managed to create my own Document Handler in .Net and can prove that it works from the Mobile Sales sample application that uses the Windows Mobile emulator, etc..

I opened up a blank VB.Net winforms application, added a web reference to the Document Service..

I then tried to use the SubmitRequestDocument method and passed in a variable with the contents of an XML file (created using the Mobile Sales Sample App)..

I get back a response saying "The server cannot process the request. Contact your administrator."...
If I look in the Event Viewer logs, it says:

Document Service
The server cannot process the request. The following error has occurred:
Request is empty

Context:
User: MyDomain\JMayer

Details:
Request received: Friday, February 27, 2009 - 1:02:15:150 PM

Request document:
<?xml version="1.0" encoding="utf-16"?><request name="CreateCustomer" created="2009-02-27T11:49:12-08:00" xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/Request"><requestData name="CustomerDetailTasklet"><customer xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/SampleApplication"><name>test</name><email>test@mymail.com</email><type>RET</type></customer></requestData><requestData name="CustomerCreditLimitDetailTasklet"><creditlimit xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/SampleApplication"><limit>5000</limit></creditlimit></requestData><requestData name="CustomerContactDetailTasklet"><contact xmlns="http://schemas.microsoft.com/Dynamics/Mobile/2007/04/Documents/SampleApplication"><name>Jack Johnson</name><tel>555-4448</tel></contact></requestData></request>


Am I calling the wrong method in the webservice..??

Has anyone had any sucess with this.. I just don't know if it's a problem with my code or some setting on my machine..

I'm using VS2008 and Windows Server 2008


Thanks

Adam
.
I'm not crazy !!! Just ask my toaster...
.

Comments

  • thetallblokethetallbloke Member Posts: 66
    Still ](*,) but I'm closer to getting it working - I think..

    My error message in Event Viewer is now saying :
    Document Service
    The server cannot process the request. The following error has occurred:
    Index was outside the bounds of the array.

    Context:
    User: <My Domain>\<My Username>
    Device ID: XXXXX



    I changed my code to pass through a device ID and message ID object:

    Dim a As New RequestDoc.DocumentServiceClient
    Dim dev As New WindowsApplication1.RequestDoc.DeviceId
    dev.Value = "MyDevice"
    Dim msg As New WindowsApplication1.RequestDoc.MessageId
    msg.Value = "CreateCustomer"
    a.SubmitRequestDocument(dev, msg, GetFileString)

    NOTE: GetFileString returns the formed XML document to pass to the document handler.

    If I don't assign a value to the msg.Value, I get the previously mentioned "Request is empty" error, if I put a value into it, I get the new "Index was outside the bounds of the array" error..

    The Device ID doesn't seem to be terribly important... Correct me if I'm wrong though..

    For the msg.value I have tried the following strings:
      "0" - I have 2 document handlers setup, so I thought it might be a zero based index "1" - I thought I'd try a 1 based index "2" - Just for "fun" "CreateCustomer" - because thats the name of my Document Type entry "This is my first Documet Handler" - Because this is the "Document Handler Name" in the Document Types window in the Document Manager MMC Snap-in. - I created my own document handler which works fine from the mobile device, just not from my winforms app. Some Random text that came up when I got frustrated and smacked my hand on the keyboard a new GUID generated within my application.

    I also tried taking the Message ID that was passed from the mobile sample app to my document handler and writing that out to a file... it appears to be a guid but it changes as each new document is sent from the mobile application.. so I'm wondering where this value comes from and what it represents...

    Where do I find out what the valid Message ID's are...???

    Thanks
    .
    I'm not crazy !!! Just ask my toaster...
    .
  • Peter_ListPeter_List Member Posts: 21
    The MessageID is a GUID.
    It is used by the mobile server to determine if the message has been received and processed before.
    The Dynamics Mobile framework guarantees that messages are only processed once (if network retransmission occur).

    If the message has already been processed by the server the answer from the document queue is returned.
    Peter List
    Microsoft Dynamics Mobile Consultant
    http://www.taskletfactory.com
  • laurentllaurentl Member Posts: 16
    I think that the problem is that the messageid should have this format : "uuid:" + guid
    Laurent Lopez

    Dynamics Mobile Freelancer
    Former Microsoft Developer in the Microsoft Dynamics Mobile team
    Visit my dynamics mobile community site: http://www.dynamicsmobile.net
  • thetallblokethetallbloke Member Posts: 66
    Laurent,

    Thanks heaps for your help... this was the missing piece..

    I've since been able to submit douments to the document services and easily write my own document handlers..
    .
    I'm not crazy !!! Just ask my toaster...
    .
  • jennyshredjennyshred Member Posts: 1
    I have the same concern with the topic. But as I've seen and read this thread it helped me solve my problem. Laurnetl is right with this. The user id must be complete as he suggested.
Sign In or Register to comment.