Does anybody have a working example of creating a change order via the API in 2013? (.NET)
I've been playing around but keep getting Soap Exception 106.
Thanks in advance,
Tom
Solved! Go to Solution.
Solved by Redmond.D. Go to Solution.
The 106 error indicates that you are trying to call a method prior to signing-in as a user.
-Dave
Hmm, well I thought I was logging in correctly but perhaps not.
Here's what I've got so far:
Dim login As New UserPasswordCredentials("ellisws1", "Routing", "Administrator", "") Using serviceManager As New WebServiceManager(login) Try Dim myeco As ChangeOrderService myeco = New ChangeOrderService ' get the default routing Dim workflow As Workflow = myeco.GetDefaultWorkflow() Dim routings As Routing() = myeco.GetRoutingsByWorkflowId(workflow.Id) Dim defaultRouting As Routing = routings.FirstOrDefault(Function(n) n.IsDflt) If defaultRouting Is Nothing Then Throw New Exception("No default routing") End If ' get the next number in the default sequence Dim numberingSchemes As ChangeOrderNumSchm() = _ myeco.GetNumberingSchemesByType(NumSchmType.ApplicationDefault) Dim defaultNumberingScheme As ChangeOrderNumSchm = numberingSchemes.FirstOrDefault() If defaultNumberingScheme Is Nothing Then Throw New Exception("No default numbering scheme") End If Dim coNumber As String = myeco.GetChangeOrderNumberBySchemeId(defaultNumberingScheme.Id) Dim newCo As ChangeOrder = myeco.AddChangeOrder(defaultRouting.Id, coNumber, "test", "testing desc", DateTime.Now.AddMonths(1), Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing) Catch ex As Exception MessageBox.Show(ex.Message, "Error creating ECO") Return End Try End Using
The 106 error comes from the GetDefaultWorkflow function.
Any advice?
Thanks.
Don't new-up any of the Service objects. The WebServiceManager takes care of all that.
Replace the line
myeco = New ChangeOrderService
with
myeco = serviceManager.ChangeOrderService
That should get your farther in your code.