AR Invoice Export to XML via Service Connect

Hi,

Very new to Service Connect

I am struggling to get data in to an XML file from a service connect workflow.
The exported XML file has all the fields from the schema but they do not contain data.

System Monitor has the error: XML response from Service Connect workflow could not be deserialized.

The Service Connect Workflow is triggered from the InvHead Data Directive once the Posted field changes from false to true. Once this happen I’m trying to export the data from the InvHead & InvDetail in an XML format and then use the Output channels to send to a FTP site. The workflow I have is below.

I am using the ARInvoice BO and Get List Request and Response schema’s
I have created an output schema for the xml so I have been able to do some of the mappings from the Response schema to the xml schema.

The Poster is currently to a directory on the C:\ until i can get some data in the XML file.

image

anyone have any information for me?

How you are calling from Workflow from BPM? Check the trace in Service connect for more details for Error and data is coming from BPM or not.

When you call Service Connect workflow from a BPM directive, there is an option to call it synchronously or asynchronously.

When the workflow is called synchronously, BPM directive waits for the response from the workflow and then attempts to de-serialize it into objects it sent in – this allows the workflow to affect the data in the BPM directive as the result.
If you do not need the response from Service Connect workflow within the BPM directive, then set the call to it to be asynchronous - that will allow the BPM directive to continue, and will avoid “XML response from Service Connect workflow could not be deserialized.” error.

When you are creating the mapping from the incoming message into the one you need, make sure you picked up the correct schema to map from.
When Method Directive maintenance creates a blank SC workflow, it also pushes in the schema that corresponds to the message that would be sent at runtime, and assigns it to the Stat element; that is the schema that should be used as the input within the first Conversion in SC workflow (Conversion will inherit it if, after creating the Conversion element you would first link Start to it).

In Data Directive on the InvHead table when the POSTED changes from false to true it should kick off this SC Workflow.

The Workflow works as an XML file is dumped into the Directory i specified but it has no data except for the field names i mapped from the Method to the XML schema.

As Fakhruddin mentioned above, there’s Document Tracking.

If you set the Document Tracking on the Workflow Designer - open the process - Process Properties to Required, you the trace corresponding to the workflow execution will be recorded and will appear in Document Tracking within SC Administration console.

There, you can see each step, and check the output of steps that change the XML message, including conversions.
In the screenshot of the workflow, you have two XSLT Conversions.
Review the output of the first one in Document Tracking to see whether it transformed the data according to your expectations and adjust it as necessary, repeat with the second one.

Notes:
XSLT conversions are sensitive to the namespace used to pick the data.
XSLT mapper shows links that match and do not match the expected schema differently.
Just changing the schema on an element does not make the message correspond to that schema…

OK i managed to get that turned on.
The Workflow was successful but I get these FAILED messages on 2 of the steps.

image

EDIT
The root of my problems may be the start of the Workflow.

EDIT
I am unsure on how to import the InvcHead reference as it is a Data Directive not a Method Directive.

Hi, Is there a way of importing the assemblies for Data Directives.
They must exist as when i check the Document Tracker it states the ‘Start’ input schema is:
image

Just bumping this as I think i just need the above information and I should be good to go

Hi Ricky,

I am not sure how far along you are with accustoming with SC, so, I’ll start with the basics.
Stop me if you are past that.

When you create an SC workflow to handle the call from a directive (be it for a method or data directive), the corresponding UI allows you to select an existing SC workflow (assuming it is capable of handling the data sent by the directive) or create a new one.
If SC workflow is created using the directive management UI, is it set up to accept the message structure as the corresponding directive sends it – i.e. the schema is created for the request and the response, and is assigned to its Start and Finish element as it is relevant:

Here, I am creating a new workflow from the Standard directive UI:

Here is the created workflow and the properties of its start element:

Now, here I created the a Conversion and a Poster elements and inked them.
The conversion’s Input schema was inherited from the Start element, while its Output schema was inherited from Finish element.
We can ignore what is sent to Finish element since I am calling that SC workflow from a BPOM directive asynchronously.
You can tell that schemas were inherited since they are shown in properties in gray text; if they were not inherited, they would have been in black text:

I selected a different schema for the output of the Conversion; I did not change the Input schema of the first Conversion element, since it describes the message that will arrive from the directive:
image

I can now go into the XSLT Mapper (Edit… button) and design the conversion by dragging links around to transform the incoming message into the structure I need:

I have verified that the Document Tracking for the workflow is set to Required, and saved it.

After triggering the BPM directive to fire so that it calls the SC workflow, I can check the document tracking in SC:

There’s a slight winkle (at least in my case):
Checking the message against the schema on Start element brings up a message that SpecifiedProperties in BpmDataRow are unexpected:

However the verification of the message at the output of the Conversion is all right:

and the XML file is also posted according to my expectations:

2 Likes

I do not exactly follow the question:
The BPM directive designer can create XSD schemas – the declaration of the expected message structure.
That is applicable both to Method and Data Directive Maintenance (as shown above) as well as using Create Programming Interface command on the first tab of each maintenance.
Create Programming Interface command creates XSD schemas in the folder you select; they need to be uploaded to Service Connect manually, using SC’s Administration Console, whereas creating an SC workflow also creates and uploads corresponding schemas.

The schema you are showing is apparently relevant for calls from a Standard Data Directive on InvcHead table, so, if it is on Start of your SC workflow that is called from such directive, it is correct.

You do not need to import Data Directive assemblies for this into Service Connect.

If you wanted to call Epicor business objects from SC workflow, you would need to import corresponding Contract assemblies (if you wanted to go with .NET assembly import) into Service Connect from a relevant Epicor Client installation, or REST references to Epicor BOs.

@AMS Thank you so much for this explanation. I have managed to get an exported xml file using your instructions above.

I don’t mean to ask for everything but if I wanted to pull the Detail information into the XML file as well as the Invoice header fields is that at all possible. I tried calling the ARInvoice BO Method from within the initial BPM to populate a DS with all the info required. I was then hoping when i created the SC Workflow from within the BPM it would add the dataset into the mappings section.

Hi Ricky,

While you can pull additional data within the BPM directive into in-memory variables, those variables are not exposed into SC workflow when it is invoked, they are for use within the directive itself – only input, output parameters and result of the BPM directive are sent to SC workflow.

You can, however do it differently – while passing the base data above to the SC workflow, you can extend the SC workflow to pull additional data as it executes.

To achieve this, you first need to define the means on SC side, as to how it should call Epicor:

  • by importing a .NET reference to a corresponding *.Contract.* assembly (you will need to have corresponding Epicor Client deployed to SC side)
  • by importing a REST reference to the Epicor REST API, if so, I would go with Custom Method import, not OData

You can then invoke corresponding reference from SC workflow to pull the data, by preparing the request as relevant for the method you intend to call (Conversion element), calling the method (.NET / REST reference element), and then converting the response, possibly together with the additional data you received from the directive (another Conversion element), into the output document you would use in Poster.

Let me know if the above makes sense to you.

@AMS I have tried what you stated above but with very little luck.

Just to show you what i tried:
Created a conversion form the Initial Request to the initial Schema Response
Created the next conversion from Initial Schema Response to the new imported ARInvoiceBO Request
Created the conversion between AR Invoice Request and its Response schema.
Added another conversion from the AR Invoice response to the XML Schema
Created the POSTER output to the File Path.
FINISH = the initial Response schema

Right.

Conversion does not load the data; you need to call either the .NET reference or REST reference.

Here’s how the simple workflow doing additional load of the data using a .NET reference would look (I am calling Ice Tip GetByID as an example), with:

  • Conversion preparing the Request for GetByID
  • Call to the business object method (you need to import the corresponding reference, as mentioned earlier)
  • Conversion that processes the response and creates the output message
    Of course you may have more conversions of calls, that is the simplistic one:

@AMS

Hi, I gave that a go and thought i had it but everytime it runs the GetByID call i get the below error.

See below current Workflow:

<?xml version="1.0" encoding="utf-16" standalone="yes"?>

<msg:req tag=“ARInvoice.Erp.Proxy.BO.ARInvoiceImpl.GetByID”>
msg:ers
<msg:error type=“unexpected error”>
msg:number-2147467261</msg:number>
msg:descriptionObject reference not set to an instance of an object.</msg:description>
msg:sourceEpicor.NETProxy
at Epicor.NETProxy.RemoteNETProxy.CallEpicorMethod(INETProxyEpicor proxy, XmlTextReader reader, XmlTextWriter writer, AssemblyCallSettings settings, Queue1 errs) at Epicor.NETProxy.RemoteNETProxy.ExecuteAssemblyCode(AssemblyCallSettings settings, String requestXml, Queue1 errs)
at Epicor.NETProxy.RemoteNETProxy.ExecuteAssemblyCode(String settingsXml, String requestXml, Queue`1& errs)</msg:source>
</msg:error>
<msg:error type=“unexpected error”>
msg:number2147220990</msg:number>
msg:descriptionUnspecified error: Failed to execute proxy assembly: Object reference not set to an instance of an object.</msg:description>
msg:sourceUnknown fatal errors occurred:

Server stack trace:
at Epicor.NETProxy.RemoteNETProxy.ExecuteAssemblyCode(String settingsXml, String requestXml, Queue`1& errs)
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Epicor.NETProxy.RemoteNETProxy.ExecuteAssemblyCode(String settingsXml, String requestXml, Queue`1& errs)
at Epicor.NETProxy.NETProxy.ExecuteAssemblyCode(AssemblyCallSettings settings, String requestXml, IBusinessContext ctx)
at ScaWGenericNETCall.GenericNETCall.ParseDta(IBusinessContext ctx, ManagerRequest request, XmlTextReader reader, XmlTextWriter writer)
at iScala.Framework.InternalBaseManager.ProcessXML(String Data)</msg:source>
</msg:error>
</msg:ers><msg:dta xmlns:msg=“http://Epicor.com/InternalMessage/1.1”><ext_Erp_Proxy_BO_ARInvoiceImpl_GetByID_Request:Erp_Proxy_BO_ARInvoiceImpl_GetByID_Request xmlns:ext_Erp_Proxy_BO_ARInvoiceImpl_GetByID_Request=“http://Epicor.com/ARInvoice/Erp_Proxy_BO_ARInvoiceImpl_GetByID_Request”/></msg:dta>msg:ctx1truefalsefalsefalse</msg:ctx>msg:wfl<msg:ElemID xmlns:msg=“http://Epicor.com/InternalMessage/1.1”>{CE77AF95-E134-4F83-938E-DEC1F46F86E1}</msg:ElemID><msg:PrcID xmlns:msg=“http://Epicor.com/InternalMessage/1.1”>{7CA62EEF-0750-40CD-AE86-4660EE602310}</msg:PrcID><msg:WflID xmlns:msg=“http://Epicor.com/InternalMessage/1.1”>Test_ARInvoiceCEF\TEST_CEFXML_2</msg:WflID><msg:MsgID xmlns:msg=“http://Epicor.com/InternalMessage/1.1”></msg:MsgID></msg:wfl></msg:req>
msg:trcmsg:PrcID{86EFF5C4-E49F-43B2-A8DF-D3E3339763AE}</msg:PrcID>msg:TrcSessionID{86EFF5C4-E49F-43B2-A8DF-D3E3339763AE}</msg:TrcSessionID>msg:TrcID{D9AA96ED-8687-4D4A-BAD9-5D2831E2115C}</msg:TrcID>msg:CallModesync-req/res<
/msg:CallMode></msg:trc></msg:msg>

In the conversion preceding the GetByID call – did you map values (preferably from the incoming message) to all the parameters of the Request, like Company, ID of the invoice, etc?

@AMS Yes the mappings are from the input Company & InvoiceNum to the Output CompanyID & invoiceNum

All right, let’s try isolating the case.

If you go to SC Administration Console, under Connectivity - .NET References and select the reference, you should be able to right-click …GetByID and select Test…

In the Test Method dialog, you can enter the relevant parameter values (not the ones I used) and let SC invoke the method, similarly to how it does from the workflow.

  • Does it result in the same error?
  • Is your version of SC same or newer than the one of Epicor, except for Epicor updates?

@AMS I updated the Service Connect Server/Client not too long back to match the ERP10 version so that should be ok.

I have done a test on the .Net Reference with the correct parameters and the error is exactly the same.
Just to add when i try to re-import the .NET Reference it always fails when i have the USE SERVICE LICENCE and IMPRT UD FIELDS check boxes ticked. (This was also the case prior to the most recent update) If they are unchecked then it imports ok.