Salesforce

How Do I Send or Receive Complex Arguments? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Send or Receive Complex Arguments? (Magic xpa 3.x)

Some SOAP services send very simple data that can be sent and received using simple Magic xpa variables, which will be translated by Magic xpa as needed. However, many SOAP services are quite complex, and you should use XML data sources to prepare and extract the XML documents.

How to know if a WSDL uses complex arguments

If a WSDL uses complex arguments, you will need to set up XML files to send or receive the data.

You can tell that XML data is expected because the External Type field will contain a path pointing to an XML Schema (XSD) file. The XML Schema file will be created on your computer by Magic xpa, when you declare the Web service. This XML Schema is what you can use to create the expected XML data source, as described in How Do I Create an XML View?.

Declaring the BLOB variable

First, you need to declare a variable that will hold the XML document. You would declare this as you would any other variable, only the attribute type is Blob.

The Content type should be Ansi or Unicode, as it will be containing text.

If the GUI display field is set to Rich edit, then you can easily display the Blob on-screen in a Rich Edit field.

Creating and reading the XML Blob

To create or read the XML Blob, you first need to set up an XML data source, based on the XML Schema. This is explained in more detail in the XML chapter, How Do I Create an XML View?.

Once you have the XML Data source defined, you can move data to the XML file as you would any other data source.

  1. Before you call the subtask to create the XML file, update the Blob variable to NULL() to ensure it is empty.

  2. Call a subtask to move data to the Blob. In this subtask, the Main data source will be the XML data source. The XML source variable will be the XML Blob you are trying to read or write to.

  3. Treat the Data source as you would any other data source. If you are only sending one “line” of data, the subtask should only execute once, moving data into one “record”. In our example, there is only one data field to update, the country code, so we move the country code into the country code field and exit.

    Many times the XML document is very simple, involving only a few simple data elements. In this case you would only update the corresponding data elements once.

  4. The generation of the XML Blob is automatic from that point. Magic xpa will format the XML based on the XML Data source definition, and move it into the Blob you specified.

Using the Blob variable as an argument

Now, it is a simple matter to assign the Blob variable to the Web service argument.

Reference
Attachment 
Attachment